latios Posted January 7, 2021 Group: Members Topic Count: 3 Topics Per Day: 0.00 Content Count: 25 Reputation: 17 Joined: 12/12/15 Last Seen: June 18, 2022 Share Posted January 7, 2021 (edited) Hi all, I put together a command-line tool to help save time when porting lots of existing items to an rAthena server: https://github.com/Latiosu/dp2rathena 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: Convert mobskills for mobs with id 1002, 1049 and 1299 and save to a file called "attacks.txt" (re-uses stored API key if present) dp2rathena mobskill 1002 1049 1299 > C:\Users\Latios\Desktop\attacks.txt Produces a file in the Desktop folder called "attacks.txt": Spoiler 1002,Poring@NPC_EMOTION,loot,197,1,2000,0,5000,yes,self,always,,2,,,,,, 1002,Poring@NPC_WATERATTACK,attack,184,1,2000,0,5000,yes,target,always,,,,,,,, 1049,Picky@NPC_EMOTION,walk,197,1,2000,0,5000,yes,self,always,,2,,,,,, 1049,Picky@NPC_FIREATTACK,attack,186,1,2000,0,5000,yes,target,always,,,,,,,, 1299,Goblin Leader@AL_TELEPORT,idle,26,1,10000,0,0,yes,self,rudeattacked,,,,,,,, 1299,Goblin Leader@BS_MAXIMIZE,attack,114,5,500,1000,5000,no,self,always,,,,,,,27, 1299,Goblin Leader@BS_MAXIMIZE,chase,114,5,500,1000,5000,no,self,always,,,,,,,27, 1299,Goblin Leader@CR_SHIELDCHARGE,attack,250,3,500,0,5000,no,target,always,,,,,,,27, 1299,Goblin Leader@NPC_SUMMONSLAVE,attack,196,5,10000,2000,60000,no,self,slavele,2,1122,1123,1124,1125,1126,27, 1299,Goblin Leader@NPC_SUMMONSLAVE,idle,196,5,10000,2000,60000,no,self,slavele,2,1122,1123,1124,1125,1126,27, Example 3: Convert mob with id 20357 to mob_db.yml format dp2rathena mob 20357 Produces following command-line output: Spoiler Header: Type: MOB_DB Version: 2 Body: - Id: 20357 AegisName: EP17_1_SANARE1 Name: Heart Hunter Sanare Level: 120 Hp: 30159 BaseExp: 6702 JobExp: 5362 Attack: 765 Attack2: 504 Defense: 200 MagicDefense: 27 Str: 51 Agi: 51 Vit: 70 Int: 63 Dex: 117 Luk: 77 AttackRange: 1 SkillRange: 10 ChaseRange: 12 Size: Medium Race: Demihuman Element: Neutral ElementLevel: 2 WalkSpeed: 200 AttackDelay: 531 AttackMotion: 1268 DamageMotion: 480 Ai: Unknown Drops: - Item: Crude_Ammo Rate: 1000 - Item: Heart_Hunter_Seal Rate: 1250 - Item: Oridecon_Stone Rate: 150 - Item: Oridecon Rate: 12 - Item: EP17_1_EVT02 Rate: 10 - Item: Explosive_Powder Rate: 30 - Item: Sanare_Card Rate: 1 StealProtected: true Further instructions can be found at the repository: https://github.com/Latiosu/dp2rathena Limitations I've moved this section to the GitHub repository above to keep it up-to-date. --- Let me know if you'd like to be able to convert other data from DP, some other suggestion or any questions. Edit: Add terminal animation for a visual explanation Edited October 11, 2021 by latios Can now generate mob_db.yml entries 5 2 2 Quote Link to comment Share on other sites More sharing options...
iSnowFlakes Posted January 27, 2021 Group: Members Topic Count: 11 Topics Per Day: 0.01 Content Count: 35 Reputation: 1 Joined: 10/22/20 Last Seen: November 11, 2023 Share Posted January 27, 2021 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 1 Quote Link to comment Share on other sites More sharing options...
botka4aet Posted January 27, 2021 Group: Members Topic Count: 5 Topics Per Day: 0.00 Content Count: 211 Reputation: 17 Joined: 12/23/11 Last Seen: June 11, 2024 Share Posted January 27, 2021 Create txt file with item id list - ids_to_convert.txt Execute dp2rathena item -f ids_to_convert.txt Quote Link to comment Share on other sites More sharing options...
latios Posted February 7, 2021 Group: Members Topic Count: 3 Topics Per Day: 0.00 Content Count: 25 Reputation: 17 Joined: 12/12/15 Last Seen: June 18, 2022 Author Share Posted February 7, 2021 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 Quote Link to comment Share on other sites More sharing options...
Snaehild Posted September 12, 2021 Group: Members Topic Count: 16 Topics Per Day: 0.00 Content Count: 72 Reputation: 7 Joined: 06/23/14 Last Seen: November 13, 2022 Share Posted September 12, 2021 This is an awesome tool. Do you have an ETA for the mob_db.txt support? 1 Quote Link to comment Share on other sites More sharing options...
latios Posted September 16, 2021 Group: Members Topic Count: 3 Topics Per Day: 0.00 Content Count: 25 Reputation: 17 Joined: 12/12/15 Last Seen: June 18, 2022 Author Share Posted September 16, 2021 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 1 Quote Link to comment Share on other sites More sharing options...
Snaehild Posted September 25, 2021 Group: Members Topic Count: 16 Topics Per Day: 0.00 Content Count: 72 Reputation: 7 Joined: 06/23/14 Last Seen: November 13, 2022 Share Posted September 25, 2021 On 9/16/2021 at 7:58 AM, latios said: 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 Lovely. I will be waiting. Quote Link to comment Share on other sites More sharing options...
latios Posted October 4, 2021 Group: Members Topic Count: 3 Topics Per Day: 0.00 Content Count: 25 Reputation: 17 Joined: 12/12/15 Last Seen: June 18, 2022 Author Share Posted October 4, 2021 On 9/26/2021 at 12:42 AM, Snaehild said: Lovely. I will be waiting. Hi @Snaehild, apologies I haven't quite finished getting mob_db.txt conversion feature yet, but have just released the mob_db.yml conversion feature in case that's still relevant to you. I've got mob_db.txt feature at the top of my list now. Quote Link to comment Share on other sites More sharing options...
Snaehild Posted October 4, 2021 Group: Members Topic Count: 16 Topics Per Day: 0.00 Content Count: 72 Reputation: 7 Joined: 06/23/14 Last Seen: November 13, 2022 Share Posted October 4, 2021 4 hours ago, latios said: Hi @Snaehild, apologies I haven't quite finished getting mob_db.txt conversion feature yet, but have just released the mob_db.yml conversion feature in case that's still relevant to you. I've got mob_db.txt feature at the top of my list now. Hey latios, thank you for letting me know. I actually need YML more. you're the best! 1 Quote Link to comment Share on other sites More sharing options...
kennykiro Posted October 5, 2021 Group: Members Topic Count: 17 Topics Per Day: 0.00 Content Count: 75 Reputation: 1 Joined: 05/22/15 Last Seen: April 17, 2024 Share Posted October 5, 2021 how do i use this program? wouldn't have a video to help? I installed everything right so I don't know how to use the program or the API. Quote Link to comment Share on other sites More sharing options...
latios Posted October 9, 2021 Group: Members Topic Count: 3 Topics Per Day: 0.00 Content Count: 25 Reputation: 17 Joined: 12/12/15 Last Seen: June 18, 2022 Author Share Posted October 9, 2021 On 10/6/2021 at 1:51 AM, kennykiro said: how do i use this program? wouldn't have a video to help? I installed everything right so I don't know how to use the program or the API. Hi there @kennykiro, it's unclear to me what kind of struggle you are having. Do you have an example of where you are stuck? Additionally, are you already familiar with using command-line (CLI) tools, if so, do you have an examples of CLI tools you like to use? I may be able to give better examples if I understand what you are familiar with. @kennykiro I've updated the GitHub repo with slightly clearer information and also a small terminal animation, which may or may not help you but hopefully it does Quote Link to comment Share on other sites More sharing options...
exyoupjkbrxd Posted October 12, 2021 Group: Members Topic Count: 2 Topics Per Day: 0.00 Content Count: 13 Reputation: 0 Joined: 10/08/20 Last Seen: October 2, 2024 Share Posted October 12, 2021 Hi, I'm having problem when trying to use your script/program. Whenever I try to use dp2rathena mob **** I get this printed in the command prompt. I've removed the api key from the code but I have my own. C:\WINDOWS\system32>dp2rathena mob 20592 Traceback (most recent call last): File "C:\Program Files\Python310\lib\runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Program Files\Python310\lib\runpy.py", line 86, in _run_code exec(code, run_globals) File "C:\Program Files\Python310\Scripts\dp2rathena.exe\__main__.py", line 7, in <module> File "C:\Program Files\Python310\lib\site-packages\click\core.py", line 829, in __call__ return self.main(*args, **kwargs) File "C:\Program Files\Python310\lib\site-packages\click\core.py", line 782, in main rv = self.invoke(ctx) File "C:\Program Files\Python310\lib\site-packages\click\core.py", line 1259, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "C:\Program Files\Python310\lib\site-packages\click\core.py", line 1066, in invoke return ctx.invoke(self.callback, **ctx.params) File "C:\Program Files\Python310\lib\site-packages\click\core.py", line 610, in invoke return callback(*args, **kwargs) File "C:\Program Files\Python310\lib\site-packages\click\decorators.py", line 21, in new_func return f(get_current_context(), *args, **kwargs) File "C:\Program Files\Python310\lib\site-packages\dp2rathena\cli.py", line 233, in mob converter.Converter(api_key, debug).convert_mob(to_convert, sort, wrap) File "C:\Program Files\Python310\lib\site-packages\dp2rathena\converter.py", line 76, in convert_mob mobs.append(mapper.map_mob(self.fetch_mob(mobid))) File "C:\Program Files\Python310\lib\site-packages\dp2rathena\converter.py", line 50, in fetch_mob raise err File "C:\Program Files\Python310\lib\site-packages\dp2rathena\converter.py", line 46, in fetch_mob return self.api.monster.get(mobid) File "C:\Program Files\Python310\lib\site-packages\tortilla\wrappers.py", line 407, in get return self.request('get', *parts, **options) File "C:\Program Files\Python310\lib\site-packages\tortilla\wrappers.py", line 383, in request return self.__call__(*parts).request(method=method, **options) File "C:\Program Files\Python310\lib\site-packages\tortilla\wrappers.py", line 403, in request return self._parent.request(method=method, **options) File "C:\Program Files\Python310\lib\site-packages\tortilla\wrappers.py", line 403, in request return self._parent.request(method=method, **options) File "C:\Program Files\Python310\lib\site-packages\tortilla\wrappers.py", line 403, in request return self._parent.request(method=method, **options) File "C:\Program Files\Python310\lib\site-packages\tortilla\wrappers.py", line 219, in request r.raise_for_status() File "C:\Program Files\Python310\lib\site-packages\requests\models.py", line 953, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://divine-pride.net/api/database/monster/20592?apiKey=******************* Quote Link to comment Share on other sites More sharing options...
latios Posted October 14, 2021 Group: Members Topic Count: 3 Topics Per Day: 0.00 Content Count: 25 Reputation: 17 Joined: 12/12/15 Last Seen: June 18, 2022 Author Share Posted October 14, 2021 Hi @exyoupjkbrxd, that's quite strange . I have a few questions and ideas: If you copy and paste the URL (with your actual API key) into a browser, are you able to see the relevant JSON data? https://divine-pride.net/api/database/monster/20592?apiKey=yoursecretapikey Does it work if you call the command by passing in your API key? dp2rathena -k yoursecretapikey mob 20592 There might be some whitespace at the beginning/end of your API key. I was able to successfully pull the data for mob 20592 with my own API key: Spoiler Header: Type: MOB_DB Version: 2 Body: - Id: 20592 AegisName: POISONOUS Name: Poisonous Level: 188 Hp: 2407086 BaseExp: 343870 JobExp: 240708 Attack: -278 Defense: 132 MagicDefense: 63 Str: 145 Agi: 141 Vit: 77 Int: 67 Dex: 175 Luk: 11 AttackRange: 1 SkillRange: 10 ChaseRange: 12 Size: Medium Race: Formless Element: Ghost ElementLevel: 4 WalkSpeed: 350 AttackDelay: 1033 AttackMotion: 1440 DamageMotion: 672 Ai: Unknown Drops: - Item: Poisonous_Card Rate: 1 StealProtected: true Quote Link to comment Share on other sites More sharing options...
exyoupjkbrxd Posted October 14, 2021 Group: Members Topic Count: 2 Topics Per Day: 0.00 Content Count: 13 Reputation: 0 Joined: 10/08/20 Last Seen: October 2, 2024 Share Posted October 14, 2021 10 minutes ago, latios said: Hi @exyoupjkbrxd, that's quite strange . I have a few questions and ideas: If you copy and paste the URL (with your actual API key) into a browser, are you able to see the relevant JSON data? https://divine-pride.net/api/database/monster/20592?apiKey=yoursecretapikey Does it work if you call the command by passing in your API key? dp2rathena -k yoursecretapikey mob 20592 There might be some whitespace at the beginning/end of your API key. I was able to successfully pull the data for mob 20592 with my own API key: Reveal hidden contents Header: Type: MOB_DB Version: 2 Body: - Id: 20592 AegisName: POISONOUS Name: Poisonous Level: 188 Hp: 2407086 BaseExp: 343870 JobExp: 240708 Attack: -278 Defense: 132 MagicDefense: 63 Str: 145 Agi: 141 Vit: 77 Int: 67 Dex: 175 Luk: 11 AttackRange: 1 SkillRange: 10 ChaseRange: 12 Size: Medium Race: Formless Element: Ghost ElementLevel: 4 WalkSpeed: 350 AttackDelay: 1033 AttackMotion: 1440 DamageMotion: 672 Ai: Unknown Drops: - Item: Poisonous_Card Rate: 1 StealProtected: true Hello, copy pasting the URL with my API key show this page (I've remove the API Key): And using the dp2rathena -k yoursecretapikey mob 20592, I get C:\Users\Alex>dp2rathena -k ------------------------------- mob 20592 Traceback (most recent call last): File "C:\Program Files\Python310\lib\runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Program Files\Python310\lib\runpy.py", line 86, in _run_code exec(code, run_globals) File "C:\Program Files\Python310\Scripts\dp2rathena.exe\__main__.py", line 7, in <module> File "C:\Program Files\Python310\lib\site-packages\click\core.py", line 829, in __call__ return self.main(*args, **kwargs) File "C:\Program Files\Python310\lib\site-packages\click\core.py", line 782, in main rv = self.invoke(ctx) File "C:\Program Files\Python310\lib\site-packages\click\core.py", line 1259, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "C:\Program Files\Python310\lib\site-packages\click\core.py", line 1066, in invoke return ctx.invoke(self.callback, **ctx.params) File "C:\Program Files\Python310\lib\site-packages\click\core.py", line 610, in invoke return callback(*args, **kwargs) File "C:\Program Files\Python310\lib\site-packages\click\decorators.py", line 21, in new_func return f(get_current_context(), *args, **kwargs) File "C:\Program Files\Python310\lib\site-packages\dp2rathena\cli.py", line 233, in mob converter.Converter(api_key, debug).convert_mob(to_convert, sort, wrap) File "C:\Program Files\Python310\lib\site-packages\dp2rathena\converter.py", line 76, in convert_mob mobs.append(mapper.map_mob(self.fetch_mob(mobid))) File "C:\Program Files\Python310\lib\site-packages\dp2rathena\converter.py", line 50, in fetch_mob raise err File "C:\Program Files\Python310\lib\site-packages\dp2rathena\converter.py", line 46, in fetch_mob return self.api.monster.get(mobid) File "C:\Program Files\Python310\lib\site-packages\tortilla\wrappers.py", line 407, in get return self.request('get', *parts, **options) File "C:\Program Files\Python310\lib\site-packages\tortilla\wrappers.py", line 383, in request return self.__call__(*parts).request(method=method, **options) File "C:\Program Files\Python310\lib\site-packages\tortilla\wrappers.py", line 403, in request return self._parent.request(method=method, **options) File "C:\Program Files\Python310\lib\site-packages\tortilla\wrappers.py", line 403, in request return self._parent.request(method=method, **options) File "C:\Program Files\Python310\lib\site-packages\tortilla\wrappers.py", line 403, in request return self._parent.request(method=method, **options) File "C:\Program Files\Python310\lib\site-packages\tortilla\wrappers.py", line 219, in request r.raise_for_status() File "C:\Program Files\Python310\lib\site-packages\requests\models.py", line 953, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://divine-pride.net/api/database/monster/20592?apiKey=------------------------ Quote Link to comment Share on other sites More sharing options...
latios Posted October 14, 2021 Group: Members Topic Count: 3 Topics Per Day: 0.00 Content Count: 25 Reputation: 17 Joined: 12/12/15 Last Seen: June 18, 2022 Author Share Posted October 14, 2021 Hi again @exyoupjkbrxd, in this case I think you may want to reach out to Dia, the admin of Divine-Pride for support: https://www.divine-pride.net/forum/index.php?/staff/ It sounds like there may be an issue with your API key if you aren't able to make any standard API calls even without using dp2rathena Quote Link to comment Share on other sites More sharing options...
Valcars Posted December 8, 2021 Group: Members Topic Count: 24 Topics Per Day: 0.01 Content Count: 60 Reputation: 0 Joined: 01/03/16 Last Seen: April 15, 2022 Share Posted December 8, 2021 (edited) i solved // EDIT Edited December 10, 2021 by Valcars Quote Link to comment Share on other sites More sharing options...
Hakahay Posted April 25, 2022 Group: Members Topic Count: 33 Topics Per Day: 0.01 Content Count: 82 Reputation: 4 Joined: 10/20/16 Last Seen: Thursday at 08:44 PM Share Posted April 25, 2022 Is it possible to pull information from a divine-pride database of another language? Quote Link to comment Share on other sites More sharing options...
latios Posted May 10, 2022 Group: Members Topic Count: 3 Topics Per Day: 0.00 Content Count: 25 Reputation: 17 Joined: 12/12/15 Last Seen: June 18, 2022 Author Share Posted May 10, 2022 (edited) On 4/25/2022 at 7:08 PM, Hakahay said: Is it possible to pull information from a divine-pride database of another language? Hi @Hakahay, querying other language/region DP databases using dp2rathena is not possible yet. Though Divine-Pride does have the feature of querying different language/region databases through their website and API. Spoiler Edited May 10, 2022 by latios Put image in a spoiler tag 1 Quote Link to comment Share on other sites More sharing options...
albertoacv4498 Posted August 15, 2022 Group: Members Topic Count: 8 Topics Per Day: 0.01 Content Count: 13 Reputation: 0 Joined: 11/20/20 Last Seen: Saturday at 02:46 PM Share Posted August 15, 2022 (edited) I just noticed, items that have an script don't get it... Any idea when this will be fixed? Edited August 15, 2022 by albertoacv4498 Changing question Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.