Adds the CONVERT_ALL macro for YAML tools (#6986)

* Fixes #6813.
* Adds the CONVERT_ALL macro define to the header file.
* Adds a readme.md for the tools directory.
Thanks to @cbrgm and @Lemongrass3110!
This commit is contained in:
Aleos 2022-06-07 13:19:27 -04:00 committed by GitHub
parent a7a9b68ed2
commit 2ff76e5060
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 37 additions and 0 deletions

31
src/tool/readme.md Normal file
View File

@ -0,0 +1,31 @@
# rAthena Tools
As with any product, please make a backup of your database directory before continuing with any of these tools listed below.
## CSV2YAML
This tool will convert older generation TXT (or CSV, comma separated values) databases into the new YAML format. Not every database has been converted to YAML, but it's a process rAthena is taking to make efforts easier for future development.
The rAthena devs have taken steps to produce this tool which can be ran on any environment that supports rAthena, without any extra software!
Note, if you have modified a database with custom fields then the CSV2YAML will need to be modified to support those extra fields before converting.
Once ran, you will be prompted for each database you'd like to convert to YAML, allow any custom features in your collection to be translated over. Please add the `#define CONVERT_ALL` macro in `src/custom/define_pre.hpp` or uncomment `CONVERT_ALL` in `src/tools/yaml.hpp` before building if you wish to remove the prompts.
## Mapcache
The mapcache tool will allow you to generate or update the map_cache.dat that is located in `db/`. Simply add the GRF or Data directories that contain the `.gat` and `.rsw` files to the `conf/grf-files.txt` before running.
## YAML2SQL
This tool will convert the Item and Monster databases from YAML to SQL. This still gives the ability for servers that wish to utilize these databases to continue down that path.
Once ran, you will be prompted for each database you'd like to convert to SQL, allow any custom features in your collection to be translated over. Please add the `#define CONVERT_ALL` macro in `src/custom/define_pre.hpp` or uncomment `CONVERT_ALL` in `src/tools/yaml.hpp` before building if you wish to remove the prompts.
## YAMLUpgrade
There are times when a YAML database may have to go through a restructure. When running your server, you will be prompted with:
> Database version # is not supported anymore. Minimum version is: #
Simply run the YAMLUpgrade tool and when prompted to upgrade said database, let the tool handle the conversion for you!

View File

@ -57,6 +57,10 @@
using namespace rathena;
/// Uncomment this line to enable the ability for the conversion tools to automatically convert
/// all files with no user interaction, whether it be from CSV to YAML or YAML to SQL.
//#define CONVERT_ALL
#ifndef WIN32
int getch(void) {
struct termios oldattr, newattr;

View File

@ -146,6 +146,8 @@ bool process( const std::string& type, uint32 version, const std::vector<std::st
if( !askConfirmation( "Found the file \"%s\", which can be converted to sql.\nDo you want to convert it now? (Y/N)\n", from.c_str() ) ){
continue;
}
#else
ShowMessage("Found the file \"%s\", converting from yml to sql.\n", from.c_str());
#endif
inNode.reset();