[Plugin] xAutoConfig


#1

This plugin will load default configuration that you wish to your new created character (or any other with no configuration previously).

How to use:

  • Rename the config that you want by default to “default”

Example: Default.json

xAutoConfig
from phBot import *
import shutil
import os

log('Plugin: xAutoConfig successfully loaded.')

# Called when the user successfully selects a character. No character data has been loaded yet.
def joined_game():
	# JSON config not found
	if not os.path.exists(get_config_path()):
		# Looking for JSON default configs
		defaultConfig = get_config_dir()+"Default.json"
		# Loading JSON default configs
		if os.path.exists(defaultConfig):
			shutil.copyfile(defaultConfig,get_config_path())
			log("Plugin: Default JSON configurations successfully loaded (xAutoConfig)")

Phbot setting
#2

this plugin only work for .json? can you add to conf. db3 too?


#3

There is…

xAutoConfig v0.0.2
from phBot import *
import shutil
import os

log('Plugin: xAutoConfig successfully loaded.')

# Called when the user successfully selects a character. No character data has been loaded yet.
def joined_game():
	# JSON config not found
	if not os.path.exists(get_config_path()):
		# JSON default configs path
		defaultConfig = get_config_dir()+"Default.json"
		# Loading JSON
		if os.path.exists(defaultConfig):
			shutil.copyfile(defaultConfig,get_config_path())
			log("Plugin: Default JSON successfully loaded")
		# db3 default filter path
		defaultFilter = get_config_dir()+"Default.db3"
		# Loading db3
		if os.path.exists(defaultFilter):
			shutil.copyfile(defaultFilter,get_config_path())
			log("Plugin: Default Filter successfully loaded")

#4

[23:48:00] Your config is out of date. Please reconfigure the bot
No esta funcionando con la parte del .db3


#5

Right, how it’s setup the .db3 ?
It’s “Servername - Server_Charname.db3” too?


#6

[23:59:06] Your config is out of date. Please reconfigure the bot.


#7
	defaultFilter = get_config_dir()+"Default.db3"
	# Loading db3
	if os.path.exists(defaultFilter):
		shutil.copyfile(defaultFilter,get_config_path())
		log("Plugin: Default Filter successfully loaded")

#8
xAutoConfig v0.0.3
from phBot import *
import shutil
import os

log('Plugin: xAutoConfig v0.0.3 successfully loaded.')

# Called when the user successfully selects a character. No character data has been loaded yet.
def joined_game():
	# JSON config not found
	if not os.path.exists(get_config_path()):
		# JSON default configs path
		defaultConfig = get_config_dir()+"Default.json"
		# Loading JSON
		if os.path.exists(defaultConfig):
			shutil.copyfile(defaultConfig,get_config_path())
			log("Plugin: Default JSON successfully loaded")
		# db3 default filter path
		defaultFilter = get_config_dir()+"Default.db3"
		# Loading db3
		if os.path.exists(defaultFilter):
			shutil.copyfile(defaultFilter,get_config_path().replace(".json",".db3"))
			log("Plugin: Default Filter successfully loaded")

#9

Ahora si funciono, un millon de gracias.
Una pregunta, donde puedo aprender hacer los plugin mas bien conocer todo sobre los packets del game y demas porque sin eso no podre hacer nada.


#10

hmm…