Merge pull request #735 from garakmon/encounter_json
Add Different Field Info to Wild Encounters JSON
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
#include <map>
|
||||
|
||||
#include <string>
|
||||
using std::string;
|
||||
using std::string; using std::to_string;
|
||||
|
||||
#include <inja.hpp>
|
||||
using namespace inja;
|
||||
@@ -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) {
|
||||
@@ -46,11 +53,33 @@ int main(int argc, char *argv[])
|
||||
return "";
|
||||
});
|
||||
|
||||
env.add_callback("setVarInt", 2, [=](Arguments& args) {
|
||||
string key = args.at(0)->get<string>();
|
||||
string value = to_string(args.at(1)->get<int>());
|
||||
set_custom_var(key, value);
|
||||
return "";
|
||||
});
|
||||
|
||||
env.add_callback("getVar", 1, [=](Arguments& args) {
|
||||
string key = args.at(0)->get<string>();
|
||||
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 +96,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>();
|
||||
|
||||
Reference in New Issue
Block a user