Jump to content
trickyloki3

ItemDB Script Translation Project

Recommended Posts

ItemDB Script Translation Project
Project License: MIT
Project Site: https://github.com/trickyloki3/eAdb.Compiler3

Language: C

Project Alt Link: http://forum.ratemyserver.net/ro-graphic-coding-media/itemdb-translation-project/
Project Alt Link: http://rathena.org/board/topic/99684-itemdb-script-translation-project/
 

dbro: an item database that uses eadb.compiler http://devilishro.net/ (currently in development)


Hi everyone,
 
I've developed a complete program that can translate item scripts (consisting of a subset of the scripting language) into English translations.


The program is developed to streamline item development and couple the item database with item client tables.

 

Please let me know how to improve the project.

 

Thank you!

 

Project Update
 * Support pet script and pet loyal script.
 * Support item combo bonus.
 * Support bonus minimization.
 * Simplified packages and boxes.
 * Support project integration; exit-free and memory-leak free.
 * Support for-loop (limited) w/ iterable set blocks.
 * Simplify complex expressions.
 * Support pre-renewal and renewal eAthena, rAthena, and Hercules databases.
 * Support flavour text and item attribute in final translation.
 * Support eAthena, rAthena, Hercules idnum2itemdesctable.txt format generation.
 * Support Hercules' bindonequip, buyingstore, delay, stack, and trade settings.
 * Support eAthena, rAthena, Hercules itemInfo.lua format generation.
 
Testing
 * Generated itemInfo.lua tested on client 20130807a.
 
Todo
 * Create Visual Studio project for compilation on Windows.
 * Create Autotools for compilation on Unix and Linux.
 * Write guides on how to use the stupid program.
 
You can get the latest item description translation over on my project page on GitHub.
 
I've added both the idnum2itemdesctable.txt and itemInfo.lua formats for eAthena, rAthena, and Hercules, including pre-renewal and renewal.
 
Edited by trickyloki3

Share this post


Link to post
Share on other sites
Hey everyone, the project has reached a point where it can compile a subset of the scripting language.
 
I've attach with the this post a sample of a translation of an rAthena item_db.txt to idnum2itemdesctable.txt. (Support for Hercules coming soon or if some program exist to convert Hercules' databases to rAthena databases.)
 
Warning: (for-loop is not implemented so comment out that one item; official database may contain about ~5 errors) and (pow() handling produces awkward results) and some integer-post processing may be off by one digit.
 
For example, 
Item ID: 13110 
Item Name: Glorious Pistol
Item Script:
bonus2 bAddRace,RC_DemiHuman,55; bonus2 bAddRace,RC_Player,55; bonus2 bIgnoreDefRaceRate,RC_DemiHuman,20; bonus2 bIgnoreDefRaceRate,RC_Player,20; bonus bUnbreakableWeapon,0;if(getrefine()>5) {	 bonus2 bAddRace,RC_DemiHuman,pow(((getrefine()>14)?14:getrefine())-4,2);	 bonus2 bAddRace,RC_Player,pow(((getrefine()>14)?14:getrefine())-4,2);	 bonus2 bIgnoreDefRaceRate,RC_DemiHuman,5;	 bonus2 bIgnoreDefRaceRate,RC_Player,5; } if(getrefine()>8) {	 bonus4 bAutoSpellOnSkill,"GS_RAPIDSHOWER","GS_GLITTERING",1,1000;	 bonus2 bSkillAtk,"GS_RAPIDSHOWER",getrefine()*2;}
 
Item Translation:
Add +55% physical damage against demi-human monsters.Add +55% physical damage against mvp monsters.Pierce +20% physical defense for demi-human monsters.Pierce +20% physical defense for mvp monsters.Weapon is indestructible.Condition [Refine Rate 6 ~ 15] -> Add -121% ~ +121% physical damage against demi-human monsters. -> Add -121% ~ +121% physical damage against mvp monsters. -> Pierce +5% physical defense for demi-human monsters. -> Pierce +5% physical defense for mvp monsters.Condition [Refine Rate 9 ~ 15] -> Add 100% chance of auto-casting Rapid Shower[Lv.1] when using Flip the Coin. -> Increase +18% ~ +30% Rapid Shower damage.

idnum2itemdesctable.txt

Edited by trickyloki3

Share this post


Link to post
Share on other sites

looks pretty good. I did notice just a few things:

1) Rc_Player is just regular players right? why mvp monsters?

2) Is there a need to calculate the Refine rate * percentage value?. I would suggest to show it as "Increase Rapid Shower Damage by 2% of refine rate"

Share this post


Link to post
Share on other sites

Yeah, I still need to proof-read the mapping between the constants and its user-friendly string and figure out a way to make the actual (calculated) expression look nice.

 

The two solutions I can think of is 1) listing all the variables (readparam(bStr, bAgi, ...), getrefine, etc) 2) write the formula (store internally).

(The reason why I calculate it down to minimum and maximum is because some expressions don't translate simply or cleanly.)

Edited by trickyloki3

Share this post


Link to post
Share on other sites

Currently working on make this project accessible to everyone.

 

Since Hercules uses a modified grammar for libconfig to support <" "> multiline scripts, I can't maintain my current license if I package the modified libconfig library or code with my project.

 

My new plan of action is to write database converters for eAthena, rAthena, and Hercules and dump everything into a sqlite3 database file that comes bundle with the project.

 

This means that if you want the project to work with your custom databases, then you need to run the database converters for your emulator.

This is more difficult with Hercules because you need to build and link the modified libconfig library under 3rdparty/libconfig. (As the standard libconfig-devel does not support <" ">)

 

More soon.

Share this post


Link to post
Share on other sites

Currently working on make this project accessible to everyone.

 

Since Hercules uses a modified grammar for libconfig to support <" "> multiline scripts, I can't maintain my current license if I package the modified libconfig library or code with my project.

 

My new plan of action is to write database converters for eAthena, rAthena, and Hercules and dump everything into a sqlite3 database file that comes bundle with the project.

 

This means that if you want the project to work with your custom databases, then you need to run the database converters for your emulator.

This is more difficult with Hercules because you need to build and link the modified libconfig library under 3rdparty/libconfig. (As the standard libconfig-devel does not support <" ">)

 

More soon.

I have made conf2txt for itemdb in lua, and the trick I do is convert libconfig format to lua and make the lua read that format(thus i don't use any libconfig)

Share this post


Link to post
Share on other sites

Update.

 

New project repository: https://github.com/trickyloki3/eAdb.Compiler3

 

The project is almost finished.

 

Currently supports eAthena, rAthena, and Hercules databases.

 

Still need to fixed some bugs with porting.

 

Goal: Server Item Database -> Item Script -> [eAdb.Compiler] -> Item Script Description-> Client Tables

 

Dumps all databases into a sqlite3 database (~3MB)

./conv [eathena, rathena, hercules, all]

 

Dumps Hercules databases into sqlite3 database (~1MB)

[separate compilation 'make hitem' requires compiling and linking Hercules' Libconfig (See 3rdparty/libconfig in Hercules' git repository)]

./hitem

 

Uses athena.db database to generate English translation for item database

./item [eathena, rathena, hercules]

Edited by trickyloki3

Share this post


Link to post
Share on other sites

Hey guys,

 

I'm working hard to solve a crucial feature with expressing the formula for expressions that includes variables and functions. In addition, I'll be fixing certain semantics and improving the usage of the program, i.e. simple enough that anyone who can setup a local server can use. I'll also be reporting possible item database errors that I found; whoever decided to change the status constant defines failed to do the same in the item database.

 

The challenge is to format expressions that are script as follows:

 

getrefine() > 14) ? 14 : getrefine()

 

 or 

 

50 + 6000 * (readparam(bStr) > 90)

 

 

The current solution is this:

 

if (Refine Rate is greater than 14) then 14 else 0~14

 

 and 

 

50 + 6000 * (STR is greater than 90)

 

 

Right now, at the time of writing this post, I want something like this: (This makes more sense when the solution is substituted into the translations ^_^ )

 

0~14 based on Refine Rate

 

 and

 

50 + 6000 * (0~1) base on STR

 

An exact and verbose solution requires branching each conditional operator ? to produce a tree of possible values to be substituted, i.e. 2 ^ (# of ? operators).

Edited by trickyloki3

Share this post


Link to post
Share on other sites

Seperate it to 2 statements??

[bonus Str below 91] Str increase by 50

[bonus Str above 90] Str increase by 6000*bonusStr

 

What happens if there's variable like @mycustomvar

Share this post


Link to post
Share on other sites

I figure that a simple heuristic like 

(getrefine() > 14) ? 14 : getrefine()
0~14 based on Refine Rate

Would simplify the solution pretty elegantly in both implementation and complexity. And set expressions are 'inherited' when the identifier is matched.


EXAMPLE
Item ID: 13110
Reference: http://ratemyserver.net/index.php?iname=13110&page=item_db&quick=1&isearch=Search

 

Translation

13110#Increase +55% physical damage on demi-human enemy.Increase +55% physical damage on player enemy.Ignore +20% physical defense of demi-human enemy.Ignore +20% physical defense of player enemy.Weapon is indestructible.Condition [Refine Rate 6 ~ 15] -> Increase +4% ~ +100% (((6 ~ 14 based on Refine Level) - 4)^2) physical damage on demi-human enemy. -> Increase +4% ~ +100% (((6 ~ 14 based on Refine Level) - 4)^2) physical damage on player enemy. -> Ignore +5% physical defense of demi-human enemy. -> Ignore +5% physical defense of player enemy.Condition [Refine Rate 9 ~ 15] -> Add +100% chance of auto-casting Flip the Coin[Lv.1] when using Rapid Shower. -> Increase +18% ~ +30% (Refine Level * 2) Rapid Shower damage.#

Block Dump

--- 13110 ---Block Address: 0xbb3b70Block ID: 0Block Link: -1Block Type: bonus2Block Argument Count: 3Block Argument 0: bAddRaceBlock Argument 1: RC_DemiHumanBlock Argument 2: 55Block Translation Count: 4Block Translation 0: demi-humanBlock Translation 1: 55Block Translation 2: Increase +55%Block Translation 3: Increase +55% physical damage on demi-human enemy.Block Formula Count: 0Block Dependence: N/A --- 13110 ---Block Address: 0xbe5cc8Block ID: 1Block Link: -1Block Type: bonus2Block Argument Count: 3Block Argument 0: bAddRaceBlock Argument 1: RC_PlayerBlock Argument 2: 55Block Translation Count: 4Block Translation 0: playerBlock Translation 1: 55Block Translation 2: Increase +55%Block Translation 3: Increase +55% physical damage on player enemy.Block Formula Count: 0Block Dependence: N/A --- 13110 ---Block Address: 0xc17e20Block ID: 2Block Link: -1Block Type: bonus2Block Argument Count: 3Block Argument 0: bIgnoreDefRaceRateBlock Argument 1: RC_DemiHumanBlock Argument 2: 20Block Translation Count: 4Block Translation 0: demi-humanBlock Translation 1: 20Block Translation 2: +20%Block Translation 3: Ignore +20% physical defense of demi-human enemy.Block Formula Count: 0Block Dependence: N/A --- 13110 ---Block Address: 0xc49f78Block ID: 3Block Link: -1Block Type: bonus2Block Argument Count: 3Block Argument 0: bIgnoreDefRaceRateBlock Argument 1: RC_PlayerBlock Argument 2: 20Block Translation Count: 4Block Translation 0: playerBlock Translation 1: 20Block Translation 2: +20%Block Translation 3: Ignore +20% physical defense of player enemy.Block Formula Count: 0Block Dependence: N/A --- 13110 ---Block Address: 0xc7c0d0Block ID: 4Block Link: -1Block Type: bonusBlock Argument Count: 2Block Argument 0: bUnbreakableWeaponBlock Argument 1: 0Block Translation Count: 2Block Translation 0: (null)Block Translation 1: Weapon is indestructible.Block Formula Count: 0Block Dependence: N/A --- 13110 ---Block Address: 0xcae228Block ID: 5Block Link: -1Block Type: ifBlock Argument Count: 2Block Argument 0: ( getrefine ( ) > 5 )Block Argument 1: { bonus2 bAddRace , RC_DemiHuman , pow ( ( ( getrefine ( ) > 14 ) ? 14 : getrefine ( ) ) - 4 , 2 ) ; bonus2 bAddRace , RC_Player , pow ( ( ( getrefine ( ) > 14 ) ? 14 : getrefine ( ) ) - 4 , 2 ) ; bonus2 bIgnoreDefRaceRate , RC_DemiHuman , 5 ; bonus2 bIgnoreDefRaceRate , RC_Player , 5 ; }Block Translation Count: 1Block Translation 0: 6 ~ 15Block Formula Count: 0Block Dependence: N/ABlock Logic Tree:logic tree on stack(nil)<-0x1408e70:COND:getrefine;dmprange; cond  (6 ~ 15)  --- 13110 ---Block Address: 0xce0380Block ID: 6Block Link: 5Block Type: bonus2Block Argument Count: 3Block Argument 0: bAddRaceBlock Argument 1: RC_DemiHumanBlock Argument 2: pow ( ( ( getrefine ( ) > 14 ) ? 14 : getrefine ( ) ) - 4 , 2 )Block Translation Count: 4Block Translation 0: demi-humanBlock Translation 1: 4 ~ 100Block Translation 2: Increase +4% ~ +100% (((6 ~ 14 based on Refine Level) - 4)^2)Block Translation 3: Increase +4% ~ +100% (((6 ~ 14 based on Refine Level) - 4)^2) physical damage on demi-human enemy.Block Formula Count: 1Block Formula 0: ((6 ~ 14 based on Refine Level) - 4)^2Block Dependence: N/ABlock Logic Tree:logic tree on stack(nil)<-0x1402590:COND:getrefine;dmprange; cond  (6 ~ 15)  --- 13110 ---Block Address: 0xd124d8Block ID: 7Block Link: 5Block Type: bonus2Block Argument Count: 3Block Argument 0: bAddRaceBlock Argument 1: RC_PlayerBlock Argument 2: pow ( ( ( getrefine ( ) > 14 ) ? 14 : getrefine ( ) ) - 4 , 2 )Block Translation Count: 4Block Translation 0: playerBlock Translation 1: 4 ~ 100Block Translation 2: Increase +4% ~ +100% (((6 ~ 14 based on Refine Level) - 4)^2)Block Translation 3: Increase +4% ~ +100% (((6 ~ 14 based on Refine Level) - 4)^2) physical damage on player enemy.Block Formula Count: 1Block Formula 0: ((6 ~ 14 based on Refine Level) - 4)^2Block Dependence: N/ABlock Logic Tree:logic tree on stack(nil)<-0x14049e0:COND:getrefine;dmprange; cond  (6 ~ 15)  --- 13110 ---Block Address: 0xd44630Block ID: 8Block Link: 5Block Type: bonus2Block Argument Count: 3Block Argument 0: bIgnoreDefRaceRateBlock Argument 1: RC_DemiHumanBlock Argument 2: 5Block Translation Count: 4Block Translation 0: demi-humanBlock Translation 1: 5Block Translation 2: +5%Block Translation 3: Ignore +5% physical defense of demi-human enemy.Block Formula Count: 0Block Dependence: N/ABlock Logic Tree:logic tree on stack(nil)<-0x13ee570:COND:getrefine;dmprange; cond  (6 ~ 15)  --- 13110 ---Block Address: 0xd76788Block ID: 9Block Link: 5Block Type: bonus2Block Argument Count: 3Block Argument 0: bIgnoreDefRaceRateBlock Argument 1: RC_PlayerBlock Argument 2: 5Block Translation Count: 4Block Translation 0: playerBlock Translation 1: 5Block Translation 2: +5%Block Translation 3: Ignore +5% physical defense of player enemy.Block Formula Count: 0Block Dependence: N/ABlock Logic Tree:logic tree on stack(nil)<-0x13f09c0:COND:getrefine;dmprange; cond  (6 ~ 15)  --- 13110 ---Block Address: 0xda88e0Block ID: 10Block Link: -1Block Type: ifBlock Argument Count: 2Block Argument 0: ( getrefine ( ) > 8 )Block Argument 1: { bonus4 bAutoSpellOnSkill , GS_RAPIDSHOWER , GS_GLITTERING , 1 , 1000 ; bonus2 bSkillAtk , GS_RAPIDSHOWER , getrefine ( ) * 2 ; }Block Translation Count: 1Block Translation 0: 9 ~ 15Block Formula Count: 0Block Dependence: N/ABlock Logic Tree:logic tree on stack(nil)<-0x14152e0:COND:getrefine;dmprange; cond  (9 ~ 15)  --- 13110 ---Block Address: 0xddaa38Block ID: 11Block Link: 10Block Type: bonus4Block Argument Count: 5Block Argument 0: bAutoSpellOnSkillBlock Argument 1: GS_RAPIDSHOWERBlock Argument 2: GS_GLITTERINGBlock Argument 3: 1Block Argument 4: 1000Block Translation Count: 6Block Translation 0: Rapid ShowerBlock Translation 1: Flip the CoinBlock Translation 2: 1Block Translation 3: 100Block Translation 4: +100Block Translation 5: Add +100% chance of auto-casting Flip the Coin[Lv.1] when using Rapid Shower.Block Formula Count: 0Block Dependence: N/ABlock Logic Tree:logic tree on stack(nil)<-0x13f2e10:COND:getrefine;dmprange; cond  (9 ~ 15)  --- 13110 ---Block Address: 0xe0cb90Block ID: 12Block Link: 10Block Type: bonus2Block Argument Count: 3Block Argument 0: bSkillAtkBlock Argument 1: GS_RAPIDSHOWERBlock Argument 2: getrefine ( ) * 2Block Translation Count: 4Block Translation 0: Rapid ShowerBlock Translation 1: 18 ~ 30Block Translation 2: Increase +18% ~ +30% (Refine Level * 2)Block Translation 3: Increase +18% ~ +30% (Refine Level * 2) Rapid Shower damage.Block Formula Count: 1Block Formula 0: Refine Level * 2Block Dependence: N/ABlock Logic Tree:logic tree on stack(nil)<-0x13f5260:COND:getrefine;dmprange; cond  (9 ~ 15) 

 

Fixed some of the previous bugs and proof read the item_bonus.txt three times. <_<

 

Edit: I actually think this is cleaner:

-> Increase +4% ~ +100% (based on Refine Level) physical damage on demi-human enemy.
Edited by trickyloki3

Share this post


Link to post
Share on other sites

I've fixed a majority of the problems and so far so good.   ^_^ 

 

I'll focus on making this project easy to compile, build, and use on Windows, Mac, and Linux. 

 

Please let me know if you have any suggestions, corrections, or whatever about the project!


The attached files are sample item script translation for eAthena, rAthena, and Hercules. (The databases are ~1 month old since I last pulled.)
Note: the text files use UNIX-style line endings; view in Notepad++, Sublime, or anything that supports UNIX-style line endings.

 

*Uploaded new files to reflect fixes. [1:07AM Eastern Time]

eathena.txt

hercules.txt

rathena.txt

Edited by trickyloki3

Share this post


Link to post
Share on other sites

Can you make it to merge item description

Like

Cures poison status effect.Cures silence status effect.Cures blind status effect.Cures confusion status effect.Cures curse status effect.Cures hallucination status effect.
Will be "Cures poison,silence,blind,confusion,curse,hallucination status effect"

Share this post


Link to post
Share on other sites

Yeah, I'll make that a special case during script_generate.

 

If there exist a (sc_end) block, then attempt to merge all (sc_end).

 

Implemented [1:28AM Eastern Time] (https://github.com/trickyloki3/eAdb.Compiler3/commit/98dfdf7972d83823faf32a470fe9a240fc61972b)

 

Example:

591#Recover HP by 325 ~ 405. Recover SP by 40 ~ 60.Cures poison, silence, blind, confusion, curse, and hallucination status effects.#

This is probably the only block minimization, but I don't know.  ^_^

hercules_dastgir.txt

Edited by trickyloki3

Share this post


Link to post
Share on other sites

a few suggestions:

 

Trade: {                      (defaults to no restrictions)		override: GroupID             (int, defaults to 100)		nodrop: true/false            (boolean, defaults to false)		notrade: true/false           (boolean, defaults to false)		partneroverride: true/false   (boolean, defaults to false)		noselltonpc: true/false       (boolean, defaults to false)		nocart: true/false            (boolean, defaults to false)		nostorage: true/false         (boolean, defaults to false)		nogstorage: true/false        (boolean, defaults to false)		nomail: true/false            (boolean, defaults to false)		noauction: true/false         (boolean, defaults to false)	} 

1 - to tell the item restrictions (in red)

 

2 - Jobs that can use

3 - Loc: Equip location

4 - EquipLv: Equip required level (EquipLv: [min, max] too)

5 - Refine: if is refineable

6 - Atk and Def

7 - Item Weight

 

and what about instead of:

 

Gain 600000 ~ 1200000 (based on random 600000 ~ 1200000) 

 

just say this:

 

Gain between 600000 and 1200000 guild experience.

 

and there is a typo on "enemy"

 

Add +1% chance of casting Fire Bolt[Lv.3] on enemey and random skill level when receiving physical damage.
Add +1% chance of casting Cold Bolt[Lv.3] on enemey and random skill level when receiving physical damage.
Add +1% chance of casting Lightning Bolt[Lv.3] on enemey and random skill level when receiving physical damage.
 
 
 
great tool you got there :) I'll use it for sure in my custom items after you add the above suggested xD keep up the good work!

Share this post


Link to post
Share on other sites

@evilpuncker

Thanks for the suggestion, I still have one last thing to implement for the script translation before I generate client tables.

 

@zackdreaver

I'm currently using the following table:

https://github.com/trickyloki3/eAdb.Compiler3/blob/master/res/item_bonus.txt

But I can definitely create a separate table for that format.

Edited by trickyloki3

Share this post


Link to post
Share on other sites

Todo

 * Create Visual Studio project for compilation on Windows.
 * Create Autotools for compilation on Unix and Linux.
 * Write guides on how to use the stupid program.
Edited by trickyloki3

Share this post


Link to post
Share on other sites

@@trickyloki3

nice to see that you are still working on it! don't forget to contact me when you introduce a localization system so I can translate it to pt-br

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.