add functionalities to automatically discard completed points with already regenerated resources

This commit is contained in:
mksudo 2022-12-10 17:05:19 -08:00
parent d826673a16
commit f6c6cd87c8
6 changed files with 166 additions and 1 deletions

View File

@ -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" ]
}
]
}

View File

@ -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" ]
}
]
}

View File

@ -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" ]
}
]
}

View File

@ -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" ]
}
]
}

View File

@ -1088,8 +1088,23 @@ namespace cheat::feature
return;
}
auto complete_timestamp = data["complete_timestamp"].get<int64_t>();
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<std::string>())
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<std::string>())] = 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()

View File

@ -133,6 +133,7 @@ namespace cheat::feature
std::map<uint32_t, LabelData> labels;
std::map<std::string, LabelData*> nameToLabel;
std::vector<CategoryData> categories;
std::map<uint32_t, int64_t> 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