Jump to content

trading


combat_acc

Recommended Posts

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

 

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
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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