Jump to content

[Python]Auto Trade


Go to solution Solved by hachiwari,

Recommended Posts

Hi. I want create simple python script to autotrade withother character. On this moment i finding player with nickname and starting trade. But i cant add all items to trade window. Heres my simple code:
 

import ui,app,chat,chr,net,player,item,skill,time,game,shop,chrmgr,thread,event,exchange


SWITCH_RARE_VNUM = 30270
start = 0
end = 2000000
SzamVID = 0
exslot = 0
for vid in range(start, end):
    if chr.GetInstanceType(vid) != 6:
        continue
    
    if chr.GetNameByVID(vid) == "DajSeNaLuz":
		SzamVID = vid
		break
		
net.SendExchangeStartPacket(SzamVID)
for i in range(0,90*2):
	if player.GetItemIndex(i) == SWITCH_RARE_VNUM:
		chat.AppendChat(chat.CHAT_TYPE_INFO, "Odłamek znaleziony")
		net.SendExchangeItemAddPacket(i, exslot)
		exslot += 1

net.SendExchangeAcceptPacket()

I think problem is that i dont understant how to use net.SendExchangeItemAddPacket function. Somebody can explain what is wrong here?

  • Love 1
Link to comment
https://metin2.dev/topic/18996-pythonauto-trade/
Share on other sites

  • Active Member

Check with 

for i in range(0,90*2):
        attachedSlotType = player.INVENTORY
        attachedInvenType = player.SlotTypeToInvenType(attachedSlotType)
        itemVnum = player.GetItemIndex(attachedInvenType, i)

	if itemVnum == SWITCH_RARE_VNUM:
		chat.AppendChat(chat.CHAT_TYPE_INFO, "Odłamek znaleziony")
                net.SendExchangeItemAddPacket(attachedInvenType, i, exslot)
		exslot += 1

 

Link to comment
https://metin2.dev/topic/18996-pythonauto-trade/#findComment-103424
Share on other sites

Tested and nothing happen. But if i comment 3 last lines:

net.SendExchangeItemAddPacket(i, exslot)
net.SendExchangeItemAddPacket(attachedInvenType, i, exslot)
exslot += 1

Code normally run. I dont have any idea how make this work...

 

After change exslot += 1 to  exslot=exslot+1 code run but still must have commented net.SendExchangeItemAddPacket functions. 

Link to comment
https://metin2.dev/topic/18996-pythonauto-trade/#findComment-103425
Share on other sites

Change Net etc  for that you tell and still this same. I still dont understand How to get DstSlotNumber for slot in exchange window. 

That Script only must do Open Trade With My Character Move all Dragon Shard to trade and Accept. At This time only move all Dragon Shard dosent work and i dont know why ... Thats my second python script

Link to comment
https://metin2.dev/topic/18996-pythonauto-trade/#findComment-103434
Share on other sites

  • Active Member
16 godzin temu, MrMuniez napisał:

Thanks YOu BRO. That Pastebin code Works perfect. Can you tell me only function to walk to character ? 

These functions:

	x, y = chr.GetPixelPosition(vid)[:2]
	myX, myY = player.GetMainCharacterPosition()[:2]
	chr.MoveToDestPosition(player.GetMainCharacterIndex(), x, y)

Good luck!

  • Love 1
Link to comment
https://metin2.dev/topic/18996-pythonauto-trade/#findComment-103482
Share on other sites

  • 6 months later...
2 minutes ago, xP3NG3Rx said:

Of course it isn't working because they removed those functions.

already i know,i just ask "how to solve it?".

 

m2bob and m24pro is using these functions or same functions 

my question is "what is new function?"

Link to comment
https://metin2.dev/topic/18996-pythonauto-trade/#findComment-111605
Share on other sites

5 hours ago, xP3NG3Rx said:

Oh lord.
Those are using hooking/detouring methods written under c++.

i will search this subject, thank u so much

 

EDIT : This python code not working(TradeBot) ,can u check it?(not getpixel position or movetodestpost)

Link to comment
https://metin2.dev/topic/18996-pythonauto-trade/#findComment-111614
Share on other sites

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.