Auto-Dismantle in Town

hello @Ryan , me again. I hope you don’t get angry when you see me.

We have a problem in TRSRO, maybe you know. When you sell 9 degree items, it does not give good gold.However, we can obtain gold well above the value of the item from the obtained elements. When we make the correct pick settings, we can automatically sell the elements and store the stones.

Except for SOX items, is there an option to dismantle all the items in our inventory when we come to the town?

You can even add the option of not dismantle according to blue, as in the settings section of the pick filter for the future process. immortal blues vs.

It would be extremely functional for us, especially if it was added with dismantling between this option. We also add destroyer rondo to the town cycle.

image

The arrival of this setting will be a very important and highly functional setting for Turkish players.

Thank you in advance for your interest and relevance.

4 Likes

Hello, its gonna be very helpful development for TRSRO Players.

You can try to use this plugin which adds dismantle command as script.

Be carefull, it will destroy everything on inventory if you have enough destroyer rondo.

xScriptHelper
from phBot import *
from threading import Timer
from time import sleep
import struct

pName = 'xScriptHelper'
pVersion = '1.0.1'
#pUrl = 'https://raw.githubusercontent.com/JellyBitz/phBot-xPlugins/master/xScriptHelper.py'

# ______________________________ Initializing ______________________________ #

DISMANTLE_MAX_ATTEMPTS = 3

DismantlingCurrentSlot = 0
DismantlingAttempts = 0
DismantlingBlacklisted = []
DismantlingErrorCode = 0

# ______________________________ Methods ______________________________ #

def Inject_DismantleItem(itemSlot):
	p = b'\x01' + struct.pack('B',itemSlot)
	inject_joymax(0x7157,p,False)

# Dismantle items if some item is found
def DismantleItem(ItemName=None):
	global DismantlingErrorCode
	if DismantlingErrorCode:
		if DismantlingErrorCode == 22536:
			log("Plugin: Not enough inventory space to continue dismantling!")
		elif DismantlingErrorCode == 22535:
			log("Plugin: Not enough Destroyer Rondo's to continue dismantling!")
		else:
			log("Plugin: Error code ("+str(DismantlingErrorCode)+") to continue dismantling!")
		DismantlingErrorCode = 0
		start_bot()
		return
	inventory = get_inventory()
	items = inventory['items']
	itemFound = False
	# Checkk items from inventory
	for slot, item in enumerate(items):
		if item and slot > 12:
			itemData = get_item(item['model'])
			# Make sure item is equipable
			if itemData['tid1'] != 1:
				continue
			# Make sure item is not an avatar or job item
			if itemData['tid2'] == 7 or itemData['tid2'] == 13:
				continue
			# Check if it's dismantling by name 
			if ItemName and ItemName != item['name']:
				continue

			# if at least one item has been found, stop bot!
			itemFound = True
			stop_bot()
			# Check if this slot cannot be dismantled
			if slot in DismantlingBlacklisted:
				continue
			# Check dismantling attempts
			global DismantlingCurrentSlot
			global DismantlingAttempts
			if slot == DismantlingCurrentSlot:
				DismantlingAttempts+=1
			else:
				DismantlingAttempts=0
			if DismantlingAttempts == DISMANTLE_MAX_ATTEMPTS:
				log('Plugin: Skiping "'+item['name']+'", too many dismantling attempts!')
				DismantlingBlacklisted.append(slot)
				continue
			# Try dismantle it
			DismantlingCurrentSlot = slot
			log('Plugin: Trying to dismantle "'+item['name']+'"...')
			Inject_DismantleItem(slot)
			# waits a little bit for item to be dismantled
			Timer(3,DismantleItem,[ItemName]).start()
			break
	# restart bot if nothing can be found
	if not itemFound:
		log("Plugin: Dismantling finished!")
		start_bot()

# ______________________________ Events ______________________________ #

# Try to dismantle items on inventory
def dismantle(args):
	# reset some vars
	DismantlingBlacklisted.clear()
	# check params
	if len(args) > 1 and args[1]:
		# dismantle by item name
		DismantleItem(args[1])
	else:
		# dismantle all
		DismantleItem()
	# All done
	return 0

# All packets received from game server will be passed to this function
# Returning True will keep the packet and False will not forward it to the game client
def handle_joymax(opcode, data):
	if opcode == 0xB157:
		# check failure
		if data[0] != 1:
			global DismantlingErrorCode
			DismantlingErrorCode = struct.unpack_from('<H',data,1)[0]
	return True

# Plugin loaded
log('Plugin: '+pName+' v'+pVersion+' succesfully loaded')

image

url not found

https://raw.githubusercontent.com/JellyBitz/phBot-xPlugins/master/xScriptHelper.py

There is the code. Why do you need an url?

i added plugin to folder and reload in bot but plugins not saw this plugin. :frowning:

Plugin: xScriptHelper v1.0.1 succesfully loaded

Is not enough for you?
I clearly said it adds script command dismantle… not a plugin tab or anything else.

I guess I don’t really understand how it’s done.

Could you explain a little more explicitly how I should do it?

Do you know what script command means?

move...
move...
DoStorage...
move..
dismantle
move..

yes.

By the way, we generally know the names of sox items in the game, don’t we have the possibility to ignore them while doing dismantling?

You can try to save it on storage before destroying everything at inventory…
Just take a look to the script shown above?

hey jelly is there any solution for my problem ? . İt works good but if i dont choose dont store and dont sell items . Bot dont move items from pet to my inventory so cant dismantle … can you add option to when starting to dismantle , move items from pet to inventory plss. Thank you

It’s really good for TRSRO players. I just tried and works. You can add to your town script after do Stroge. It’ll be better for you.

Auto dismantle was added to the bot, give it a try.

You can download from the #testing channel in discord.

just a little favor … if i click dismantle blue items and dont click plussed items . if there is plussed + blue items in my inventory bot is dismantling it. i want to dismantle blue items but dont want to dismantle plussed and have blue items. hope you understand me… thank you

@JellyBitz hello there. Does the plugin support disjointing materials?

@JellyBitz Great work, thanks! Small issue: Plugin gets stuck, when there is an item in inventory which cant be dismantled(broken items from uniques). Currently you are checking if the item is job items etc., maybe you should also consider checking the statement if the current item is in blacklist or not. That might solve the issue.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.