diff options
author | garak <garakmon@gmail.com> | 2019-06-30 12:05:45 -0400 |
---|---|---|
committer | garak <garakmon@gmail.com> | 2019-06-30 12:05:45 -0400 |
commit | adb0a444577b59eb02788c782a3d04bc285be0ba (patch) | |
tree | d85b776a801447aac7b2087306f2c0b71bddde6d /tools/jsonproc | |
parent | f3c7e1cc819f1927353f7c236ee36c4965c05167 (diff) |
add field info to wild pokemon json
Diffstat (limited to 'tools/jsonproc')
-rwxr-xr-x | tools/jsonproc/jsonproc.cpp | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/tools/jsonproc/jsonproc.cpp b/tools/jsonproc/jsonproc.cpp index efe48f39f..c0d6e9434 100755 --- a/tools/jsonproc/jsonproc.cpp +++ b/tools/jsonproc/jsonproc.cpp @@ -36,7 +36,14 @@ int main(int argc, char *argv[]) // Add custom command callbacks. env.add_callback("doNotModifyHeader", 0, [jsonfilepath, templateFilepath](Arguments& args) { - return "//\n// DO NOT MODIFY THIS FILE! IT IS AUTO-GENERATED FROM " + jsonfilepath +" and Inja template " + templateFilepath + "\n//\n"; + return "//\n// DO NOT MODIFY THIS FILE! It is auto-generated from " + jsonfilepath +" and Inja template " + templateFilepath + "\n//\n"; + }); + + env.add_callback("subtract", 2, [](Arguments& args) { + int minuend = args.at(0)->get<int>(); + int subtrahend = args.at(1)->get<int>(); + + return minuend - subtrahend; }); env.add_callback("setVar", 2, [=](Arguments& args) { @@ -51,6 +58,21 @@ int main(int argc, char *argv[]) return get_custom_var(key); }); + env.add_callback("trackVar", 2, [](Arguments& args) { + static int counter = 0; + + int addValue = args.at(0)->get<int>(); + int checkValue = args.at(1)->get<int>(); + + bool over = false; + + counter = (counter + addValue) % (checkValue + 1); + + if (counter <= addValue) over = true; + + return over; + }); + env.add_callback("concat", 2, [](Arguments& args) { string first = args.at(0)->get<string>(); string second = args.at(1)->get<string>(); @@ -67,7 +89,6 @@ int main(int argc, char *argv[]) return rawValue.erase(0, prefix.length()); }); - // Add custom command callbacks. env.add_callback("removeSuffix", 2, [](Arguments& args) { string rawValue = args.at(0)->get<string>(); string suffix = args.at(1)->get<string>(); |