monsterDB by Damokles (and db update script)

Other plugins for extending OpenKore's functionality. This forum is only for posting new plugins and commenting on existing plugins. For support, use the Support forum.

Moderator: Moderators

Message
Author
iMikeLance
Moderators
Moderators
Posts: 208
Joined: 01 Feb 2010, 17:37
Noob?: No
Location: Brazil - MG
Contact:

monsterDB by Damokles (and db update script)

#1 Post by iMikeLance »

I needed to use this fantastic plugin and found out that it's database was outdated. So I created this auto-update script so you can manually update it to work with your server, just use the correct mob_db.txt.

Download the plugins here: https://openkore.svn.sourceforge.net/sv ... rDB/trunk/

And you can use this script to update it's database, save it as a .pl file:

Code: Select all

#!/usr/bin/perl -w

############################
# eAthena/Cronus to MonsterDB monster table converter by iMikeLance
############################
use utf8;
use strict;
use warnings;

# Renewal mon_db: https://cronusemulator.svn.sourceforge.net/svnroot/cronusemulator/Server/branches/Renewal/db/mob_db.txt
# Pre-renewal mon_db: https://cronusemulator.svn.sourceforge.net/svnroot/cronusemulator/Server/trunk/db/mob_db.txt

open DB, "<:utf8", "mob_db.txt" or die "Are you sure that mob_db.txt exists? Internal error: ".$!;
open EXT, ">:utf8", "monsterDB.txt" or die $!;

while (<DB>) {
        if ($_ =~ /^(\d+),\w+,(\w+ ?)+,(\w+ ?)+,\d+,(\d+),\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,(\d+),(\d+),(\d+),.*/) { # eA/Cronus syntax
                print EXT $1." ".$4." ".$5." ".$6." ".$7."\n";
        }
}

close(DB);
close(EXT);

print "Finished !\n";

system("pause");
Just put mob_db.txt and the perl script (you need activeperl, strawberry perl or any other perl interpreter installed) in the same folder and run the .pl. It should output the updated monsterDB.txt.

Dark Airnel
Been there done that!
Been there done that!
Posts: 133
Joined: 09 Oct 2009, 01:43
Noob?: No

Re: monsterDB by Damokles (and db update script)

#2 Post by Dark Airnel »

Hi I tried to modify this code so I can extract iRO or kRO names of monster so I can use it on monsters.txt however, I'm having problems extracting monsters with more than 1 word in their names e.g. White Plant. It seems the code only prints the first word and totally ignoring the rest of the monster's name. Please help.

Code: Select all

usr/bin/perl -w

############################
# eAthena/Cronus to MonsterDB monster table converter by iMikeLance
############################
use utf8;
use strict;
use warnings;

# Renewal mon_db: https://cronusemulator.svn.sourceforge.net/svnroot/cronusemulator/Server/branches/Renewal/db/mob_db.txt
# Pre-renewal mon_db: https://cronusemulator.svn.sourceforge.net/svnroot/cronusemulator/Server/trunk/db/mob_db.txt

open DB, "<:utf8", "mob_db.txt" or die "Are you sure that mob_db.txt exists? Internal error: ".$!;
open EXT, ">:utf8", "monsterDB.txt" or die $!;

while (<DB>) {
        if ($_ =~ /^(\d+),\w+,(\w+ ?)+,(\w+ ?)+,\d+,(\d+),\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,(\d+),(\d+),(\d+),.*/) { # eA/Cronus syntax
                print EXT $1." ".$3."\n";
        }
}

close(DB);
close(EXT);

print "Finished !\n";

system("pause");
Reason for extracting this is to prevent Kore from registering the wrong name of monster in monsters.txt. This happens when servers (private usually) use mobs as NPCs or during Disguise events.

User avatar
SkylorD
Moderators
Moderators
Posts: 1167
Joined: 16 Dec 2011, 02:53
Noob?: No
Location: Brazil
Contact:

Re: monsterDB by Damokles (and db update script)

#3 Post by SkylorD »

Dark Airnel wrote:Hi I tried to modify this code so I can extract iRO or kRO names of monster so I can use it on monsters.txt however, I'm having problems extracting monsters with more than 1 word in their names e.g. White Plant. It seems the code only prints the first word and totally ignoring the rest of the monster's name. Please help.

Code: Select all

usr/bin/perl -w

############################
# eAthena/Cronus to MonsterDB monster table converter by iMikeLance
############################
use utf8;
use strict;
use warnings;

# Renewal mon_db: https://cronusemulator.svn.sourceforge.net/svnroot/cronusemulator/Server/branches/Renewal/db/mob_db.txt
# Pre-renewal mon_db: https://cronusemulator.svn.sourceforge.net/svnroot/cronusemulator/Server/trunk/db/mob_db.txt

open DB, "<:utf8", "mob_db.txt" or die "Are you sure that mob_db.txt exists? Internal error: ".$!;
open EXT, ">:utf8", "monsterDB.txt" or die $!;

while (<DB>) {
        if ($_ =~ /^(\d+),\w+,(\w+ ?)+,(\w+ ?)+,\d+,(\d+),\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,(\d+),(\d+),(\d+),.*/) { # eA/Cronus syntax
                print EXT $1." ".$3."\n";
        }
}

close(DB);
close(EXT);

print "Finished !\n";

system("pause");
Reason for extracting this is to prevent Kore from registering the wrong name of monster in monsters.txt. This happens when servers (private usually) use mobs as NPCs or during Disguise events.
Are you sure about your Regular Expression ?
Post what that script did.
Learn rules

Dark Airnel
Been there done that!
Been there done that!
Posts: 133
Joined: 09 Oct 2009, 01:43
Noob?: No

Re: monsterDB by Damokles (and db update script)

#4 Post by Dark Airnel »

I think my Regular Expression is wrong. I tried different syntax but they did not give the result I need. Here's a part of what that modded code generated.

This is what the code generated:

Code: Select all

1078 Plant
1079 Plant
1080 Plant
1081 Plant
1082 Plant
1083 Plant
This is what is suppose to appear in monsters.txt:

Code: Select all

1078 Plant
1079 Red Plant
1080 Blue Plant
1081 Yellow Plant
1082 Shining Plant
1083 White Plant
It seems the regex I'm using cannot capture names with multiple words and spaces. I did lots of attempts to no avail and now is asking for help :(. Thanks in advance!

Dark Airnel
Been there done that!
Been there done that!
Posts: 133
Joined: 09 Oct 2009, 01:43
Noob?: No

Re: monsterDB by Damokles (and db update script)

#5 Post by Dark Airnel »

Code: Select all

#!/usr/bin/perl -w

############################
# eAthena/Cronus to MonsterDB monster table converter by iMikeLance
############################
use utf8;
use strict;
use warnings;

# Renewal mon_db: https://cronusemulator.svn.sourceforge.net/svnroot/cronusemulator/Server/branches/Renewal/db/mob_db.txt
# Pre-renewal mon_db: https://cronusemulator.svn.sourceforge.net/svnroot/cronusemulator/Server/trunk/db/mob_db.txt

open DB, "<:utf8", "mob_db.txt" or die "Are you sure that mob_db.txt exists? Internal error: ".$!;
open EXT, ">:utf8", "monsterDB.txt" or die $!;

while (<DB>) {
        if ($_ =~ /^(\d+),\w+,(\w+.\w+.\w+)+,(\w+ ?)+,\d+,(\d+),\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,(\d+),(\d+),(\d+),.*/) { # eA/Cronus syntax
                print EXT $1." ".$2."\n";
        }
}

close(DB);
close(EXT);

print "Finished !\n";

system("pause");

This one works for as long as the monster's name does not have a number or a symbol. I have to manually add RSX-0806 and Snake Lord's Minion in the monsters.txt.

User avatar
SkylorD
Moderators
Moderators
Posts: 1167
Joined: 16 Dec 2011, 02:53
Noob?: No
Location: Brazil
Contact:

Re: monsterDB by Damokles (and db update script)

#6 Post by SkylorD »

Dark Airnel wrote:

Code: Select all

#!/usr/bin/perl -w

############################
# eAthena/Cronus to MonsterDB monster table converter by iMikeLance
############################
use utf8;
use strict;
use warnings;

# Renewal mon_db: https://cronusemulator.svn.sourceforge.net/svnroot/cronusemulator/Server/branches/Renewal/db/mob_db.txt
# Pre-renewal mon_db: https://cronusemulator.svn.sourceforge.net/svnroot/cronusemulator/Server/trunk/db/mob_db.txt

open DB, "<:utf8", "mob_db.txt" or die "Are you sure that mob_db.txt exists? Internal error: ".$!;
open EXT, ">:utf8", "monsterDB.txt" or die $!;

while (<DB>) {
        if ($_ =~ /^(\d+),\w+,(\w+.\w+.\w+)+,(\w+ ?)+,\d+,(\d+),\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,(\d+),(\d+),(\d+),.*/) { # eA/Cronus syntax
                print EXT $1." ".$2."\n";
        }
}

close(DB);
close(EXT);

print "Finished !\n";

system("pause");

This one works for as long as the monster's name does not have a number or a symbol. I have to manually add RSX-0806 and Snake Lord's Minion in the monsters.txt.
bRO :

Scorpion - Escorpião
Mandragora - Mandrágora
Valkyrie - Valquíria
Osiris - Osíris
Baphomet - Bafomé
Thief bug egg - Ovo de Besouro-Ladrão


hasuashuash and much others.

35% of monsters have accent and ç.
Learn rules

Dark Airnel
Been there done that!
Been there done that!
Posts: 133
Joined: 09 Oct 2009, 01:43
Noob?: No

Re: monsterDB by Damokles (and db update script)

#7 Post by Dark Airnel »

This one works like charm. It extracts iRO name of monsters from mob_db.txt. It can match numbers, hyphen and apostrophes in monster's name. Hope it can be of help. Here's the code:

Code: Select all

#!/usr/bin/perl -w

############################
# eAthena/Cronus to MonsterDB monster table converter by iMikeLance
############################
use utf8;
use strict;
use warnings;

# Renewal mon_db: https://cronusemulator.svn.sourceforge.net/svnroot/cronusemulator/Server/branches/Renewal/db/mob_db.txt
# Pre-renewal mon_db: https://cronusemulator.svn.sourceforge.net/svnroot/cronusemulator/Server/trunk/db/mob_db.txt

open DB, "<:utf8", "mob_db.txt" or die "Are you sure that mob_db.txt exists? Internal error: ".$!;
open EXT, ">:utf8", "monsterDB.txt" or die $!;

while (<DB>) {
        if ($_ =~ /^(\d+),\w+,([A-Za-z0-9's-]+[-.+\w+\s\d+']+)+,([A-Za-z0-9's-]+[-.+\w+\s\d+']+)+,\d+,(\d+),\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,(\d+),(\d+),(\d+),.*/) { # eA/Cronus syntax
                print EXT $1." ".$3."\n";
        }
}

close(DB);
close(EXT);

print "Finished !\n";

system("pause");
@SkylorD

I think those are unicodes. I do not know how to make regex to match unicodes but I'll give it a try if I have extra time.

EternalHarvest
Developers
Developers
Posts: 1798
Joined: 05 Dec 2008, 05:42
Noob?: Yes

Re: monsterDB by Damokles (and db update script)

#8 Post by EternalHarvest »

Can't you just match anything except commas

Code: Select all

,([^,]+),
in a relevant position? Are there commas in monster names?

User avatar
SkylorD
Moderators
Moderators
Posts: 1167
Joined: 16 Dec 2011, 02:53
Noob?: No
Location: Brazil
Contact:

Re: monsterDB by Damokles (and db update script)

#9 Post by SkylorD »

I have been used many substitutions on my script.
I not use "if" condition.Only substitutions. =D

Look this :
1579,Slipxxliose,Garena_Slipxxliose,1,2,6,6,4,7,87,987,,,,15,0,,,,
$lines =~ s/,(\d+)//g;

50% of line was reduced.
Learn rules

Dark Airnel
Been there done that!
Been there done that!
Posts: 133
Joined: 09 Oct 2009, 01:43
Noob?: No

Re: monsterDB by Damokles (and db update script)

#10 Post by Dark Airnel »

EternalHarvest wrote:Can't you just match anything except commas

Code: Select all

,([^,]+),
in a relevant position? Are there commas in monster names?
None. At least in the server I am playing. Only letters, apostrophes, hyphen and numbers. I'll try the regex that you posted and se what will happen.

Post Reply