From 3151ac6274e796f54f2d9269186f1fd2e69f90c3 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Wed, 15 May 2024 12:11:00 -0400 Subject: Get checked paintings from server --- src/ap_state.cpp | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'src/ap_state.cpp') 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 { } tracked_data_storage_keys.push_back("PlayerPos"); + tracked_data_storage_keys.push_back("Paintings"); initialized = true; } @@ -384,6 +385,14 @@ struct APState { } wxLogMessage("Data storage %s retrieved as null", key); + } else if (value.is_array()) { + if (key.ends_with("Paintings")) { + data_storage[key] = value.get>(); + } else { + data_storage[key] = value.get>(); + } + + wxLogMessage("Data storage %s retrieved as list", key); } } @@ -406,6 +415,15 @@ struct APState { return data_storage.count(key) && std::any_cast(data_storage.at(key)); } + const std::set& GetCheckedPaintings() { + std::string key = data_storage_prefix + "Paintings"; + if (!data_storage.count(key)) { + data_storage[key] = std::set(); + } + + return std::any_cast&>(data_storage.at(key)); + } + void RefreshTracker(bool reset) { wxLogMessage("Refreshing display..."); @@ -471,10 +489,14 @@ bool AP_IsColorShuffle() { return GetState().color_shuffle; } bool AP_IsPaintingShuffle() { return GetState().painting_shuffle; } -const std::map AP_GetPaintingMapping() { +const std::map& AP_GetPaintingMapping() { return GetState().painting_mapping; } +const std::set& AP_GetCheckedPaintings() { + return GetState().GetCheckedPaintings(); +} + int AP_GetMasteryRequirement() { return GetState().mastery_requirement; } int AP_GetLevel2Requirement() { return GetState().level_2_requirement; } -- cgit 1.4.1