diff --git a/cheat-library/res/map_enkanomiya.json b/cheat-library/res/map_enkanomiya.json index f06a5a9..3db977c 100644 --- a/cheat-library/res/map_enkanomiya.json +++ b/cheat-library/res/map_enkanomiya.json @@ -9151,5 +9151,31 @@ 424 ] } + ], + "regenerates": [ + { + "hours": 12, + "categories": [ "Animals", "Materials", "Enemies (Common)" ], + "exclude": [ "61", "62", "63" ], + "include": [] + }, + { + "hours": 24, + "categories": [ "Enemies (Elite)", "Investigation" ], + "exclude": [], + "include": [ "172" ] + }, + { + "hours": 48, + "categories": [ "Local Specialties" ], + "exclude": [], + "include": [ "61", "62", "63", "15", "139" ] + }, + { + "hours": 72, + "categories": [ "Fishing" ], + "exclude": [], + "include": [ "16", "80", "202" ] + } ] } \ No newline at end of file diff --git a/cheat-library/res/map_golden_apple_archipelago.json b/cheat-library/res/map_golden_apple_archipelago.json index de1b21a..e6d3d68 100644 --- a/cheat-library/res/map_golden_apple_archipelago.json +++ b/cheat-library/res/map_golden_apple_archipelago.json @@ -2047,5 +2047,31 @@ 351 ] } + ], + "regenerates": [ + { + "hours": 12, + "categories": [ "Animals", "Materials", "Enemies (Common)" ], + "exclude": [ "61", "62", "63" ], + "include": [] + }, + { + "hours": 24, + "categories": [ "Enemies (Elite)", "Investigation" ], + "exclude": [], + "include": [ "172" ] + }, + { + "hours": 48, + "categories": [ "Local Specialties" ], + "exclude": [], + "include": [ "61", "62", "63", "15", "139" ] + }, + { + "hours": 72, + "categories": [ "Fishing" ], + "exclude": [], + "include": [ "16", "80", "202" ] + } ] } \ No newline at end of file diff --git a/cheat-library/res/map_teyvat.json b/cheat-library/res/map_teyvat.json index c5887f4..ad3b4d2 100644 --- a/cheat-library/res/map_teyvat.json +++ b/cheat-library/res/map_teyvat.json @@ -135764,5 +135764,31 @@ 424 ] } + ], + "regenerates": [ + { + "hours": 12, + "categories": [ "Animals", "Materials", "Enemies (Common)" ], + "exclude": [ "61", "62", "63" ], + "include": [] + }, + { + "hours": 24, + "categories": [ "Enemies (Elite)", "Investigation" ], + "exclude": [], + "include": [ "172" ] + }, + { + "hours": 48, + "categories": [ "Local Specialties" ], + "exclude": [], + "include": [ "61", "62", "63", "15", "139" ] + }, + { + "hours": 72, + "categories": [ "Fishing" ], + "exclude": [], + "include": [ "16", "80", "202" ] + } ] } \ No newline at end of file diff --git a/cheat-library/res/map_undeground_mines.json b/cheat-library/res/map_undeground_mines.json index 367e006..6eb9f5d 100644 --- a/cheat-library/res/map_undeground_mines.json +++ b/cheat-library/res/map_undeground_mines.json @@ -5896,5 +5896,31 @@ 424 ] } + ], + "regenerates": [ + { + "hours": 12, + "categories": [ "Animals", "Materials", "Enemies (Common)" ], + "exclude": [ "61", "62", "63" ], + "include": [] + }, + { + "hours": 24, + "categories": [ "Enemies (Elite)", "Investigation" ], + "exclude": [], + "include": [ "172" ] + }, + { + "hours": 48, + "categories": [ "Local Specialties" ], + "exclude": [], + "include": [ "61", "62", "63", "15", "139" ] + }, + { + "hours": 72, + "categories": [ "Fishing" ], + "exclude": [], + "include": [ "16", "80", "202" ] + } ] } \ No newline at end of file diff --git a/cheat-library/src/user/cheat/imap/InteractiveMap.cpp b/cheat-library/src/user/cheat/imap/InteractiveMap.cpp index 9b255e8..0ea8337 100644 --- a/cheat-library/src/user/cheat/imap/InteractiveMap.cpp +++ b/cheat-library/src/user/cheat/imap/InteractiveMap.cpp @@ -1088,8 +1088,23 @@ namespace cheat::feature return; } + auto complete_timestamp = data["complete_timestamp"].get(); + + auto current_timestamp = util::GetCurrentTimeMillisec(); + + auto& scene = m_ScenesData[labelData->sceneID]; + if (scene.regenerateTime.count(labelData->id) > 0) + { + auto regenerateTime = scene.regenerateTime[labelData->id]; + + // do not load complete point if resource is regenerated + if (complete_timestamp + regenerateTime <= current_timestamp) { + return; + } + } + point.completed = true; - point.completeTimestamp = data["complete_timestamp"]; + point.completeTimestamp = complete_timestamp; labelData->completedCount++; m_CompletedPoints.push_back(&point); @@ -1366,6 +1381,48 @@ namespace cheat::feature newCategory.name = data["name"]; } + void InteractiveMap::LoadRegenrateTimeData(const nlohmann::json& data, uint32_t sceneID) + { + auto& sceneData = m_ScenesData[sceneID]; + auto& labels = sceneData.labels; + auto& categories = sceneData.categories; + + auto& regenerateTime = sceneData.regenerateTime; + + for (auto& regenerateData : data) { + int64_t regenerateTimeInMS = regenerateData["hours"] * 60 * 60 * 1000; + + auto& regenerateCatogories = regenerateData["categories"]; + auto& regenerateInclude = regenerateData["include"]; + auto& regenerateExclude = regenerateData["exclude"]; + + for (auto& regenerateCategory : regenerateCatogories) + { + for (auto& category : categories) + { + if (category.name != regenerateCategory.get()) + continue; + + auto& categoryChildren = category.children; + + for (auto& childLable : categoryChildren) + { + if (regenerateExclude.find(childLable->id) == regenerateExclude.end()) + { + regenerateTime[childLable->id] = regenerateTimeInMS; + } + } + + break; + } + } + + for (auto& includeLabelID : regenerateInclude) { + regenerateTime[std::stoi(includeLabelID.get())] = regenerateTimeInMS; + } + } + } + void InteractiveMap::LoadSceneData(const nlohmann::json& data, uint32_t sceneID) { for (auto& [labelID, labelData] : data["labels"].items()) @@ -1377,6 +1434,8 @@ namespace cheat::feature { LoadCategoriaData(categorie, sceneID); } + + LoadRegenrateTimeData(data["regenerates"], sceneID); } void InteractiveMap::LoadScenesData() diff --git a/cheat-library/src/user/cheat/imap/InteractiveMap.h b/cheat-library/src/user/cheat/imap/InteractiveMap.h index 1751b51..089b137 100644 --- a/cheat-library/src/user/cheat/imap/InteractiveMap.h +++ b/cheat-library/src/user/cheat/imap/InteractiveMap.h @@ -133,6 +133,7 @@ namespace cheat::feature std::map labels; std::map nameToLabel; std::vector categories; + std::map regenerateTime; }; struct MaterialData @@ -183,6 +184,7 @@ namespace cheat::feature void LoadLabelData(const nlohmann::json& data, uint32_t sceneID, uint32_t labelID); void LoadCategoriaData(const nlohmann::json& data, uint32_t sceneID); void LoadSceneData(const nlohmann::json& data, uint32_t sceneID); + void LoadRegenrateTimeData(const nlohmann::json& data, uint32_t sceneID); void LoadScenesData(); // Parsing ascension materials data