Jump to content

Mob Color ( Mob_Proto ) Fix


Evor

Recommended Posts

M2 Download Center

This is the hidden content, please
( Internal )

Hello guys!

 

It is common that, whenever u want to use an old mob_proto, u need to rewrite mob_color column for every mob (serverside mob_proto dosen't include mob_color). I write this really simple python code to convert old mob_proto columns to a sql version of it. (Simply, insert that .sql file).

 

To do:
- Place your old mob_proto_dump.xml in a folder with converter.py

- Remove first and last line of mob_proto_dump.xml

- Make sure that u have python installed. (no matter which version)

- Run it and save time :)

 

Spoiler

## oldMobProto to sqlMobProto Converter
## Created by Evor.
## For personal use 
oldProto = open("mob_proto_dump.xml", "r+")
newProto = open("mob_proto_color.sql", "w+")
newProto.write("/* Converter by Evor */n")
for line in oldProto:
	vnum = line.split("vnum=")[1].split(" name=")[0].replace(""", "")
	mobColor = line.split("mob_color=")[1].split(" />")[0].replace(""", "")
	if not int(mobColor) == 0:
		newProto.write("UPDATE mob_proto SET mob_color='%s' WHERE vnum='%s' ;n" % ## there is a space between end of mysql syntax and semicolom, becouse without it navicat has some troubles in inserting that.
		(mobColor, vnum))
oldProto.close()
newProto.close()
	

 

Kind regards.

 

@Update.
Smaller code.

  • Metin2 Dev 9
  • Good 3
  • Love 5
Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Announcements



×
×
  • 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.