RMS Home | Guide Writing | Test Server | New Servers | Latest Reviews

Author Topic: ItemDB Script Translation Project  (Read 7900 times)

0 Members and 1 Guest are viewing this topic.

Offline Bue

ItemDB Script Translation Project
« on: Jul 25, 2013, 01:46 PM »
C - MIT licensed - github - rathena - hercule

Under construction 03/06/2016.

I will update this when I get off work tomorrow. q.q
« Last Edit: Mar 07, 2016, 12:57 AM by Bue »

Advertisement

Offline Bue

Re: ItemDB Translation Project
« Reply #1 on: Jul 25, 2013, 01:56 PM »
Under construction 03/06/2016.

Placeholder for additional junk.
« Last Edit: Mar 07, 2016, 12:56 AM by Bue »

Offline Bue

Re: ItemDB Translation Project
« Reply #2 on: Jul 26, 2013, 06:35 AM »
Please delete this post.
« Last Edit: Mar 07, 2016, 12:51 AM by Bue »

Offline yC

Re: ItemDB Translation Project
« Reply #3 on: Jul 26, 2013, 11:42 AM »
Didn't you have a similar topic earlier?  where did it went?

Offline themon

Re: ItemDB Script Translation Project
« Reply #4 on: Jan 19, 2014, 10:29 AM »

Offline Triper

Re: ItemDB Script Translation Project
« Reply #5 on: Sep 09, 2014, 12:07 AM »
Where do I click Like? :(

Offline Bue

Re: ItemDB Script Translation Project
« Reply #6 on: Nov 03, 2014, 12:02 AM »
Hey everyone, the compiler is ready to translate item scripts to item description, i.e. script generation with conditional and calculational dependency completed!

Warning: (for-loop is not implemented so comment out that one item; official database may contain about ~5 errors) and other mistakes.
Note: RMS does not allow me to upload pass 300kb, the current idnum2itemdesctable.txt with script translation only is >600kb). I've included a sample attach with this post around 200kb.

For example,
Item ID: 13110
Item Name: Glorious Pistol
Item Script:
Code: [Select]
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:
Code: [Select]
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.

« Last Edit: Nov 03, 2014, 12:20 AM by Bue »

Offline Playtester

Re: ItemDB Script Translation Project
« Reply #7 on: Nov 03, 2014, 05:18 AM »
Apart from the fact that the script on Glorious Pistol is wrong in the first place (should be "?10:getrefine()-4"), the converter gets a weird number number as result.

-121% ~ 121%?

1. pow(x,2) can only give a positive result.
2. 121% would be 11^2.

Shouldn't it say 1% ~ 100%?

Also, there's no bonus from +14 to +15, but I guess that's quite hard to automatically figure out.

Offline Bue

Re: ItemDB Script Translation Project
« Reply #8 on: Nov 03, 2014, 06:23 PM »
The compiler is smart enough interpret the condition and figure out that +15~+15 does not apply, but it get fairly complicate with the ? operator.

Manually going through the algorithm for expression: (getrefine()>14)?14:getrefine()
1. Compiler figures out that getrefine can be 0~15.
2. Compiler resolve the getrefine to 6~15 because of IF condition. (if(getrefine()>5)) [Editted]
2. Compiler sees operator > and builds the logic tree for getrefine (15~15) and computes the inverse logic tree (6~14).
3. When interpreting the left of the operator :, the compiler uses the getrefine(15~15) logic tree.
4. When interpreting the right of the operator :, the compiler uses the getrefine(6~14) logic tree.
-- PROBLEM: The expression is suppose to branch out to TWO solutions like an if-else, but I combine both solutions. Because ?: is embedded into a expression, you can't readily branch the expression and compute two more final results, because it can grow exponentially, 2^(# of ? operators used). So I merge both solutions and produce the a estimated result. --

I'll fix later. The problem has to do with how subexpressions are handle, how logic trees are compute and inherited, how pow function handles the min and max of the computer result, and how ? operator as describe above is a problem.

The WORSE example I have (somewhere) includes a SET variable in that mess, which keep a logic tree of its own if dependency are presence.

Fix it; conditions must limit the domain and inversion on that domain and range produce the right result.
Code: [Select]
     Node: 0x1dea500
     Type: Subexpression getrefine > 14; 15:15
  Minimum: 15
  Maximum: 15
  Arg_Cnt: 0
  Arg_Ptr: 0
  Maximum: 15
   Parent: 0x1dec970
     Left: (nil)
    Right: (nil)
     Next: 0x1dec970
     Prev: 0x1de8090
     Expr: getrefine > 14
dmprange; node_dmp (15 ~ 15)
(nil)<-0x1df5f60:COND:getrefine;dmprange; cond  (15 ~ 15)
  --
(nil)<-0x1df73b0:COND:getrefine;dmprange; cond  (6 ~ 14)
(nil)<-0x1df5f60:COND:getrefine;dmprange; cond  (15 ~ 15)
     Node: 0x1deede0
     Type: Literal 14:14
  Minimum: 14
  Maximum: 14
  Arg_Cnt: 0
  Arg_Ptr: 0
  Maximum: 14
   Parent: 0x1df1250
     Left: (nil)
    Right: (nil)
     Next: 0x1df1250
     Prev: 0x1dec970
     Expr: 14
dmprange; node_dmp (14 ~ 14)
  --
     Node: 0x1df36c0
     Type: Function getrefine; 6:14
  Minimum: 6
  Maximum: 14
  Arg_Cnt: 0
  Arg_Ptr: 0
  Maximum: 14
   Parent: 0x1df1250
     Left: (nil)
    Right: (nil)
     Next: 0x1de8090
     Prev: 0x1df1250
     Expr: getrefine
dmprange; node_dmp (6 ~ 14)
(nil)<-0x1df8800:COND:getrefine;dmprange; cond  (6 ~ 14)
  --
     Node: 0x1df1250
     Type: Operator :
  Minimum: 6
  Maximum: 14
  Arg_Cnt: 0
  Arg_Ptr: 0
  Maximum: 14
   Parent: 0x1dec970
     Left: 0x1deede0
    Right: 0x1df36c0
     Next: 0x1de8090
     Prev: 0x1dec970
     Expr: 14 : getrefine
dmprange; node_dmp (6 ~ 14)
  --
     Node: 0x1dec970
     Type: Operator ?
  Minimum: 6
  Maximum: 14
  Arg_Cnt: 0
  Arg_Ptr: 0
  Maximum: 14
   Parent: (nil)
     Left: 0x1dea500
    Right: 0x1df1250
     Next: 0x1de8090
     Prev: 0x1de8090
     Expr: getrefine > 14 ? 14 : getrefine
dmprange; node_dmp (6 ~ 14)
  --
     Node: 0x1de8090
     Type: Subexpression getrefine > 14 ? 14 : getrefine; 6:14
  Minimum: 6
  Maximum: 14
  Arg_Cnt: 0
  Arg_Ptr: 0
  Maximum: 14
   Parent: 0x1dea500
     Left: (nil)
    Right: (nil)
     Next: 0x1dea500
     Prev: 0x1de5c20
     Expr: getrefine > 14 ? 14 : getrefine
dmprange; node_dmp (6 ~ 14)
  --
     Node: 0x1dec970
     Type: Literal 4:4
  Minimum: 4
  Maximum: 4
  Arg_Cnt: 0
  Arg_Ptr: 0
  Maximum: 4
   Parent: 0x1dea500
     Left: (nil)
    Right: (nil)
     Next: 0x1de5c20
     Prev: 0x1dea500
     Expr: 4
dmprange; node_dmp (4 ~ 4)
  --
     Node: 0x1dea500
     Type: Operator -
  Minimum: 2
  Maximum: 10
  Arg_Cnt: 0
  Arg_Ptr: 0
  Maximum: 10
   Parent: (nil)
     Left: 0x1de8090
    Right: 0x1dec970
     Next: 0x1de5c20
     Prev: 0x1de5c20
     Expr: getrefine > 14 ? 14 : getrefine - 4
dmprange; node_dmp (2 ~ 10)
  --
     Node: 0x1dea500
     Type: Literal 2:2
  Minimum: 2
  Maximum: 2
  Arg_Cnt: 0
  Arg_Ptr: 0
  Maximum: 2
   Parent: (nil)
     Left: (nil)
    Right: (nil)
     Next: 0x1de8090
     Prev: 0x1de8090
     Expr: 2
dmprange; node_dmp (2 ~ 2)
  --
     Node: 0x1de1930
     Type: Function pow; 4:100
  Minimum: 4
  Maximum: 100
  Arg_Cnt: 0
  Arg_Ptr: 0
  Maximum: 100
   Parent: (nil)
     Left: (nil)
    Right: (nil)
     Next: 0x1ddf4c0
     Prev: 0x1ddf4c0
     Expr: pow
dmprange; node_dmp (4 ~ 100)
(nil)<-0x1de5c20:COND:pow;dmprange; cond  (4 ~ 100)

Code: [Select]
13110:Glorious Pistol
Add +55% physical damage against demi-human monsters.
Add +55% physical damage against player monsters.
Pierce +20% physical defense for demi-human monsters.
Pierce +20% physical defense for player monsters.
Weapon is indestructible.
Condition [Refine Rate 6 ~ 15]
 -> Add +4% ~ +100% physical damage against demi-human monsters.
 -> Add +4% ~ +100% physical damage against player monsters.
 -> Pierce +5% physical defense for demi-human monsters.
 -> Pierce +5% physical defense for player 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.
« Last Edit: Nov 04, 2014, 12:35 AM by Bue »

Offline Bue

Re: ItemDB Script Translation Project
« Reply #9 on: Jan 19, 2015, 11:49 PM »
Please delete this post.
« Last Edit: Mar 07, 2016, 12:50 AM by Bue »

Offline Bue

Re: ItemDB Script Translation Project
« Reply #10 on: Mar 07, 2016, 12:37 AM »
Updated result.txt and result2.txt. 03/07/2016

Hiya e1 :D

I came to share the fruits of my labor.

Attach below are item scripts translated into item descriptions.

From rathena's item database on revision 1abb02c to be exact.

There are still a few things left to do.

See https://github.com/trickyloki3/eadb.compiler if you're interested.

Everything is open source and available for compilation on OS X, Linux, and Windows. (Uses ANSI C libraries and libc.)

Here are some samples:

Sword Guardian Card (getiteminfo predicate generation)
Code: [Select]
getiteminfo(getequipid(EQI_HAND_R),11)==2 ||
getiteminfo(getequipid(EQI_HAND_R),11)==3
Code: [Select]
[4427]
[Right Hand's Weapon Type is One-handed Sword, Two-handed Sword]
HIT +5
CRIT +5
+25% Bowling Bash damage.

Glorious Spear (multi-level if-else generation w/ set blocks) * fixed
Code: [Select]
[1426]
+95% physical damage against demi-human enemies
+95% physical damage against player enemies
pierce +20% physical defense of demi-human enemies
pierce +20% physical defense of player enemies
weapon is indestructible
[Refine Level 6 ~ 15]
+16% ~ +121% physical damage against demi-human enemies
+16% ~ +121% physical damage against player enemies
pierce +5% physical defense of demi-human enemies
pierce +5% physical defense of player enemies
ASPD +10%
[Refine Level 9 ~ 15]
[Knight]
+20% chance of casting level 2 Critical Wounds when using Pierce
[Crusader]
+10% chance of casting level 5 Gloria Domini when attacking

Glorious Pistol (bonus generation) * fixed
Code: (auto:0) [Select]
[13110]
+55% physical damage against demi-human enemies
+55% physical damage against player enemies
pierce +20% physical defense of demi-human enemies
pierce +20% physical defense of player enemies
weapon is indestructible
[Refine Level 6 ~ 15]
+16% ~ +121% physical damage against demi-human enemies
+16% ~ +121% physical damage against player enemies
pierce +5% physical defense of demi-human enemies
pierce +5% physical defense of player enemies
[Refine Level 9 ~ 15]
+100% chance of casting level 1 Flip the Coin when using Rapid Shower
+0% ~ +30% (Refine Level) Rapid Shower damage.

Vanberk Card (autobonus generation)
Code: [Select]
[4411]
STR +2
Add 0.50% chance to activate on meelee and range phyiscal attacks for 5 seconds.
CRIT +100

Enhanced Soldier Skeleton Card (predicate generation)
Code: [Select]
[4634]
[Base Level 1 ~ 99]
CRIT +9
[Base Level 100 ~ 175]
CRIT +10
+5% critical damage
Code: [Select]
[15061]
All Status +1
[Mage, Archer, Acolyte]
+50% silence status resistance
[Swordsman, Merchant, Thief]
+50% stun status resistance

Blue Box (item group generation)
Code: [Select]
[603]
Select 1 item from Blue Box group.
 * 52 healing items
 * 44 usable items
 * 423 etc items
 * 210 armor items
 * 239 weapon items
 * 20 pet equipment items
 * 28 ammo items
 * 6 delay usable items
« Last Edit: Mar 09, 2016, 11:25 PM by Bue »