Jump to content

trading


Recommended Posts

Posted (edited)
if (api.getBank().getAmount(item) > amount) {
			close bank
			api.getPlayers().closest(their name).interact("Trade with");
			sleep conditional till api.getTrade().isFirstInterfaceOpen();
			api.getTrade().offer(itemid, amount);
			sleep conditional till api.getTrade().getOurOffers().contains(item);
			api.getTrade().acceptTrade();
			sleep condition till api.getTrade().isSecondInterfaceOpen();
			api.getTrade().acceptTrade();
			sleep conditional till !api.getTrade().isCurrentlyTrading();
		}

ignore the api method provider

Edited by IHB
  • Like 1
Posted (edited)

how would this be done?

 

if bank contains x items

trade the items to other player

 

Bot with items to trade:

if inventory contains x items
    if bank is open
        close bank
    else if not in trade
        use trade interaction on target player
        sleep until in trade
    else if in trade with wrong player
        close trade
    else if on first trade screen
        if not offered x items
            offer x items
        else if not accepted
            accept trade
    else if on second screen
        if not accepted trade
            accept trade
else if not bank is open
    open bank
else if bank contains x items
    withdraw x items
else 
    stop

Bot receiving items:

bool trade

On received message:
   if message is of type trade and message is from target player
      set trade to true

On loop:
   if trade is true
      if not in trade
          do trade interaction with target player
          sleep until in trade
      else if not trading target player
          close trade
      else if on first window
          if other player accepted
              accept trade
      else if on second window
          if other player accepted
              accept trade
              set trade to false
Edited by Explv
  • Like 12
Posted
if (api.getBank().getAmount(item) > amount) {
			close bank
			api.getPlayers().closest(their name).interact("Trade with");
			sleep conditional till api.getTrade().isFirstInterfaceOpen();
			api.getTrade().offer(itemid, amount);
			sleep conditional till api.getTrade().getOurOffers().contains(item);
			api.getTrade().acceptTrade();
			sleep condition till api.getTrade().isSecondInterfaceOpen();
			api.getTrade().acceptTrade();
			sleep conditional till !api.getTrade().isCurrentlyTrading();
		}

ignore the api method provider

 

This will fail if it has to reloop because the bank isn't open and it can't check to see the amount of item in the bank.

 

Posted

 

Bot with items to trade:

if inventory contains x items
    if bank is open
        close bank
    else if not in trade
        use trade interaction on target player
        sleep until in trade
    else if in trade with wrong player
        close trade
    else if on first trade screen
        if not offered x items
            offer x items
        else if not accepted
            accept trade
    else if on second screen
        if not accepted trade
            accept trade
else if not bank is open
    open bank
else if bank contains x items
    withdraw x items
else 
    stop

Bot receiving items:

bool trade

On received message:
   if message is of type trade and message is from target player
      set trade to true

On loop:
   if trade is true
      if not in trade
          do trade interaction with target player
          sleep until in trade
      else if not trading target player
          close trade
      else if on first window
          if other player accepted
              accept trade
      else if on second window
          if other player accepted
              accept trade
              set trade to false

I cannot stress enough how fucking AMAZING it was to have this written out while i was writing my muling code.. made it so much easier.

  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...