mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-22 13:30:06 +00:00
[refac] Create typedef for nlohmann::json
This commit is contained in:
parent
dd3066849b
commit
14562f889e
@ -37,12 +37,12 @@ public:
|
|||||||
/*
|
/*
|
||||||
* Create a full and properly-paced path by interpolating between keyframes.
|
* Create a full and properly-paced path by interpolating between keyframes.
|
||||||
*/
|
*/
|
||||||
static void constructPathSkyway(nlohmann::json::iterator _pathData) {
|
static void constructPathSkyway(json::iterator _pathData) {
|
||||||
auto pathData = _pathData.value();
|
auto pathData = _pathData.value();
|
||||||
// Interpolate
|
// Interpolate
|
||||||
nlohmann::json pathPoints = pathData["points"];
|
json pathPoints = pathData["points"];
|
||||||
std::queue<WarpLocation> points;
|
std::queue<WarpLocation> points;
|
||||||
nlohmann::json::iterator _point = pathPoints.begin();
|
json::iterator _point = pathPoints.begin();
|
||||||
auto point = _point.value();
|
auto point = _point.value();
|
||||||
WarpLocation last = { point["iX"] , point["iY"] , point["iZ"] }; // start pos
|
WarpLocation last = { point["iX"] , point["iY"] , point["iZ"] }; // start pos
|
||||||
// use some for loop trickery; start position should not be a point
|
// use some for loop trickery; start position should not be a point
|
||||||
@ -56,12 +56,12 @@ static void constructPathSkyway(nlohmann::json::iterator _pathData) {
|
|||||||
Transport::SkywayPaths[pathData["iRouteID"]] = points;
|
Transport::SkywayPaths[pathData["iRouteID"]] = points;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void constructPathNPC(nlohmann::json::iterator _pathData, int32_t id=0) {
|
static void constructPathNPC(json::iterator _pathData, int32_t id=0) {
|
||||||
auto pathData = _pathData.value();
|
auto pathData = _pathData.value();
|
||||||
// Interpolate
|
// Interpolate
|
||||||
nlohmann::json pathPoints = pathData["points"];
|
json pathPoints = pathData["points"];
|
||||||
std::queue<WarpLocation> points;
|
std::queue<WarpLocation> points;
|
||||||
nlohmann::json::iterator _point = pathPoints.begin();
|
json::iterator _point = pathPoints.begin();
|
||||||
auto point = _point.value();
|
auto point = _point.value();
|
||||||
WarpLocation from = { point["iX"] , point["iY"] , point["iZ"] }; // point A coords
|
WarpLocation from = { point["iX"] , point["iY"] , point["iZ"] }; // point A coords
|
||||||
int stopTime = point["stop"];
|
int stopTime = point["stop"];
|
||||||
@ -87,24 +87,24 @@ static void constructPathNPC(nlohmann::json::iterator _pathData, int32_t id=0) {
|
|||||||
static void loadPaths(int* nextId) {
|
static void loadPaths(int* nextId) {
|
||||||
try {
|
try {
|
||||||
std::ifstream inFile(settings::PATHJSON);
|
std::ifstream inFile(settings::PATHJSON);
|
||||||
nlohmann::json pathData;
|
json pathData;
|
||||||
|
|
||||||
// read file into json
|
// read file into json
|
||||||
inFile >> pathData;
|
inFile >> pathData;
|
||||||
|
|
||||||
// skyway paths
|
// skyway paths
|
||||||
nlohmann::json pathDataSkyway = pathData["skyway"];
|
json pathDataSkyway = pathData["skyway"];
|
||||||
for (nlohmann::json::iterator skywayPath = pathDataSkyway.begin(); skywayPath != pathDataSkyway.end(); skywayPath++) {
|
for (json::iterator skywayPath = pathDataSkyway.begin(); skywayPath != pathDataSkyway.end(); skywayPath++) {
|
||||||
constructPathSkyway(skywayPath);
|
constructPathSkyway(skywayPath);
|
||||||
}
|
}
|
||||||
std::cout << "[INFO] Loaded " << Transport::SkywayPaths.size() << " skyway paths" << std::endl;
|
std::cout << "[INFO] Loaded " << Transport::SkywayPaths.size() << " skyway paths" << std::endl;
|
||||||
|
|
||||||
// slider circuit
|
// slider circuit
|
||||||
nlohmann::json pathDataSlider = pathData["slider"];
|
json pathDataSlider = pathData["slider"];
|
||||||
// lerp between keyframes
|
// lerp between keyframes
|
||||||
std::queue<WarpLocation> route;
|
std::queue<WarpLocation> route;
|
||||||
// initial point
|
// initial point
|
||||||
nlohmann::json::iterator _point = pathDataSlider.begin(); // iterator
|
json::iterator _point = pathDataSlider.begin(); // iterator
|
||||||
auto point = _point.value();
|
auto point = _point.value();
|
||||||
WarpLocation from = { point["iX"] , point["iY"] , point["iZ"] }; // point A coords
|
WarpLocation from = { point["iX"] , point["iY"] , point["iZ"] }; // point A coords
|
||||||
int stopTime = point["stop"] ? SLIDER_STOP_TICKS : 0; // arbitrary stop length
|
int stopTime = point["stop"] ? SLIDER_STOP_TICKS : 0; // arbitrary stop length
|
||||||
@ -151,16 +151,16 @@ static void loadPaths(int* nextId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// npc paths (pending refactor)
|
// npc paths (pending refactor)
|
||||||
nlohmann::json pathDataNPC = pathData["npc"];
|
json pathDataNPC = pathData["npc"];
|
||||||
/*
|
/*
|
||||||
for (nlohmann::json::iterator npcPath = pathDataNPC.begin(); npcPath != pathDataNPC.end(); npcPath++) {
|
for (json::iterator npcPath = pathDataNPC.begin(); npcPath != pathDataNPC.end(); npcPath++) {
|
||||||
constructPathNPC(npcPath);
|
constructPathNPC(npcPath);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// mob paths
|
// mob paths
|
||||||
pathDataNPC = pathData["mob"];
|
pathDataNPC = pathData["mob"];
|
||||||
for (nlohmann::json::iterator npcPath = pathDataNPC.begin(); npcPath != pathDataNPC.end(); npcPath++) {
|
for (json::iterator npcPath = pathDataNPC.begin(); npcPath != pathDataNPC.end(); npcPath++) {
|
||||||
for (auto& pair : NPCManager::NPCs) {
|
for (auto& pair : NPCManager::NPCs) {
|
||||||
if (pair.second->type != EntityType::MOB)
|
if (pair.second->type != EntityType::MOB)
|
||||||
continue;
|
continue;
|
||||||
@ -197,43 +197,43 @@ static void loadPaths(int* nextId) {
|
|||||||
static void loadDrops() {
|
static void loadDrops() {
|
||||||
try {
|
try {
|
||||||
std::ifstream inFile(settings::DROPSJSON);
|
std::ifstream inFile(settings::DROPSJSON);
|
||||||
nlohmann::json dropData;
|
json dropData;
|
||||||
|
|
||||||
// read file into json
|
// read file into json
|
||||||
inFile >> dropData;
|
inFile >> dropData;
|
||||||
|
|
||||||
// CrateDropChances
|
// CrateDropChances
|
||||||
nlohmann::json crateDropChances = dropData["CrateDropChances"];
|
json crateDropChances = dropData["CrateDropChances"];
|
||||||
for (nlohmann::json::iterator _crateDropChance = crateDropChances.begin(); _crateDropChance != crateDropChances.end(); _crateDropChance++) {
|
for (json::iterator _crateDropChance = crateDropChances.begin(); _crateDropChance != crateDropChances.end(); _crateDropChance++) {
|
||||||
auto crateDropChance = _crateDropChance.value();
|
auto crateDropChance = _crateDropChance.value();
|
||||||
CrateDropChance toAdd = {};
|
CrateDropChance toAdd = {};
|
||||||
|
|
||||||
toAdd.dropChance = (int)crateDropChance["DropChance"];
|
toAdd.dropChance = (int)crateDropChance["DropChance"];
|
||||||
toAdd.dropChanceTotal = (int)crateDropChance["DropChanceTotal"];
|
toAdd.dropChanceTotal = (int)crateDropChance["DropChanceTotal"];
|
||||||
|
|
||||||
nlohmann::json crateWeights = crateDropChance["CrateTypeDropWeights"];
|
json crateWeights = crateDropChance["CrateTypeDropWeights"];
|
||||||
for (nlohmann::json::iterator _crateWeight = crateWeights.begin(); _crateWeight != crateWeights.end(); _crateWeight++)
|
for (json::iterator _crateWeight = crateWeights.begin(); _crateWeight != crateWeights.end(); _crateWeight++)
|
||||||
toAdd.crateTypeDropWeights.push_back((int)_crateWeight.value());
|
toAdd.crateTypeDropWeights.push_back((int)_crateWeight.value());
|
||||||
|
|
||||||
Items::CrateDropChances[(int)crateDropChance["CrateDropChanceID"]] = toAdd;
|
Items::CrateDropChances[(int)crateDropChance["CrateDropChanceID"]] = toAdd;
|
||||||
}
|
}
|
||||||
|
|
||||||
// CrateDropTypes
|
// CrateDropTypes
|
||||||
nlohmann::json crateDropTypes = dropData["CrateDropTypes"];
|
json crateDropTypes = dropData["CrateDropTypes"];
|
||||||
for (nlohmann::json::iterator _crateDropType = crateDropTypes.begin(); _crateDropType != crateDropTypes.end(); _crateDropType++) {
|
for (json::iterator _crateDropType = crateDropTypes.begin(); _crateDropType != crateDropTypes.end(); _crateDropType++) {
|
||||||
auto crateDropType = _crateDropType.value();
|
auto crateDropType = _crateDropType.value();
|
||||||
std::vector<int> toAdd;
|
std::vector<int> toAdd;
|
||||||
|
|
||||||
nlohmann::json crateIds = crateDropType["CrateIDs"];
|
json crateIds = crateDropType["CrateIDs"];
|
||||||
for (nlohmann::json::iterator _crateId = crateIds.begin(); _crateId != crateIds.end(); _crateId++)
|
for (json::iterator _crateId = crateIds.begin(); _crateId != crateIds.end(); _crateId++)
|
||||||
toAdd.push_back((int)_crateId.value());
|
toAdd.push_back((int)_crateId.value());
|
||||||
|
|
||||||
Items::CrateDropTypes[(int)crateDropType["CrateDropTypeID"]] = toAdd;
|
Items::CrateDropTypes[(int)crateDropType["CrateDropTypeID"]] = toAdd;
|
||||||
}
|
}
|
||||||
|
|
||||||
// MiscDropChances
|
// MiscDropChances
|
||||||
nlohmann::json miscDropChances = dropData["MiscDropChances"];
|
json miscDropChances = dropData["MiscDropChances"];
|
||||||
for (nlohmann::json::iterator _miscDropChance = miscDropChances.begin(); _miscDropChance != miscDropChances.end(); _miscDropChance++) {
|
for (json::iterator _miscDropChance = miscDropChances.begin(); _miscDropChance != miscDropChances.end(); _miscDropChance++) {
|
||||||
auto miscDropChance = _miscDropChance.value();
|
auto miscDropChance = _miscDropChance.value();
|
||||||
|
|
||||||
Items::MiscDropChances[(int)miscDropChance["MiscDropChanceID"]] = {
|
Items::MiscDropChances[(int)miscDropChance["MiscDropChanceID"]] = {
|
||||||
@ -249,8 +249,8 @@ static void loadDrops() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MiscDropTypes
|
// MiscDropTypes
|
||||||
nlohmann::json miscDropTypes = dropData["MiscDropTypes"];
|
json miscDropTypes = dropData["MiscDropTypes"];
|
||||||
for (nlohmann::json::iterator _miscDropType = miscDropTypes.begin(); _miscDropType != miscDropTypes.end(); _miscDropType++) {
|
for (json::iterator _miscDropType = miscDropTypes.begin(); _miscDropType != miscDropTypes.end(); _miscDropType++) {
|
||||||
auto miscDropType = _miscDropType.value();
|
auto miscDropType = _miscDropType.value();
|
||||||
|
|
||||||
Items::MiscDropTypes[(int)miscDropType["MiscDropTypeID"]] = {
|
Items::MiscDropTypes[(int)miscDropType["MiscDropTypeID"]] = {
|
||||||
@ -262,8 +262,8 @@ static void loadDrops() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MobDrops
|
// MobDrops
|
||||||
nlohmann::json mobDrops = dropData["MobDrops"];
|
json mobDrops = dropData["MobDrops"];
|
||||||
for (nlohmann::json::iterator _mobDrop = mobDrops.begin(); _mobDrop != mobDrops.end(); _mobDrop++) {
|
for (json::iterator _mobDrop = mobDrops.begin(); _mobDrop != mobDrops.end(); _mobDrop++) {
|
||||||
auto mobDrop = _mobDrop.value();
|
auto mobDrop = _mobDrop.value();
|
||||||
|
|
||||||
Items::MobDrops[(int)mobDrop["MobDropID"]] = {
|
Items::MobDrops[(int)mobDrop["MobDropID"]] = {
|
||||||
@ -275,37 +275,37 @@ static void loadDrops() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Events
|
// Events
|
||||||
nlohmann::json events = dropData["Events"];
|
json events = dropData["Events"];
|
||||||
for (nlohmann::json::iterator _event = events.begin(); _event != events.end(); _event++) {
|
for (json::iterator _event = events.begin(); _event != events.end(); _event++) {
|
||||||
auto event = _event.value();
|
auto event = _event.value();
|
||||||
|
|
||||||
Items::EventToDropMap[(int)event["EventID"]] = (int)event["MobDropID"];
|
Items::EventToDropMap[(int)event["EventID"]] = (int)event["MobDropID"];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mobs
|
// Mobs
|
||||||
nlohmann::json mobs = dropData["Mobs"];
|
json mobs = dropData["Mobs"];
|
||||||
for (nlohmann::json::iterator _mob = mobs.begin(); _mob != mobs.end(); _mob++) {
|
for (json::iterator _mob = mobs.begin(); _mob != mobs.end(); _mob++) {
|
||||||
auto mob = _mob.value();
|
auto mob = _mob.value();
|
||||||
|
|
||||||
Items::MobToDropMap[(int)mob["MobID"]] = (int)mob["MobDropID"];
|
Items::MobToDropMap[(int)mob["MobID"]] = (int)mob["MobDropID"];
|
||||||
}
|
}
|
||||||
|
|
||||||
// RarityWeights
|
// RarityWeights
|
||||||
nlohmann::json rarityWeights = dropData["RarityWeights"];
|
json rarityWeights = dropData["RarityWeights"];
|
||||||
for (nlohmann::json::iterator _rarityWeightsObject = rarityWeights.begin(); _rarityWeightsObject != rarityWeights.end(); _rarityWeightsObject++) {
|
for (json::iterator _rarityWeightsObject = rarityWeights.begin(); _rarityWeightsObject != rarityWeights.end(); _rarityWeightsObject++) {
|
||||||
auto rarityWeightsObject = _rarityWeightsObject.value();
|
auto rarityWeightsObject = _rarityWeightsObject.value();
|
||||||
std::vector<int> toAdd;
|
std::vector<int> toAdd;
|
||||||
|
|
||||||
nlohmann::json weights = rarityWeightsObject["Weights"];
|
json weights = rarityWeightsObject["Weights"];
|
||||||
for (nlohmann::json::iterator _weight = weights.begin(); _weight != weights.end(); _weight++)
|
for (json::iterator _weight = weights.begin(); _weight != weights.end(); _weight++)
|
||||||
toAdd.push_back((int)_weight.value());
|
toAdd.push_back((int)_weight.value());
|
||||||
|
|
||||||
Items::RarityWeights[(int)rarityWeightsObject["RarityWeightID"]] = toAdd;
|
Items::RarityWeights[(int)rarityWeightsObject["RarityWeightID"]] = toAdd;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ItemSets
|
// ItemSets
|
||||||
nlohmann::json itemSets = dropData["ItemSets"];
|
json itemSets = dropData["ItemSets"];
|
||||||
for (nlohmann::json::iterator _itemSet = itemSets.begin(); _itemSet != itemSets.end(); _itemSet++) {
|
for (json::iterator _itemSet = itemSets.begin(); _itemSet != itemSets.end(); _itemSet++) {
|
||||||
auto itemSet = _itemSet.value();
|
auto itemSet = _itemSet.value();
|
||||||
ItemSet toAdd = {};
|
ItemSet toAdd = {};
|
||||||
|
|
||||||
@ -313,28 +313,28 @@ static void loadDrops() {
|
|||||||
toAdd.ignoreGender = (bool)itemSet["IgnoreGender"];
|
toAdd.ignoreGender = (bool)itemSet["IgnoreGender"];
|
||||||
toAdd.defaultItemWeight = (int)itemSet["DefaultItemWeight"];
|
toAdd.defaultItemWeight = (int)itemSet["DefaultItemWeight"];
|
||||||
|
|
||||||
nlohmann::json alterRarityMap = itemSet["AlterRarityMap"];
|
json alterRarityMap = itemSet["AlterRarityMap"];
|
||||||
for (nlohmann::json::iterator _alterRarityMapEntry = alterRarityMap.begin(); _alterRarityMapEntry != alterRarityMap.end(); _alterRarityMapEntry++)
|
for (json::iterator _alterRarityMapEntry = alterRarityMap.begin(); _alterRarityMapEntry != alterRarityMap.end(); _alterRarityMapEntry++)
|
||||||
toAdd.alterRarityMap[std::atoi(_alterRarityMapEntry.key().c_str())] = (int)_alterRarityMapEntry.value();
|
toAdd.alterRarityMap[std::atoi(_alterRarityMapEntry.key().c_str())] = (int)_alterRarityMapEntry.value();
|
||||||
|
|
||||||
nlohmann::json alterGenderMap = itemSet["AlterGenderMap"];
|
json alterGenderMap = itemSet["AlterGenderMap"];
|
||||||
for (nlohmann::json::iterator _alterGenderMapEntry = alterGenderMap.begin(); _alterGenderMapEntry != alterGenderMap.end(); _alterGenderMapEntry++)
|
for (json::iterator _alterGenderMapEntry = alterGenderMap.begin(); _alterGenderMapEntry != alterGenderMap.end(); _alterGenderMapEntry++)
|
||||||
toAdd.alterGenderMap[std::atoi(_alterGenderMapEntry.key().c_str())] = (int)_alterGenderMapEntry.value();
|
toAdd.alterGenderMap[std::atoi(_alterGenderMapEntry.key().c_str())] = (int)_alterGenderMapEntry.value();
|
||||||
|
|
||||||
nlohmann::json alterItemWeightMap = itemSet["AlterItemWeightMap"];
|
json alterItemWeightMap = itemSet["AlterItemWeightMap"];
|
||||||
for (nlohmann::json::iterator _alterItemWeightMapEntry = alterItemWeightMap.begin(); _alterItemWeightMapEntry != alterItemWeightMap.end(); _alterItemWeightMapEntry++)
|
for (json::iterator _alterItemWeightMapEntry = alterItemWeightMap.begin(); _alterItemWeightMapEntry != alterItemWeightMap.end(); _alterItemWeightMapEntry++)
|
||||||
toAdd.alterItemWeightMap[std::atoi(_alterItemWeightMapEntry.key().c_str())] = (int)_alterItemWeightMapEntry.value();
|
toAdd.alterItemWeightMap[std::atoi(_alterItemWeightMapEntry.key().c_str())] = (int)_alterItemWeightMapEntry.value();
|
||||||
|
|
||||||
nlohmann::json itemReferenceIds = itemSet["ItemReferenceIDs"];
|
json itemReferenceIds = itemSet["ItemReferenceIDs"];
|
||||||
for (nlohmann::json::iterator itemReferenceId = itemReferenceIds.begin(); itemReferenceId != itemReferenceIds.end(); itemReferenceId++)
|
for (json::iterator itemReferenceId = itemReferenceIds.begin(); itemReferenceId != itemReferenceIds.end(); itemReferenceId++)
|
||||||
toAdd.itemReferenceIds.push_back((int)itemReferenceId.value());
|
toAdd.itemReferenceIds.push_back((int)itemReferenceId.value());
|
||||||
|
|
||||||
Items::ItemSets[(int)itemSet["ItemSetID"]] = toAdd;
|
Items::ItemSets[(int)itemSet["ItemSetID"]] = toAdd;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Crates
|
// Crates
|
||||||
nlohmann::json crates = dropData["Crates"];
|
json crates = dropData["Crates"];
|
||||||
for (nlohmann::json::iterator _crate = crates.begin(); _crate != crates.end(); _crate++) {
|
for (json::iterator _crate = crates.begin(); _crate != crates.end(); _crate++) {
|
||||||
auto crate = _crate.value();
|
auto crate = _crate.value();
|
||||||
|
|
||||||
Items::Crates[(int)crate["CrateID"]] = {
|
Items::Crates[(int)crate["CrateID"]] = {
|
||||||
@ -344,8 +344,8 @@ static void loadDrops() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ItemReferences
|
// ItemReferences
|
||||||
nlohmann::json itemReferences = dropData["ItemReferences"];
|
json itemReferences = dropData["ItemReferences"];
|
||||||
for (nlohmann::json::iterator _itemReference = itemReferences.begin(); _itemReference != itemReferences.end(); _itemReference++) {
|
for (json::iterator _itemReference = itemReferences.begin(); _itemReference != itemReferences.end(); _itemReference++) {
|
||||||
auto itemReference = _itemReference.value();
|
auto itemReference = _itemReference.value();
|
||||||
|
|
||||||
int itemReferenceId = (int)itemReference["ItemReferenceID"];
|
int itemReferenceId = (int)itemReference["ItemReferenceID"];
|
||||||
@ -371,16 +371,16 @@ static void loadDrops() {
|
|||||||
|
|
||||||
#ifdef ACADEMY
|
#ifdef ACADEMY
|
||||||
// NanoCapsules
|
// NanoCapsules
|
||||||
nlohmann::json capsules = dropData["NanoCapsules"];
|
json capsules = dropData["NanoCapsules"];
|
||||||
for (nlohmann::json::iterator _capsule = capsules.begin(); _capsule != capsules.end(); _capsule++) {
|
for (json::iterator _capsule = capsules.begin(); _capsule != capsules.end(); _capsule++) {
|
||||||
auto capsule = _capsule.value();
|
auto capsule = _capsule.value();
|
||||||
Items::NanoCapsules[(int)capsule["CrateID"]] = (int)capsule["Nano"];
|
Items::NanoCapsules[(int)capsule["CrateID"]] = (int)capsule["Nano"];
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Racing rewards
|
// Racing rewards
|
||||||
nlohmann::json racing = dropData["Racing"];
|
json racing = dropData["Racing"];
|
||||||
for (nlohmann::json::iterator _race = racing.begin(); _race != racing.end(); _race++) {
|
for (json::iterator _race = racing.begin(); _race != racing.end(); _race++) {
|
||||||
auto race = _race.value();
|
auto race = _race.value();
|
||||||
int raceEPID = race["EPID"];
|
int raceEPID = race["EPID"];
|
||||||
|
|
||||||
@ -402,13 +402,13 @@ static void loadDrops() {
|
|||||||
|
|
||||||
// score cutoffs
|
// score cutoffs
|
||||||
std::vector<int> rankScores;
|
std::vector<int> rankScores;
|
||||||
for (nlohmann::json::iterator _rankScore = race["RankScores"].begin(); _rankScore != race["RankScores"].end(); _rankScore++) {
|
for (json::iterator _rankScore = race["RankScores"].begin(); _rankScore != race["RankScores"].end(); _rankScore++) {
|
||||||
rankScores.push_back((int)_rankScore.value());
|
rankScores.push_back((int)_rankScore.value());
|
||||||
}
|
}
|
||||||
|
|
||||||
// reward IDs for each rank
|
// reward IDs for each rank
|
||||||
std::vector<int> rankRewards;
|
std::vector<int> rankRewards;
|
||||||
for (nlohmann::json::iterator _rankReward = race["Rewards"].begin(); _rankReward != race["Rewards"].end(); _rankReward++) {
|
for (json::iterator _rankReward = race["Rewards"].begin(); _rankReward != race["Rewards"].end(); _rankReward++) {
|
||||||
rankRewards.push_back((int)_rankReward.value());
|
rankRewards.push_back((int)_rankReward.value());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -424,14 +424,14 @@ static void loadDrops() {
|
|||||||
std::cout << "[INFO] Loaded rewards for " << Racing::EPRewards.size() << " IZ races" << std::endl;
|
std::cout << "[INFO] Loaded rewards for " << Racing::EPRewards.size() << " IZ races" << std::endl;
|
||||||
|
|
||||||
// CodeItems
|
// CodeItems
|
||||||
nlohmann::json codes = dropData["CodeItems"];
|
json codes = dropData["CodeItems"];
|
||||||
for (nlohmann::json::iterator _code = codes.begin(); _code != codes.end(); _code++) {
|
for (json::iterator _code = codes.begin(); _code != codes.end(); _code++) {
|
||||||
auto code = _code.value();
|
auto code = _code.value();
|
||||||
std::string codeStr = code["Code"];
|
std::string codeStr = code["Code"];
|
||||||
std::vector<std::pair<int32_t, int32_t>> itemVector;
|
std::vector<std::pair<int32_t, int32_t>> itemVector;
|
||||||
|
|
||||||
nlohmann::json itemReferenceIds = code["ItemReferenceIDs"];
|
json itemReferenceIds = code["ItemReferenceIDs"];
|
||||||
for (nlohmann::json::iterator _itemReferenceId = itemReferenceIds.begin(); _itemReferenceId != itemReferenceIds.end(); _itemReferenceId++) {
|
for (json::iterator _itemReferenceId = itemReferenceIds.begin(); _itemReferenceId != itemReferenceIds.end(); _itemReferenceId++) {
|
||||||
int itemReferenceId = (int)_itemReferenceId.value();
|
int itemReferenceId = (int)_itemReferenceId.value();
|
||||||
|
|
||||||
// validate and convert here
|
// validate and convert here
|
||||||
@ -462,14 +462,14 @@ static void loadDrops() {
|
|||||||
static void loadEggs(int32_t* nextId) {
|
static void loadEggs(int32_t* nextId) {
|
||||||
try {
|
try {
|
||||||
std::ifstream inFile(settings::EGGSJSON);
|
std::ifstream inFile(settings::EGGSJSON);
|
||||||
nlohmann::json eggData;
|
json eggData;
|
||||||
|
|
||||||
// read file into json
|
// read file into json
|
||||||
inFile >> eggData;
|
inFile >> eggData;
|
||||||
|
|
||||||
// EggTypes
|
// EggTypes
|
||||||
nlohmann::json eggTypes = eggData["EggTypes"];
|
json eggTypes = eggData["EggTypes"];
|
||||||
for (nlohmann::json::iterator _eggType = eggTypes.begin(); _eggType != eggTypes.end(); _eggType++) {
|
for (json::iterator _eggType = eggTypes.begin(); _eggType != eggTypes.end(); _eggType++) {
|
||||||
auto eggType = _eggType.value();
|
auto eggType = _eggType.value();
|
||||||
EggType toAdd = {};
|
EggType toAdd = {};
|
||||||
toAdd.dropCrateId = (int)eggType["DropCrateId"];
|
toAdd.dropCrateId = (int)eggType["DropCrateId"];
|
||||||
@ -506,7 +506,7 @@ static void loadEggs(int32_t* nextId) {
|
|||||||
static void loadGruntwork(int32_t *nextId) {
|
static void loadGruntwork(int32_t *nextId) {
|
||||||
try {
|
try {
|
||||||
std::ifstream inFile(settings::GRUNTWORKJSON);
|
std::ifstream inFile(settings::GRUNTWORKJSON);
|
||||||
nlohmann::json gruntwork;
|
json gruntwork;
|
||||||
|
|
||||||
// skip if there's no gruntwork to load
|
// skip if there's no gruntwork to load
|
||||||
if (inFile.fail())
|
if (inFile.fail())
|
||||||
@ -600,7 +600,7 @@ static void loadGruntwork(int32_t *nextId) {
|
|||||||
auto followers = leader["aFollowers"];
|
auto followers = leader["aFollowers"];
|
||||||
if (followers.size() < 5) {
|
if (followers.size() < 5) {
|
||||||
int followerCount = 0;
|
int followerCount = 0;
|
||||||
for (nlohmann::json::iterator _fol = followers.begin(); _fol != followers.end(); _fol++) {
|
for (json::iterator _fol = followers.begin(); _fol != followers.end(); _fol++) {
|
||||||
auto follower = _fol.value();
|
auto follower = _fol.value();
|
||||||
auto tdFol = NPCManager::NPCData[(int)follower["iNPCType"]];
|
auto tdFol = NPCManager::NPCData[(int)follower["iNPCType"]];
|
||||||
Mob* tmpFol = new Mob((int)leader["iX"] + (int)follower["iOffsetX"], (int)leader["iY"] + (int)follower["iOffsetY"], leader["iZ"], leader["iAngle"], instanceID, follower["iNPCType"], tdFol, *nextId);
|
Mob* tmpFol = new Mob((int)leader["iX"] + (int)follower["iOffsetX"], (int)leader["iY"] + (int)follower["iOffsetY"], leader["iZ"], leader["iAngle"], instanceID, follower["iNPCType"], tdFol, *nextId);
|
||||||
@ -653,12 +653,12 @@ void TableData::init() {
|
|||||||
// load NPCs from NPC.json
|
// load NPCs from NPC.json
|
||||||
try {
|
try {
|
||||||
std::ifstream inFile(settings::NPCJSON);
|
std::ifstream inFile(settings::NPCJSON);
|
||||||
nlohmann::json npcData;
|
json npcData;
|
||||||
|
|
||||||
// read file into json
|
// read file into json
|
||||||
inFile >> npcData;
|
inFile >> npcData;
|
||||||
npcData = npcData["NPCs"];
|
npcData = npcData["NPCs"];
|
||||||
for (nlohmann::json::iterator _npc = npcData.begin(); _npc != npcData.end(); _npc++) {
|
for (json::iterator _npc = npcData.begin(); _npc != npcData.end(); _npc++) {
|
||||||
auto npc = _npc.value();
|
auto npc = _npc.value();
|
||||||
int instanceID = npc.find("iMapNum") == npc.end() ? INSTANCE_OVERWORLD : (int)npc["iMapNum"];
|
int instanceID = npc.find("iMapNum") == npc.end() ? INSTANCE_OVERWORLD : (int)npc["iMapNum"];
|
||||||
#ifdef ACADEMY
|
#ifdef ACADEMY
|
||||||
@ -686,7 +686,7 @@ void TableData::init() {
|
|||||||
// load everything else from xdttable
|
// load everything else from xdttable
|
||||||
std::cout << "[INFO] Parsing xdt.json..." << std::endl;
|
std::cout << "[INFO] Parsing xdt.json..." << std::endl;
|
||||||
std::ifstream infile(settings::XDTJSON);
|
std::ifstream infile(settings::XDTJSON);
|
||||||
nlohmann::json xdtData;
|
json xdtData;
|
||||||
|
|
||||||
// read file into json
|
// read file into json
|
||||||
infile >> xdtData;
|
infile >> xdtData;
|
||||||
@ -696,9 +696,9 @@ void TableData::init() {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// load warps
|
// load warps
|
||||||
nlohmann::json warpData = xdtData["m_pInstanceTable"]["m_pWarpData"];
|
json warpData = xdtData["m_pInstanceTable"]["m_pWarpData"];
|
||||||
|
|
||||||
for (nlohmann::json::iterator _warp = warpData.begin(); _warp != warpData.end(); _warp++) {
|
for (json::iterator _warp = warpData.begin(); _warp != warpData.end(); _warp++) {
|
||||||
auto warp = _warp.value();
|
auto warp = _warp.value();
|
||||||
WarpLocation warpLoc = { warp["m_iToX"], warp["m_iToY"], warp["m_iToZ"], warp["m_iToMapNum"], warp["m_iIsInstance"], warp["m_iLimit_TaskID"], warp["m_iNpcNumber"] };
|
WarpLocation warpLoc = { warp["m_iToX"], warp["m_iToY"], warp["m_iToZ"], warp["m_iToMapNum"], warp["m_iIsInstance"], warp["m_iLimit_TaskID"], warp["m_iNpcNumber"] };
|
||||||
int warpID = warp["m_iWarpNumber"];
|
int warpID = warp["m_iWarpNumber"];
|
||||||
@ -708,17 +708,17 @@ void TableData::init() {
|
|||||||
std::cout << "[INFO] Populated " << NPCManager::Warps.size() << " Warps" << std::endl;
|
std::cout << "[INFO] Populated " << NPCManager::Warps.size() << " Warps" << std::endl;
|
||||||
|
|
||||||
// load transport routes and locations
|
// load transport routes and locations
|
||||||
nlohmann::json transRouteData = xdtData["m_pTransportationTable"]["m_pTransportationData"];
|
json transRouteData = xdtData["m_pTransportationTable"]["m_pTransportationData"];
|
||||||
nlohmann::json transLocData = xdtData["m_pTransportationTable"]["m_pTransportationWarpLocation"];
|
json transLocData = xdtData["m_pTransportationTable"]["m_pTransportationWarpLocation"];
|
||||||
|
|
||||||
for (nlohmann::json::iterator _tLoc = transLocData.begin(); _tLoc != transLocData.end(); _tLoc++) {
|
for (json::iterator _tLoc = transLocData.begin(); _tLoc != transLocData.end(); _tLoc++) {
|
||||||
auto tLoc = _tLoc.value();
|
auto tLoc = _tLoc.value();
|
||||||
TransportLocation transLoc = { tLoc["m_iNPCID"], tLoc["m_iXpos"], tLoc["m_iYpos"], tLoc["m_iZpos"] };
|
TransportLocation transLoc = { tLoc["m_iNPCID"], tLoc["m_iXpos"], tLoc["m_iYpos"], tLoc["m_iZpos"] };
|
||||||
Transport::Locations[tLoc["m_iLocationID"]] = transLoc;
|
Transport::Locations[tLoc["m_iLocationID"]] = transLoc;
|
||||||
}
|
}
|
||||||
std::cout << "[INFO] Loaded " << Transport::Locations.size() << " S.C.A.M.P.E.R. locations" << std::endl;
|
std::cout << "[INFO] Loaded " << Transport::Locations.size() << " S.C.A.M.P.E.R. locations" << std::endl;
|
||||||
|
|
||||||
for (nlohmann::json::iterator _tRoute = transRouteData.begin(); _tRoute != transRouteData.end(); _tRoute++) {
|
for (json::iterator _tRoute = transRouteData.begin(); _tRoute != transRouteData.end(); _tRoute++) {
|
||||||
auto tRoute = _tRoute.value();
|
auto tRoute = _tRoute.value();
|
||||||
TransportRoute transRoute = { tRoute["m_iMoveType"], tRoute["m_iStartLocation"], tRoute["m_iEndLocation"],
|
TransportRoute transRoute = { tRoute["m_iMoveType"], tRoute["m_iStartLocation"], tRoute["m_iEndLocation"],
|
||||||
tRoute["m_iCost"] , tRoute["m_iSpeed"], tRoute["m_iRouteNum"] };
|
tRoute["m_iCost"] , tRoute["m_iSpeed"], tRoute["m_iRouteNum"] };
|
||||||
@ -727,7 +727,7 @@ void TableData::init() {
|
|||||||
std::cout << "[INFO] Loaded " << Transport::Routes.size() << " transportation routes" << std::endl;
|
std::cout << "[INFO] Loaded " << Transport::Routes.size() << " transportation routes" << std::endl;
|
||||||
|
|
||||||
// load mission-related data
|
// load mission-related data
|
||||||
nlohmann::json tasks = xdtData["m_pMissionTable"]["m_pMissionData"];
|
json tasks = xdtData["m_pMissionTable"]["m_pMissionData"];
|
||||||
|
|
||||||
for (auto _task = tasks.begin(); _task != tasks.end(); _task++) {
|
for (auto _task = tasks.begin(); _task != tasks.end(); _task++) {
|
||||||
auto task = _task.value();
|
auto task = _task.value();
|
||||||
@ -754,13 +754,13 @@ void TableData::init() {
|
|||||||
const char* setNames[11] = { "m_pWeaponItemTable", "m_pShirtsItemTable", "m_pPantsItemTable", "m_pShoesItemTable",
|
const char* setNames[11] = { "m_pWeaponItemTable", "m_pShirtsItemTable", "m_pPantsItemTable", "m_pShoesItemTable",
|
||||||
"m_pHatItemTable", "m_pGlassItemTable", "m_pBackItemTable", "m_pGeneralItemTable", "",
|
"m_pHatItemTable", "m_pGlassItemTable", "m_pBackItemTable", "m_pGeneralItemTable", "",
|
||||||
"m_pChestItemTable", "m_pVehicleItemTable" };
|
"m_pChestItemTable", "m_pVehicleItemTable" };
|
||||||
nlohmann::json itemSet;
|
json itemSet;
|
||||||
for (int i = 0; i < 11; i++) {
|
for (int i = 0; i < 11; i++) {
|
||||||
if (i == 8)
|
if (i == 8)
|
||||||
continue; // there is no type 8, of course
|
continue; // there is no type 8, of course
|
||||||
|
|
||||||
itemSet = xdtData[setNames[i]]["m_pItemData"];
|
itemSet = xdtData[setNames[i]]["m_pItemData"];
|
||||||
for (nlohmann::json::iterator _item = itemSet.begin(); _item != itemSet.end(); _item++) {
|
for (json::iterator _item = itemSet.begin(); _item != itemSet.end(); _item++) {
|
||||||
auto item = _item.value();
|
auto item = _item.value();
|
||||||
int itemID = item["m_iItemNumber"];
|
int itemID = item["m_iItemNumber"];
|
||||||
INITSTRUCT(Items::Item, itemData);
|
INITSTRUCT(Items::Item, itemData);
|
||||||
@ -789,16 +789,16 @@ void TableData::init() {
|
|||||||
|
|
||||||
// load player limits from m_pAvatarTable.m_pAvatarGrowData
|
// load player limits from m_pAvatarTable.m_pAvatarGrowData
|
||||||
|
|
||||||
nlohmann::json growth = xdtData["m_pAvatarTable"]["m_pAvatarGrowData"];
|
json growth = xdtData["m_pAvatarTable"]["m_pAvatarGrowData"];
|
||||||
|
|
||||||
for (int i = 0; i < 37; i++) {
|
for (int i = 0; i < 37; i++) {
|
||||||
Missions::AvatarGrowth[i] = growth[i];
|
Missions::AvatarGrowth[i] = growth[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
// load vendor listings
|
// load vendor listings
|
||||||
nlohmann::json listings = xdtData["m_pVendorTable"]["m_pItemData"];
|
json listings = xdtData["m_pVendorTable"]["m_pItemData"];
|
||||||
|
|
||||||
for (nlohmann::json::iterator _lst = listings.begin(); _lst != listings.end(); _lst++) {
|
for (json::iterator _lst = listings.begin(); _lst != listings.end(); _lst++) {
|
||||||
auto lst = _lst.value();
|
auto lst = _lst.value();
|
||||||
VendorListing vListing = { lst["m_iSortNumber"], lst["m_iItemType"], lst["m_iitemID"] };
|
VendorListing vListing = { lst["m_iSortNumber"], lst["m_iItemType"], lst["m_iitemID"] };
|
||||||
Vendors::VendorTables[lst["m_iNpcNumber"]].push_back(vListing);
|
Vendors::VendorTables[lst["m_iNpcNumber"]].push_back(vListing);
|
||||||
@ -807,9 +807,9 @@ void TableData::init() {
|
|||||||
std::cout << "[INFO] Loaded " << Vendors::VendorTables.size() << " vendor tables" << std::endl;
|
std::cout << "[INFO] Loaded " << Vendors::VendorTables.size() << " vendor tables" << std::endl;
|
||||||
|
|
||||||
// load crocpot entries
|
// load crocpot entries
|
||||||
nlohmann::json crocs = xdtData["m_pCombiningTable"]["m_pCombiningData"];
|
json crocs = xdtData["m_pCombiningTable"]["m_pCombiningData"];
|
||||||
|
|
||||||
for (nlohmann::json::iterator croc = crocs.begin(); croc != crocs.end(); croc++) {
|
for (json::iterator croc = crocs.begin(); croc != crocs.end(); croc++) {
|
||||||
CrocPotEntry crocEntry = { croc.value()["m_iStatConstant"], croc.value()["m_iLookConstant"], croc.value()["m_fLevelGapStandard"],
|
CrocPotEntry crocEntry = { croc.value()["m_iStatConstant"], croc.value()["m_iLookConstant"], croc.value()["m_fLevelGapStandard"],
|
||||||
croc.value()["m_fSameGrade"], croc.value()["m_fOneGrade"], croc.value()["m_fTwoGrade"], croc.value()["m_fThreeGrade"] };
|
croc.value()["m_fSameGrade"], croc.value()["m_fOneGrade"], croc.value()["m_fTwoGrade"], croc.value()["m_fThreeGrade"] };
|
||||||
Items::CrocPotTable[croc.value()["m_iLevelGap"]] = crocEntry;
|
Items::CrocPotTable[croc.value()["m_iLevelGap"]] = crocEntry;
|
||||||
@ -818,8 +818,8 @@ void TableData::init() {
|
|||||||
std::cout << "[INFO] Loaded " << Items::CrocPotTable.size() << " croc pot value sets" << std::endl;
|
std::cout << "[INFO] Loaded " << Items::CrocPotTable.size() << " croc pot value sets" << std::endl;
|
||||||
|
|
||||||
// load nano info
|
// load nano info
|
||||||
nlohmann::json nanoInfo = xdtData["m_pNanoTable"]["m_pNanoData"];
|
json nanoInfo = xdtData["m_pNanoTable"]["m_pNanoData"];
|
||||||
for (nlohmann::json::iterator _nano = nanoInfo.begin(); _nano != nanoInfo.end(); _nano++) {
|
for (json::iterator _nano = nanoInfo.begin(); _nano != nanoInfo.end(); _nano++) {
|
||||||
auto nano = _nano.value();
|
auto nano = _nano.value();
|
||||||
NanoData nanoData;
|
NanoData nanoData;
|
||||||
nanoData.style = nano["m_iStyle"];
|
nanoData.style = nano["m_iStyle"];
|
||||||
@ -828,8 +828,8 @@ void TableData::init() {
|
|||||||
|
|
||||||
std::cout << "[INFO] Loaded " << Nanos::NanoTable.size() << " nanos" << std::endl;
|
std::cout << "[INFO] Loaded " << Nanos::NanoTable.size() << " nanos" << std::endl;
|
||||||
|
|
||||||
nlohmann::json nanoTuneInfo = xdtData["m_pNanoTable"]["m_pNanoTuneData"];
|
json nanoTuneInfo = xdtData["m_pNanoTable"]["m_pNanoTuneData"];
|
||||||
for (nlohmann::json::iterator _nano = nanoTuneInfo.begin(); _nano != nanoTuneInfo.end(); _nano++) {
|
for (json::iterator _nano = nanoTuneInfo.begin(); _nano != nanoTuneInfo.end(); _nano++) {
|
||||||
auto nano = _nano.value();
|
auto nano = _nano.value();
|
||||||
NanoTuning nanoData;
|
NanoTuning nanoData;
|
||||||
nanoData.reqItems = nano["m_iReqItemID"];
|
nanoData.reqItems = nano["m_iReqItemID"];
|
||||||
@ -840,9 +840,9 @@ void TableData::init() {
|
|||||||
std::cout << "[INFO] Loaded " << Nanos::NanoTable.size() << " nano tunings" << std::endl;
|
std::cout << "[INFO] Loaded " << Nanos::NanoTable.size() << " nano tunings" << std::endl;
|
||||||
|
|
||||||
// load nano powers
|
// load nano powers
|
||||||
nlohmann::json skills = xdtData["m_pSkillTable"]["m_pSkillData"];
|
json skills = xdtData["m_pSkillTable"]["m_pSkillData"];
|
||||||
|
|
||||||
for (nlohmann::json::iterator _skills = skills.begin(); _skills != skills.end(); _skills++) {
|
for (json::iterator _skills = skills.begin(); _skills != skills.end(); _skills++) {
|
||||||
auto skills = _skills.value();
|
auto skills = _skills.value();
|
||||||
SkillData skillData = {skills["m_iSkillType"], skills["m_iTargetType"], skills["m_iBatteryDrainType"], skills["m_iEffectArea"]};
|
SkillData skillData = {skills["m_iSkillType"], skills["m_iTargetType"], skills["m_iBatteryDrainType"], skills["m_iEffectArea"]};
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
@ -856,9 +856,9 @@ void TableData::init() {
|
|||||||
std::cout << "[INFO] Loaded " << Nanos::SkillTable.size() << " nano skills" << std::endl;
|
std::cout << "[INFO] Loaded " << Nanos::SkillTable.size() << " nano skills" << std::endl;
|
||||||
|
|
||||||
// load EP data
|
// load EP data
|
||||||
nlohmann::json instances = xdtData["m_pInstanceTable"]["m_pInstanceData"];
|
json instances = xdtData["m_pInstanceTable"]["m_pInstanceData"];
|
||||||
|
|
||||||
for (nlohmann::json::iterator _instance = instances.begin(); _instance != instances.end(); _instance++) {
|
for (json::iterator _instance = instances.begin(); _instance != instances.end(); _instance++) {
|
||||||
auto instance = _instance.value();
|
auto instance = _instance.value();
|
||||||
EPInfo epInfo = {instance["m_iZoneX"], instance["m_iZoneY"], instance["m_iIsEP"], (int)instance["m_ScoreMax"]};
|
EPInfo epInfo = {instance["m_iZoneX"], instance["m_iZoneY"], instance["m_iIsEP"], (int)instance["m_ScoreMax"]};
|
||||||
Racing::EPData[instance["m_iInstanceNameID"]] = epInfo;
|
Racing::EPData[instance["m_iInstanceNameID"]] = epInfo;
|
||||||
@ -875,7 +875,7 @@ void TableData::init() {
|
|||||||
// load mobs
|
// load mobs
|
||||||
try {
|
try {
|
||||||
std::ifstream inFile(settings::MOBJSON);
|
std::ifstream inFile(settings::MOBJSON);
|
||||||
nlohmann::json npcData, groupData;
|
json npcData, groupData;
|
||||||
|
|
||||||
// read file into json
|
// read file into json
|
||||||
inFile >> npcData;
|
inFile >> npcData;
|
||||||
@ -883,7 +883,7 @@ void TableData::init() {
|
|||||||
npcData = npcData["mobs"];
|
npcData = npcData["mobs"];
|
||||||
|
|
||||||
// single mobs
|
// single mobs
|
||||||
for (nlohmann::json::iterator _npc = npcData.begin(); _npc != npcData.end(); _npc++) {
|
for (json::iterator _npc = npcData.begin(); _npc != npcData.end(); _npc++) {
|
||||||
auto npc = _npc.value();
|
auto npc = _npc.value();
|
||||||
auto td = NPCManager::NPCData[(int)npc["iNPCType"]];
|
auto td = NPCManager::NPCData[(int)npc["iNPCType"]];
|
||||||
uint64_t instanceID = npc.find("iMapNum") == npc.end() ? INSTANCE_OVERWORLD : (int)npc["iMapNum"];
|
uint64_t instanceID = npc.find("iMapNum") == npc.end() ? INSTANCE_OVERWORLD : (int)npc["iMapNum"];
|
||||||
@ -906,7 +906,7 @@ void TableData::init() {
|
|||||||
|
|
||||||
// mob groups
|
// mob groups
|
||||||
// single mobs
|
// single mobs
|
||||||
for (nlohmann::json::iterator _group = groupData.begin(); _group != groupData.end(); _group++) {
|
for (json::iterator _group = groupData.begin(); _group != groupData.end(); _group++) {
|
||||||
auto leader = _group.value();
|
auto leader = _group.value();
|
||||||
auto td = NPCManager::NPCData[(int)leader["iNPCType"]];
|
auto td = NPCManager::NPCData[(int)leader["iNPCType"]];
|
||||||
uint64_t instanceID = leader.find("iMapNum") == leader.end() ? INSTANCE_OVERWORLD : (int)leader["iMapNum"];
|
uint64_t instanceID = leader.find("iMapNum") == leader.end() ? INSTANCE_OVERWORLD : (int)leader["iMapNum"];
|
||||||
@ -932,7 +932,7 @@ void TableData::init() {
|
|||||||
|
|
||||||
if (followers.size() < 5) {
|
if (followers.size() < 5) {
|
||||||
int followerCount = 0;
|
int followerCount = 0;
|
||||||
for (nlohmann::json::iterator _fol = followers.begin(); _fol != followers.end(); _fol++) {
|
for (json::iterator _fol = followers.begin(); _fol != followers.end(); _fol++) {
|
||||||
auto follower = _fol.value();
|
auto follower = _fol.value();
|
||||||
auto tdFol = NPCManager::NPCData[(int)follower["iNPCType"]];
|
auto tdFol = NPCManager::NPCData[(int)follower["iNPCType"]];
|
||||||
Mob* tmpFol = new Mob((int)leader["iX"] + (int)follower["iOffsetX"], (int)leader["iY"] + (int)follower["iOffsetY"], leader["iZ"], leader["iAngle"], instanceID, follower["iNPCType"], tdFol, nextId);
|
Mob* tmpFol = new Mob((int)leader["iX"] + (int)follower["iOffsetX"], (int)leader["iY"] + (int)follower["iOffsetY"], leader["iZ"], leader["iAngle"], instanceID, follower["iNPCType"], tdFol, nextId);
|
||||||
@ -963,12 +963,12 @@ void TableData::init() {
|
|||||||
// load Academy NPCs from academy.json
|
// load Academy NPCs from academy.json
|
||||||
try {
|
try {
|
||||||
std::ifstream inFile(settings::ACADEMYJSON);
|
std::ifstream inFile(settings::ACADEMYJSON);
|
||||||
nlohmann::json npcData;
|
json npcData;
|
||||||
|
|
||||||
// read file into json
|
// read file into json
|
||||||
inFile >> npcData;
|
inFile >> npcData;
|
||||||
npcData = npcData["NPCs"];
|
npcData = npcData["NPCs"];
|
||||||
for (nlohmann::json::iterator _npc = npcData.begin(); _npc != npcData.end(); _npc++) {
|
for (json::iterator _npc = npcData.begin(); _npc != npcData.end(); _npc++) {
|
||||||
auto npc = _npc.value();
|
auto npc = _npc.value();
|
||||||
int instanceID = npc.find("iMapNum") == npc.end() ? INSTANCE_OVERWORLD : (int)npc["iMapNum"];
|
int instanceID = npc.find("iMapNum") == npc.end() ? INSTANCE_OVERWORLD : (int)npc["iMapNum"];
|
||||||
|
|
||||||
@ -1006,17 +1006,17 @@ void TableData::init() {
|
|||||||
// write gruntwork output to file
|
// write gruntwork output to file
|
||||||
void TableData::flush() {
|
void TableData::flush() {
|
||||||
std::ofstream file(settings::GRUNTWORKJSON);
|
std::ofstream file(settings::GRUNTWORKJSON);
|
||||||
nlohmann::json gruntwork;
|
json gruntwork;
|
||||||
|
|
||||||
for (auto& pair : RunningSkywayRoutes) {
|
for (auto& pair : RunningSkywayRoutes) {
|
||||||
nlohmann::json route;
|
json route;
|
||||||
|
|
||||||
route["iRouteID"] = (int)pair.first;
|
route["iRouteID"] = (int)pair.first;
|
||||||
route["iMonkeySpeed"] = 1500;
|
route["iMonkeySpeed"] = 1500;
|
||||||
|
|
||||||
std::cout << "serializing mss route " << (int)pair.first << std::endl;
|
std::cout << "serializing mss route " << (int)pair.first << std::endl;
|
||||||
for (WarpLocation& point : pair.second) {
|
for (WarpLocation& point : pair.second) {
|
||||||
nlohmann::json tmp;
|
json tmp;
|
||||||
|
|
||||||
tmp["x"] = point.x;
|
tmp["x"] = point.x;
|
||||||
tmp["y"] = point.y;
|
tmp["y"] = point.y;
|
||||||
@ -1029,7 +1029,7 @@ void TableData::flush() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (auto& pair : RunningNPCRotations) {
|
for (auto& pair : RunningNPCRotations) {
|
||||||
nlohmann::json rotation;
|
json rotation;
|
||||||
|
|
||||||
rotation["iNPCID"] = (int)pair.first;
|
rotation["iNPCID"] = (int)pair.first;
|
||||||
rotation["iAngle"] = pair.second;
|
rotation["iAngle"] = pair.second;
|
||||||
@ -1038,7 +1038,7 @@ void TableData::flush() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (auto& pair : RunningNPCMapNumbers) {
|
for (auto& pair : RunningNPCMapNumbers) {
|
||||||
nlohmann::json mapNumber;
|
json mapNumber;
|
||||||
|
|
||||||
mapNumber["iNPCID"] = (int)pair.first;
|
mapNumber["iNPCID"] = (int)pair.first;
|
||||||
mapNumber["iMapNum"] = pair.second;
|
mapNumber["iMapNum"] = pair.second;
|
||||||
@ -1047,7 +1047,7 @@ void TableData::flush() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (auto& pair : RunningMobs) {
|
for (auto& pair : RunningMobs) {
|
||||||
nlohmann::json mob;
|
json mob;
|
||||||
BaseNPC *npc = pair.second;
|
BaseNPC *npc = pair.second;
|
||||||
|
|
||||||
if (NPCManager::NPCs.find(pair.first) == NPCManager::NPCs.end())
|
if (NPCManager::NPCs.find(pair.first) == NPCManager::NPCs.end())
|
||||||
@ -1079,7 +1079,7 @@ void TableData::flush() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (auto& pair : RunningGroups) {
|
for (auto& pair : RunningGroups) {
|
||||||
nlohmann::json mob;
|
json mob;
|
||||||
BaseNPC* npc = pair.second;
|
BaseNPC* npc = pair.second;
|
||||||
|
|
||||||
if (NPCManager::NPCs.find(pair.first) == NPCManager::NPCs.end())
|
if (NPCManager::NPCs.find(pair.first) == NPCManager::NPCs.end())
|
||||||
@ -1127,7 +1127,7 @@ void TableData::flush() {
|
|||||||
followers.pop_back(); // remove from vector
|
followers.pop_back(); // remove from vector
|
||||||
|
|
||||||
// populate JSON entry
|
// populate JSON entry
|
||||||
nlohmann::json fol;
|
json fol;
|
||||||
fol["iNPCType"] = follower->appearanceData.iNPCType;
|
fol["iNPCType"] = follower->appearanceData.iNPCType;
|
||||||
fol["iOffsetX"] = follower->offsetX;
|
fol["iOffsetX"] = follower->offsetX;
|
||||||
fol["iOffsetY"] = follower->offsetY;
|
fol["iOffsetY"] = follower->offsetY;
|
||||||
@ -1140,7 +1140,7 @@ void TableData::flush() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (auto& pair : RunningEggs) {
|
for (auto& pair : RunningEggs) {
|
||||||
nlohmann::json egg;
|
json egg;
|
||||||
BaseNPC* npc = pair.second;
|
BaseNPC* npc = pair.second;
|
||||||
|
|
||||||
if (NPCManager::NPCs.find(pair.first) == NPCManager::NPCs.end())
|
if (NPCManager::NPCs.find(pair.first) == NPCManager::NPCs.end())
|
||||||
|
@ -3,6 +3,9 @@
|
|||||||
|
|
||||||
#include "NPCManager.hpp"
|
#include "NPCManager.hpp"
|
||||||
|
|
||||||
|
// typedef for JSON object because I don't want to type nlohmann::json every time
|
||||||
|
typedef nlohmann::json json;
|
||||||
|
|
||||||
namespace TableData {
|
namespace TableData {
|
||||||
extern std::map<int32_t, std::vector<WarpLocation>> RunningSkywayRoutes;
|
extern std::map<int32_t, std::vector<WarpLocation>> RunningSkywayRoutes;
|
||||||
extern std::map<int32_t, int> RunningNPCRotations;
|
extern std::map<int32_t, int> RunningNPCRotations;
|
||||||
|
Loading…
Reference in New Issue
Block a user