mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2025-12-24 12:50:05 +00:00
implemented basic eggs functionality
This commit is contained in:
@@ -223,6 +223,8 @@ void TableData::init() {
|
||||
|
||||
loadDrops();
|
||||
|
||||
loadEggs();
|
||||
|
||||
loadPaths(&nextId); // load paths
|
||||
|
||||
loadGruntwork(&nextId);
|
||||
@@ -433,6 +435,35 @@ void TableData::loadDrops() {
|
||||
}
|
||||
}
|
||||
|
||||
void TableData::loadEggs() {
|
||||
try {
|
||||
std::ifstream inFile(settings::EGGSJSON);
|
||||
nlohmann::json eggData;
|
||||
|
||||
// read file into json
|
||||
inFile >> eggData;
|
||||
|
||||
// EggTypes
|
||||
nlohmann::json eggTypes = eggData["EggTypes"];
|
||||
for (nlohmann::json::iterator _eggType = eggTypes.begin(); _eggType != eggTypes.end(); _eggType++) {
|
||||
auto eggType = _eggType.value();
|
||||
EggType toAdd = {};
|
||||
toAdd.dropCrateId = (int)eggType["DropCrateId"];
|
||||
toAdd.effectId = (int)eggType["EffectId"];
|
||||
toAdd.duration = (int)eggType["Duration"];
|
||||
toAdd.regen= (int)eggType["Regen"];
|
||||
NPCManager::EggTypes[(int)eggType["Id"]] = toAdd;
|
||||
}
|
||||
|
||||
std::cout << "[INFO] Loaded Egg Data" <<std::endl;
|
||||
|
||||
}
|
||||
catch (const std::exception& err) {
|
||||
std::cerr << "[FATAL] Malformed eggs.json file! Reason:" << err.what() << std::endl;
|
||||
terminate(0);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Create a full and properly-paced path by interpolating between keyframes.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user