diff --git a/src/RacingManager.cpp b/src/RacingManager.cpp index 80e64ca..267c832 100644 --- a/src/RacingManager.cpp +++ b/src/RacingManager.cpp @@ -2,7 +2,11 @@ #include "CNStructs.hpp" #include "RacingManager.hpp" +std::map RacingManager::EPData; + void RacingManager::init() { - + //REGISTER_SHARD_PACKET(P_CL2FE_REQ_EP_RACE_START, racingStart); } + + diff --git a/src/RacingManager.hpp b/src/RacingManager.hpp index 63651fc..40999ec 100644 --- a/src/RacingManager.hpp +++ b/src/RacingManager.hpp @@ -2,8 +2,13 @@ #include "CNShardServer.hpp" +struct EPInfo { + int zoneX, zoneY, EPID, maxScore; +}; + namespace RacingManager { + extern std::map EPData; + void init(); - } diff --git a/src/TableData.cpp b/src/TableData.cpp index 94f6b07..48033be 100644 --- a/src/TableData.cpp +++ b/src/TableData.cpp @@ -7,6 +7,7 @@ #include "MobManager.hpp" #include "ChunkManager.hpp" #include "NanoManager.hpp" +#include "RacingManager.hpp" #include "contrib/JSON.hpp" @@ -228,6 +229,17 @@ void TableData::init() { std::cout << "[INFO] Loaded " << NanoManager::SkillTable.size() << " nano skills" << std::endl; + // load EP data + nlohmann::json instances = xdtData["m_pInstanceTable"]["m_pInstanceData"]; + + for (nlohmann::json::iterator _instance = instances.begin(); _instance != instances.end(); _instance++) { + auto instance = _instance.value(); + EPInfo epInfo = {instance["m_iZoneX"], instance["m_iZoneY"], instance["m_iIsEP"], (int)instance["m_ScoreMax"]}; + RacingManager::EPData[instance["m_iInstanceNameID"]] = epInfo; + } + + std::cout << "[INFO] Loaded " << RacingManager::EPData.size() << " instances" << std::endl; + } catch (const std::exception& err) { std::cerr << "[FATAL] Malformed xdt.json file! Reason:" << err.what() << std::endl;