about summary refs log tree commit diff stats
path: root/src/ap_state.cpp
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2024-05-15 12:11:00 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2024-05-15 12:11:00 -0400
commit3151ac6274e796f54f2d9269186f1fd2e69f90c3 (patch)
treebd23ebbef27a5ae53a0f548e4366db53e7b7de0b /src/ap_state.cpp
parenta5a6c1b8b902c960f8204f8d814ce579dfd5fa50 (diff)
downloadlingo-ap-tracker-3151ac6274e796f54f2d9269186f1fd2e69f90c3.tar.gz
lingo-ap-tracker-3151ac6274e796f54f2d9269186f1fd2e69f90c3.tar.bz2
lingo-ap-tracker-3151ac6274e796f54f2d9269186f1fd2e69f90c3.zip
Get checked paintings from server
Diffstat (limited to 'src/ap_state.cpp')
-rw-r--r--src/ap_state.cpp24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/ap_state.cpp b/src/ap_state.cpp index e5ff74d..68a6902 100644 --- a/src/ap_state.cpp +++ b/src/ap_state.cpp
@@ -103,6 +103,7 @@ struct APState {
103 } 103 }
104 104
105 tracked_data_storage_keys.push_back("PlayerPos"); 105 tracked_data_storage_keys.push_back("PlayerPos");
106 tracked_data_storage_keys.push_back("Paintings");
106 107
107 initialized = true; 108 initialized = true;
108 } 109 }
@@ -384,6 +385,14 @@ struct APState {
384 } 385 }
385 386
386 wxLogMessage("Data storage %s retrieved as null", key); 387 wxLogMessage("Data storage %s retrieved as null", key);
388 } else if (value.is_array()) {
389 if (key.ends_with("Paintings")) {
390 data_storage[key] = value.get<std::set<std::string>>();
391 } else {
392 data_storage[key] = value.get<std::vector<std::string>>();
393 }
394
395 wxLogMessage("Data storage %s retrieved as list", key);
387 } 396 }
388 } 397 }
389 398
@@ -406,6 +415,15 @@ struct APState {
406 return data_storage.count(key) && std::any_cast<bool>(data_storage.at(key)); 415 return data_storage.count(key) && std::any_cast<bool>(data_storage.at(key));
407 } 416 }
408 417
418 const std::set<std::string>& GetCheckedPaintings() {
419 std::string key = data_storage_prefix + "Paintings";
420 if (!data_storage.count(key)) {
421 data_storage[key] = std::set<std::string>();
422 }
423
424 return std::any_cast<const std::set<std::string>&>(data_storage.at(key));
425 }
426
409 void RefreshTracker(bool reset) { 427 void RefreshTracker(bool reset) {
410 wxLogMessage("Refreshing display..."); 428 wxLogMessage("Refreshing display...");
411 429
@@ -471,10 +489,14 @@ bool AP_IsColorShuffle() { return GetState().color_shuffle; }
471 489
472bool AP_IsPaintingShuffle() { return GetState().painting_shuffle; } 490bool AP_IsPaintingShuffle() { return GetState().painting_shuffle; }
473 491
474const std::map<std::string, std::string> AP_GetPaintingMapping() { 492const std::map<std::string, std::string>& AP_GetPaintingMapping() {
475 return GetState().painting_mapping; 493 return GetState().painting_mapping;
476} 494}
477 495
496const std::set<std::string>& AP_GetCheckedPaintings() {
497 return GetState().GetCheckedPaintings();
498}
499
478int AP_GetMasteryRequirement() { return GetState().mastery_requirement; } 500int AP_GetMasteryRequirement() { return GetState().mastery_requirement; }
479 501
480int AP_GetLevel2Requirement() { return GetState().level_2_requirement; } 502int AP_GetLevel2Requirement() { return GetState().level_2_requirement; }