Jump to content
latios

Tool: dp2rathena - convert divine-pride data to rathena format

Recommended Posts

Hi all, I put together a command-line tool to help save time when porting lots of existing items to an rAthena server.
I noticed that the rAthena community often refers to divine-pride.net (DP) as a source of truth, so I figured it would be useful to connect with their API.

Summary
The tool uses data from divine-pride.net and attempts to map the API response to a desired rAthena database format.

Installation
Requires Python 3.6+ and pip installed: 

pip install dp2rathena

Usage
Generate a divine-pride.net API key if you don't have one yet (registration required), then you can start converting data:
Example 1: Store API key and convert items with id 501 and 1101

dp2rathena config
dp2rathena item 501 1101

Produces this output:

Spoiler
Header:
  Type: ITEM_DB
  Version: 1
Body:
- Id: 501
  AegisName: Red_Potion
  Name: Red Potion
  Type: Healing
  Buy: 10
  Weight: 70
- Id: 1101
  AegisName: Sword
  Name: Sword
  Type: Weapon
  SubType: 1hSword
  Buy: 100
  Weight: 500
  Attack: 25
  Range: 1
  Slots: 3
  Jobs:
    Alchemist: true
    Assassin: true
    Blacksmith: true
    Crusader: true
    Knight: true
    Merchant: true
    Novice: true
    Rogue: true
    SuperNovice: true
    Swordman: true
    Thief: true
  Locations:
    Right_Hand: true
  WeaponLevel: 1
  EquipLevelMin: 2
  Refineable: true
  View: 2

 

 

Example 2: Re-use stored API key, convert mobskills for mobs with id 1002, 1049 and 1299 and save to a file called "attacks.txt"

dp2rathena mobskill 1002 1049 1299 > C:\Users\Latios\Desktop\attacks.txt

Produces a file in the Desktop folder called "attacks.txt":

Spoiler
1002,[email protected]_EMOTION,loot,197,1,2000,0,5000,yes,self,always,,2,,,,,,
1002,[email protected]_WATERATTACK,attack,184,1,2000,0,5000,yes,target,always,,,,,,,,
1049,[email protected]_EMOTION,walk,197,1,2000,0,5000,yes,self,always,,2,,,,,,
1049,[email protected]_FIREATTACK,attack,186,1,2000,0,5000,yes,target,always,,,,,,,,
1299,Goblin [email protected]_TELEPORT,idle,26,1,10000,0,0,yes,self,rudeattacked,,,,,,,,
1299,Goblin [email protected]_MAXIMIZE,attack,114,5,500,1000,5000,no,self,always,,,,,,,27,
1299,Goblin [email protected]_MAXIMIZE,chase,114,5,500,1000,5000,no,self,always,,,,,,,27,
1299,Goblin [email protected]_SHIELDCHARGE,attack,250,3,500,0,5000,no,target,always,,,,,,,27,
1299,Goblin [email protected]_SUMMONSLAVE,attack,196,5,10000,2000,60000,no,self,slavele,2,1122,1123,1124,1125,1126,27,
1299,Goblin [email protected]_SUMMONSLAVE,idle,196,5,10000,2000,60000,no,self,slavele,2,1122,1123,1124,1125,1126,27,

 

Further instructions can be found at the repository: https://github.com/Latiosu/dp2rathena

Limitations
The following item_db.yml fields are partially mapped:

  • "Type" - when the item type is "Consumable" on DP and subtype "Special", we output a few possible options for user to choose the correct one (Healing, Usable, DelayConsume or Cash)
  • "SubType" - when the item type is "Ammo" on DP, we output all rathena ammo subtypes for user to choose correct option as DP doesn't map all rathena ammo subtypes

The following item_db.yml fields are excluded as DP API doesn't expose sufficient data to reverse-engineer the mapping:

  • "Script" / "EquipScript" / "UnEquipScript" - script to execute when some action is performed with the item
  • "Class" - upper class types that can equip item
  • "Flags" - item flags such as "BuyingStore", "DeadBranch", "BindOnEquip", etc...
  • "Delay" - item use delay
  • "Stack" - item stack amount
  • "NoUse" - conditions when the item is unusable
  • "View" - view sprite of the item
  • "AliasName" - another item's AegisName to be sent to client instead of this AegisName

Let me know if you'd like to be able to convert other data from DP, some other suggestion or any questions. 

Edit: Updated instructions for usage

Edited by latios
Can now convert mob skills
  • Upvote 3
  • Like 2
Link to comment
Share on other sites

hi 

i wanna know more can you make a step by step instruction for this one for me to pull data 

 

finally able to run the command.

for having issues

go to your terminal then type python if you have python already installed it will run it automatically, if not it will go to microsoft store then install it, 

like me im having an issue once im doing the installation.

do this  1st  https://datatofish.com/add-python-to-windows-path/

once done try to install the file again, or just type pip install dp2rathena

you can also check if its properly installed by typing dp2rathena version

if that gives you the version of the file, then its done

  • Upvote 1
Link to comment
Share on other sites

I've just released version 0.3.0 which allows for converting mob skills and creating a mob_skill_db.txt file.

To update your dp2rathena to the latest version, you'll need to run:

pip install -U dp2rathena

Instructions for how to use the new feature are listed at the top of this thread and within the tool help text. For example running the help command:

dp2rathena mobskill --help

Will produce this help text:

Spoiler
Usage: dp2rathena mobskill [OPTIONS] [VALUE]...

  Converts mob ids to rathena mob_skill_db.txt.

  Examples:
      # Pass API key and convert mob ids 1002 and 1049
      dp2rathena --api-key <your-api-key> mobskill 1002 1049

      # Pass API key and convert mobs via STDIN
      dp2rathena -k <your-api-key> mobskill -f -

      # Save API key and convert mob ids in ids_to_convert.txt
      dp2rathena config
      dp2rathena mobskill -f ids_to_convert.txt

Options:
  -f, --file  A file with mob ids to convert, newline separated.
  --debug     Shows debug information when querying Divine-Pride.
  -h, --help  Show this message and exit.

 

Let me know if you come across any issues or have any requests/suggestions.

I'll do my best to reply promptly /ok

Link to comment
Share on other sites

On 9/13/2021 at 8:46 AM, Snaehild said:

This is an awesome tool. Do you have an ETA for the mob_db.txt support? 

Hi there Snaehild!

I'm so glad you like it! I hope to release support for mob_db.txt by the end of this month 🙏

  • Love 1
Link to comment
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.   Paste as plain text instead

  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.



×
×
  • Create New...

Important Information

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