Replaced APCpp library with APClientpp, project builds but doesn't work yet

This commit is contained in:
Jerom Venneker
2025-05-11 21:47:29 +02:00
parent f8ecb68404
commit a0696518b1
11 changed files with 227 additions and 182 deletions

1
APCpp

Submodule APCpp deleted from 505a174a3b

View File

@@ -96,10 +96,6 @@ if (NOT TARGET ZAPDLib)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../ZAPDTR/ZAPD ${CMAKE_BINARY_DIR}/ZAPD)
endif()
if (NOT TARGET APCpp)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../APCpp ${CMAKE_BINARY_DIR}/APCpp)
endif()
set(PROJECT_NAME soh)
################################################################################
@@ -344,7 +340,6 @@ target_include_directories(${PROJECT_NAME} PRIVATE assets
${SDL2-INCLUDE}
${SDL2-NET-INCLUDE}
${CMAKE_CURRENT_SOURCE_DIR}/assets/
${CMAKE_CURRENT_SOURCE_DIR}/../APCpp
.
)
@@ -628,9 +623,6 @@ endif()
add_dependencies(${PROJECT_NAME}
libultraship
)
add_dependencies(${PROJECT_NAME}
APCpp
)
if(NOT CMAKE_SYSTEM_NAME MATCHES "NintendoSwitch|CafeOS")
add_dependencies(${PROJECT_NAME}
ZAPDLib
@@ -643,7 +635,6 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
set(ADDITIONAL_LIBRARY_DEPENDENCIES
"libultraship;"
"ZAPDLib;"
"APCpp;"
"glu32;"
"SDL2::SDL2;"
"SDL2::SDL2main;"
@@ -658,7 +649,6 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
set(ADDITIONAL_LIBRARY_DEPENDENCIES
"libultraship;"
"ZAPDLib;"
"APCpp;"
"glu32;"
"SDL2::SDL2;"
"SDL2::SDL2main;"
@@ -697,7 +687,6 @@ else()
set(ADDITIONAL_LIBRARY_DEPENDENCIES
"libultraship;"
"ZAPDLib;"
"APCpp"
SDL2::SDL2
"$<$<BOOL:${BUILD_REMOTE_CONTROL}>:SDL2_net::SDL2_net>"
${CMAKE_DL_LIBS}

View File

@@ -1,6 +1,8 @@
#include "archipelago.h"
#include "soh/UIWidgets.hpp"
#include "soh/SohGui/UIWidgets.hpp"
#include "soh/util.h"
#include <apuuid.hpp>
#include <apclient.hpp>
#include <fstream>
#include <filesystem>
@@ -35,6 +37,8 @@ auto SubscribeToSlotData() {
}
ArchipelagoClient::ArchipelagoClient() {
std::string uuid = ap_get_uuid("uuid");
ItemRecievedCallback = nullptr;
game_won = false;
@@ -54,117 +58,89 @@ void ArchipelagoClient::add_slot_data(std::string_view key, int id) {
slot_data.insert(std::pair<std::string_view, int>(key, id));
}
void registerSlotCallbacks() {
SubscribeToSlotData<"open_forest">();
SubscribeToSlotData<"open_kakoriko">();
SubscribeToSlotData<"open_door_of_time">();
SubscribeToSlotData<"zora_fountain">();
SubscribeToSlotData<"gerudo_fortress">();
SubscribeToSlotData<"bridge">();
SubscribeToSlotData<"bridge_stones">();
SubscribeToSlotData<"bridge_medallions">();
SubscribeToSlotData<"bridge_rewards">();
SubscribeToSlotData<"bridge_tokens">();
// SubscribeToSlotData<"bridge_hearts">();
SubscribeToSlotData<"shuffle_ganon_bosskey">();
SubscribeToSlotData<"ganon_bosskey_medallions">();
SubscribeToSlotData<"ganon_bosskey_stones">();
SubscribeToSlotData<"ganon_bosskey_rewards">();
SubscribeToSlotData<"ganon_bosskey_tokens">();
// SubscribeToSlotData<"ganon_bosskey_hearts">();
SubscribeToSlotData<"trials">();
SubscribeToSlotData<"triforce_hunt">();
SubscribeToSlotData<"triforce_goal">();
// SubscribeToSlotData<"extra_triforce_percentage">();
// SubscribeToSlotData<"shopsanity">();
// SubscribeToSlotData<"shop_slots">();
SubscribeToSlotData<"shopsanity_prices">();
// SubscribeToSlotData<"tokensanity">();
// SubscribeToSlotData<"dungeon_shortcuts">();
// SubscribeToSlotData<"mq_dungeons_mode">();
// SubscribeToSlotData<"mq_dungeons_count">();
// SubscribeToSlotData<"shuffle_interior_entrances">();
// SubscribeToSlotData<"shuffle_grotto_entrances">();
// SubscribeToSlotData<"shuffle_dungeon_entrances">();
// SubscribeToSlotData<"shuffle_overworld_entrances">();
// SubscribeToSlotData<"shuffle_bosses">();
// SubscribeToSlotData<"key_rings">();
// SubscribeToSlotData<"enhance_map_compass">();
// SubscribeToSlotData<"shuffle_mapcompass">();
// SubscribeToSlotData<"shuffle_smallkeys">();
// SubscribeToSlotData<"shuffle_hideoutkeys">();
// SubscribeToSlotData<"shuffle_bosskeys">();
// SubscribeToSlotData<"logic_rules">();
// SubscribeToSlotData<"logic_no_night_tokens_without_suns_song">();
// SubscribeToSlotData<"warp_songs">();
// SubscribeToSlotData<"shuffle_song_items">();
// SubscribeToSlotData<"shuffle_medigoron_carpet_salesman">();
// SubscribeToSlotData<"shuffle_frog_song_rupees">();
// SubscribeToSlotData<"shuffle_scrubs">();
// SubscribeToSlotData<"shuffle_child_trade">();
// SubscribeToSlotData<"shuffle_freestanding_items">();
// SubscribeToSlotData<"shuffle_pots">();
// SubscribeToSlotData<"shuffle_crates">();
// SubscribeToSlotData<"shuffle_cows">();
// SubscribeToSlotData<"shuffle_beehives">();
// SubscribeToSlotData<"shuffle_kokiri_sword">();
// SubscribeToSlotData<"shuffle_ocarinas">();
// SubscribeToSlotData<"shuffle_gerudo_card">();
// SubscribeToSlotData<"shuffle_beans">();
SubscribeToSlotData<"starting_age">();
// SubscribeToSlotData<"bombchus_in_logic">();
// SubscribeToSlotData<"spawn_positions">();
// SubscribeToSlotData<"owl_drops">();
SubscribeToSlotData<"no_epona_race">();
// SubscribeToSlotData<"skip_some_minigame_phases">();
SubscribeToSlotData<"complete_mask_quest">();
SubscribeToSlotData<"free_scarecrow">();
// SubscribeToSlotData<"plant_beans">();
SubscribeToSlotData<"chicken_count">();
SubscribeToSlotData<"big_poe_count">();
// SubscribeToSlotData<"fae_torch_count">();
SubscribeToSlotData<"blue_fire_arrows">();
SubscribeToSlotData<"damage_multiplier">();
// SubscribeToSlotData<"deadly_bonks">();
// SubscribeToSlotData<"starting_tod">();
// SubscribeToSlotData<"junk_ice_traps">();
SubscribeToSlotData<"start_with_consumables">();
// SubscribeToSlotData<"adult_trade_start">();
}
//void registerSlotCallbacks() {
// SubscribeToSlotData<"open_forest">();
// SubscribeToSlotData<"open_kakoriko">();
// SubscribeToSlotData<"open_door_of_time">();
// SubscribeToSlotData<"zora_fountain">();
// SubscribeToSlotData<"gerudo_fortress">();
// SubscribeToSlotData<"bridge">();
// SubscribeToSlotData<"bridge_stones">();
// SubscribeToSlotData<"bridge_medallions">();
// SubscribeToSlotData<"bridge_rewards">();
// SubscribeToSlotData<"bridge_tokens">();
//// SubscribeToSlotData<"bridge_hearts">();
// SubscribeToSlotData<"shuffle_ganon_bosskey">();
// SubscribeToSlotData<"ganon_bosskey_medallions">();
// SubscribeToSlotData<"ganon_bosskey_stones">();
// SubscribeToSlotData<"ganon_bosskey_rewards">();
// SubscribeToSlotData<"ganon_bosskey_tokens">();
//// SubscribeToSlotData<"ganon_bosskey_hearts">();
// SubscribeToSlotData<"trials">();
// SubscribeToSlotData<"triforce_hunt">();
// SubscribeToSlotData<"triforce_goal">();
//// SubscribeToSlotData<"extra_triforce_percentage">();
//// SubscribeToSlotData<"shopsanity">();
//// SubscribeToSlotData<"shop_slots">();
// SubscribeToSlotData<"shopsanity_prices">();
//// SubscribeToSlotData<"tokensanity">();
//// SubscribeToSlotData<"dungeon_shortcuts">();
//// SubscribeToSlotData<"mq_dungeons_mode">();
//// SubscribeToSlotData<"mq_dungeons_count">();
//// SubscribeToSlotData<"shuffle_interior_entrances">();
//// SubscribeToSlotData<"shuffle_grotto_entrances">();
//// SubscribeToSlotData<"shuffle_dungeon_entrances">();
//// SubscribeToSlotData<"shuffle_overworld_entrances">();
//// SubscribeToSlotData<"shuffle_bosses">();
//// SubscribeToSlotData<"key_rings">();
//// SubscribeToSlotData<"enhance_map_compass">();
//// SubscribeToSlotData<"shuffle_mapcompass">();
//// SubscribeToSlotData<"shuffle_smallkeys">();
//// SubscribeToSlotData<"shuffle_hideoutkeys">();
//// SubscribeToSlotData<"shuffle_bosskeys">();
//// SubscribeToSlotData<"logic_rules">();
//// SubscribeToSlotData<"logic_no_night_tokens_without_suns_song">();
//// SubscribeToSlotData<"warp_songs">();
//// SubscribeToSlotData<"shuffle_song_items">();
//// SubscribeToSlotData<"shuffle_medigoron_carpet_salesman">();
//// SubscribeToSlotData<"shuffle_frog_song_rupees">();
//// SubscribeToSlotData<"shuffle_scrubs">();
//// SubscribeToSlotData<"shuffle_child_trade">();
//// SubscribeToSlotData<"shuffle_freestanding_items">();
//// SubscribeToSlotData<"shuffle_pots">();
//// SubscribeToSlotData<"shuffle_crates">();
//// SubscribeToSlotData<"shuffle_cows">();
//// SubscribeToSlotData<"shuffle_beehives">();
//// SubscribeToSlotData<"shuffle_kokiri_sword">();
//// SubscribeToSlotData<"shuffle_ocarinas">();
//// SubscribeToSlotData<"shuffle_gerudo_card">();
//// SubscribeToSlotData<"shuffle_beans">();
// SubscribeToSlotData<"starting_age">();
//// SubscribeToSlotData<"bombchus_in_logic">();
//// SubscribeToSlotData<"spawn_positions">();
//// SubscribeToSlotData<"owl_drops">();
// SubscribeToSlotData<"no_epona_race">();
//// SubscribeToSlotData<"skip_some_minigame_phases">();
// SubscribeToSlotData<"complete_mask_quest">();
// SubscribeToSlotData<"free_scarecrow">();
//// SubscribeToSlotData<"plant_beans">();
// SubscribeToSlotData<"chicken_count">();
// SubscribeToSlotData<"big_poe_count">();
//// SubscribeToSlotData<"fae_torch_count">();
// SubscribeToSlotData<"blue_fire_arrows">();
// SubscribeToSlotData<"damage_multiplier">();
//// SubscribeToSlotData<"deadly_bonks">();
//// SubscribeToSlotData<"starting_tod">();
//// SubscribeToSlotData<"junk_ice_traps">();
// SubscribeToSlotData<"start_with_consumables">();
//// SubscribeToSlotData<"adult_trade_start">();
//}
bool ArchipelagoClient::start_client() {
switch(AP_GetConnectionStatus()) {
case AP_ConnectionStatus::ConnectionRefused:
SPDLOG_TRACE("refused");
break;
case AP_ConnectionStatus::Authenticated:
SPDLOG_TRACE("Authenticated");
break;
case AP_ConnectionStatus::Connected:
SPDLOG_TRACE("Connected");
break;
case AP_ConnectionStatus::Disconnected:
SPDLOG_TRACE("Disconnected");
break;
}
if(AP_GetConnectionStatus() != AP_ConnectionStatus::Disconnected) {
SPDLOG_TRACE("AP already connected, shutting it down");
AP_Shutdown();
}
AP_Init(server_address, "Ocarina of Time", slot_name, password);
//AP_SetClientConnectedCallback(&ArchipelagoClient::on_connected); // currently broken :(
//AP_SetClientCouldntConnectCallback(5, &ArchipelagoClient::on_couldntConnect);
AP_SetItemClearCallback(&ArchipelagoClient::on_clear_items);
AP_SetItemRecvCallback(&ArchipelagoClient::on_item_recieved);
AP_SetLocationCheckedCallback(&ArchipelagoClient::on_location_checked);
AP_SetLocationInfoCallback(&ArchipelagoClient::on_location_scouted);
registerSlotCallbacks();
AP_Start();
AP_ConnectionStatus conn_status = AP_GetConnectionStatus();
//switch(conn_status) {
//switch(AP_GetConnectionStatus()) {
// case AP_ConnectionStatus::ConnectionRefused:
// SPDLOG_TRACE("refused");
// break;
// case AP_ConnectionStatus::Authenticated:
// SPDLOG_TRACE("Authenticated");
// break;
@@ -175,12 +151,71 @@ bool ArchipelagoClient::start_client() {
// SPDLOG_TRACE("Disconnected");
// break;
//}
//if(AP_GetConnectionStatus() != AP_ConnectionStatus::Disconnected) {
// SPDLOG_TRACE("AP already connected, shutting it down");
// AP_Shutdown();
//}
if(apclient != NULL) {
apclient.reset();
}
apclient = std::unique_ptr<APClient>(new APClient(uuid, AP_Client_consts::AP_GAME_NAME, server_address));
apclient->set_room_info_handler([&]() {
std::list<std::string> tags;
// tags.push_back("DeathLink"); // todo, implement deathlink
apclient->ConnectSlot(slot_name, password, 0b001, tags);
});
apclient->set_items_received_handler([&](const std::list<APClient::NetworkItem>& items) {
for(const APClient::NetworkItem& item : items) {
on_item_recieved(item.item, false); // todo get rid of notify, since it doesn't work for us right now anyway
}
});
apclient->set_location_info_handler([&](const std::list<APClient::NetworkItem>& items) {
scouted_items.clear();
for(const APClient::NetworkItem& item: items) {
ApItem apItem;
const std::string game = apclient->get_player_game(item.player);
apItem.itemName = apclient->get_item_name(item.item, game);
apItem.locationName = apclient->get_location_name(item.location, game);
apItem.playerName = apclient->get_player_alias(item.player);
apItem.flags = item.flags;
apItem.index = item.index;
scouted_items.push_back(apItem);
const std::string itemName = apItem.itemName;
const std::string playerName = apItem.playerName;
const std::string locationName = apItem.locationName;
SPDLOG_TRACE("Location scouted: {} for {} in location {}", itemName, playerName, locationName);
}
}); // todo maybe move these functions to a lambda, since they don't have to be static anymore
apclient->set_location_checked_handler([&](const std::list<int64_t> locations) {
// todo implement me
});
//apclient.set_slot_connected_handler() // todo rewrite the old slot callbacks when i'm ready to read slot data again
//registerSlotCallbacks();
//AP_Start();
//AP_ConnectionStatus conn_status = AP_GetConnectionStatus();
save_data();
return conn_status == AP_ConnectionStatus::Connected;
//return conn_status == AP_ConnectionStatus::Connected;
return true;
}
void ArchipelagoClient::start_location_scouts() {
AP_SendLocationScouts(AP_GetAllLocations(), false);
std::set<int64_t> location_set = apclient->get_missing_locations();
std::list<int64_t> missing_location_list;
for(const int64_t loc_id : location_set) {
missing_location_list.emplace_back(loc_id);
}
apclient->LocationScouts(missing_location_list);
}
void ArchipelagoClient::save_data() {
@@ -189,7 +224,7 @@ void ArchipelagoClient::save_data() {
}
bool ArchipelagoClient::isConnected() {
return AP_GetConnectionStatus() == AP_ConnectionStatus::Authenticated;
return apclient->get_state() == APClient::State::SLOT_CONNECTED;
}
void ArchipelagoClient::check_location(RandomizerCheck SoH_check_id) {
@@ -197,14 +232,14 @@ void ArchipelagoClient::check_location(RandomizerCheck SoH_check_id) {
if(ap_name.empty()) {
return;
}
int64_t ap_item_id = CheckNameToId(std::string(ap_name));
int64_t ap_item_id = apclient->get_location_id(std::string(ap_name));
SPDLOG_TRACE("Checked: {}({}), sending to AP server", ap_name, ap_item_id);
// currently not sending, because i only get so many real chances
if(!isConnected()) {
return;
}
AP_SendItem(ap_item_id);
apclient->LocationChecks({ap_item_id});
}
void ArchipelagoClient::addItemRecievedCallback(std::function<void(const std::string&)> callback) {
@@ -219,18 +254,13 @@ void ArchipelagoClient::on_connected() {
// todo implement me
SPDLOG_TRACE("AP Connected!!");
}
void ArchipelagoClient::on_couldntConnect(AP_ConnectionStatus connection_status) {
// todo implement me
}
void ArchipelagoClient::on_clear_items() {
// todo implement me
}
//void ArchipelagoClient::on_couldntConnect(AP_ConnectionStatus connection_status) {
// // todo implement me
//}
void ArchipelagoClient::on_item_recieved(int64_t recieved_item_id, bool notify_player) {
// call each callback
std::string item_name = getAPitemName(recieved_item_id);
const std::string item_name = apclient->get_item_name(recieved_item_id, "Ocarina of Time");
ArchipelagoClient& ap_client = ArchipelagoClient::getInstance();
if(ap_client.ItemRecievedCallback) {
SPDLOG_TRACE("item recieved: {}, notify: {}", item_name, notify_player);
@@ -238,24 +268,21 @@ void ArchipelagoClient::on_item_recieved(int64_t recieved_item_id, bool notify_p
}
}
void ArchipelagoClient::on_location_checked(int64_t location_id) {
// todo implement me
}
void ArchipelagoClient::on_location_scouted(std::vector<AP_NetworkItem> network_items) {
for(const AP_NetworkItem& item: network_items) {
SPDLOG_TRACE("Location scouted: {} for {} in location {}", item.itemName, item.playerName, item.locationName);
}
getInstance().scouted_items = network_items;
}
void ArchipelagoClient::send_game_won() {
if(!game_won) {
AP_StoryComplete();
apclient->StatusUpdate(APClient::ClientStatus::GOAL);
game_won = true;
}
}
const std::string& ArchipelagoClient::get_slot_name() const {
if(apclient == NULL) {
return;
}
return apclient->get_slot();
}
char* ArchipelagoClient::get_server_address_buff() {
return server_address;
}
@@ -270,7 +297,7 @@ const std::map<std::string, int>& ArchipelagoClient::get_slot_data() {
return slot_data;
}
const std::vector<AP_NetworkItem>& ArchipelagoClient::get_scouted_items() {
const std::vector<ArchipelagoClient::ApItem>& ArchipelagoClient::get_scouted_items() {
return scouted_items;
}
@@ -289,15 +316,15 @@ void ArchipelagoWindow::ArchipelagoDrawConnectPage() {
ImGui::SameLine();
ImGui::Text(connected_text);
AP_ConnectionStatus con_status = AP_GetConnectionStatus();
if(con_status == AP_ConnectionStatus::Connected) {
strncpy(connected_text, "Connected!", 25);
} else if(con_status == AP_ConnectionStatus::Authenticated) {
strncpy(connected_text, "Authenticated!", 25);
}
else {
strncpy(connected_text, "Not Connected", 25);
}
//ArchipelagoDrawConnectPageAP_ConnectionStatus con_status = AP_GetConnectionStatus();
//if(con_status == AP_ConnectionStatus::Connected) {
// strncpy(connected_text, "Connected!", 25);
//} else if(con_status == AP_ConnectionStatus::Authenticated) {
// strncpy(connected_text, "Authenticated!", 25);
//}
//else {
// strncpy(connected_text, "Not Connected", 25);
//}
if(ImGui::Button("scout")) {
AP_client.start_location_scouts();

View File

@@ -1,5 +1,7 @@
#pragma once
#include "archipelago_settings_window.h"
#include "../../../../APCpp/Archipelago.h"
#include <apclient.hpp>
#include "fixed_string.hpp"
@@ -16,10 +18,20 @@ namespace AP_Client_consts {
static constexpr char const* SETTING_ADDRESS = "AP_server_address";
static constexpr char const* SETTING_NAME = "AP_slot_name";
};
static constexpr char const* AP_GAME_NAME = "Ocarina of Time";
}
class ArchipelagoClient{
public:
struct ApItem {
std::string itemName;
std::string locationName;
std::string playerName;
unsigned int flags;
int index;
};
static ArchipelagoClient& getInstance();
bool start_client();
@@ -28,11 +40,13 @@ class ArchipelagoClient {
void start_location_scouts();
// getters
const std::string& get_slot_name() const;
char* get_server_address_buff();
char* get_slot_name_buff();
char* get_password_buff();
const std::map<std::string, int>& get_slot_data();
const std::vector<AP_NetworkItem>& get_scouted_items();
const std::vector<ApItem>& get_scouted_items();
void add_slot_data(std::string_view key, int id);
@@ -47,7 +61,7 @@ class ArchipelagoClient {
// todo move me back down when done testing
static void on_item_recieved(int64_t recieved_item_id, bool notify_player);
void on_item_recieved(int64_t recieved_item_id, bool notify_player);
void send_game_won();
@@ -57,7 +71,10 @@ class ArchipelagoClient {
private:
ArchipelagoClient(ArchipelagoClient &) = delete;
void operator=(const ArchipelagoClient &) = delete;
static std::shared_ptr<ArchipelagoClient> instance;
std::string uuid;
std::unique_ptr<APClient> apclient;
static std::shared_ptr<ArchipelagoClient> instance; // is this even used?
static bool initialized;
char server_address[AP_Client_consts::MAX_ADDRESS_LENGTH];
@@ -68,20 +85,19 @@ class ArchipelagoClient {
std::map<std::string, int> slot_data;
std::set<int64_t> locations;
std::vector<AP_NetworkItem> scouted_items;
std::vector<ApItem> scouted_items;
//void registerSlotCallbacks();
void save_data();
// callback functions
static void on_connected();
static void on_couldntConnect(AP_ConnectionStatus connection_status);
static void on_clear_items();
void on_connected();
//void on_couldntConnect(AP_ConnectionStatus connection_status);
static void on_location_checked(int64_t location_id);
static void on_deathlink_recieved() { }; // TODO: implement me
static void on_location_scouted(std::vector<AP_NetworkItem> network_items);
void on_location_checked(int64_t location_id);
void on_deathlink_recieved() { }; // TODO: implement me
void on_location_scouted(const std::list<APClient::NetworkItem>& network_items);
// callbacks
std::function<void(const std::string&)> ItemRecievedCallback;

View File

@@ -13,7 +13,6 @@
#include "3drando/hints.hpp"
#include "../kaleido.h"
#include "archipelago.h"
#include "Archipelago.h"
#include <fstream>
#include <spdlog/spdlog.h>
@@ -481,22 +480,22 @@ void Context::ParseItemLocationsJson(nlohmann::json spoilerFileJson) {
}
}
void Context::ParseArchipelagoItemsLocations(const std::vector<AP_NetworkItem>& scouted_items) {
int playerId = AP_GetPlayerID(); // todo change me when the client is developed further
void Context::ParseArchipelagoItemsLocations(const std::vector<ArchipelagoClient::ApItem>& scouted_items) {
const std::string SlotName = ArchipelagoClient::getInstance().get_slot_name();
// init the item table with regular items first
for(int rc = 1; rc <= RC_MAX; rc++) {
itemLocationTable[rc].SetPlacedItem(StaticData::GetLocation(static_cast<RandomizerCheck>(rc))->GetVanillaItem());
}
for(const AP_NetworkItem& ap_item: scouted_items) {
for(const ArchipelagoClient::ApItem& ap_item: scouted_items) {
const RandomizerCheck rc = StaticData::APcheckToSoh.find(ap_item.locationName)->second;
if(rc == RC_KF_MIDOS_TOP_RIGHT_CHEST) {
continue;
}
if(playerId == ap_item.player) {
if(SlotName == ap_item.playerName) {
// our item
SPDLOG_TRACE("Populated item {} at location {}", ap_item.itemName, ap_item.locationName);
const RandomizerGet item = StaticData::APitemToSoh.find(ap_item.itemName)->second;

View File

@@ -8,14 +8,13 @@
#include "hint.h"
#include "fishsanity.h"
#include "trial.h"
#include "archipelago.h"
#include <memory>
#include <array>
#include <map>
#include <nlohmann/json.hpp>
// forward declarations
struct AP_NetworkItem;
/**
* @brief Singleton for storing and accessing dynamic Randomizer-related data
@@ -128,7 +127,7 @@ class Context {
void ParseArchipelago();
void ParseArchipelagoSettings(const std::map<std::string, int>& slot_data);
void ParseArchipelagoItemsLocations(const std::vector<AP_NetworkItem>& slot_data);
void ParseArchipelagoItemsLocations(const std::vector<ArchipelagoClient::ApItem>& slot_data);
/**
* @brief Get the hash for the current seed.

View File

@@ -222,10 +222,10 @@ static std::queue<RandomizerCheck> randomizerQueuedChecks;
static RandomizerCheck randomizerQueuedCheck = RC_UNKNOWN_CHECK;
static GetItemEntry randomizerQueuedItemEntry = GET_ITEM_NONE;
void ArchipelagoOnRecieveItem(const std::string& ap_item_id) {
SPDLOG_TRACE("Recieve item handler called! {}", ap_item_id);
void ArchipelagoOnRecieveItem(const std::string& ap_item_name) {
SPDLOG_TRACE("Recieve item handler called! {}", ap_item_name);
randomizerQueuedChecks.push(RC_ARCHIPELAGO_RECIEVED_ITEM);
Rando::Context::GetInstance()->AddRecievedArchipelagoItem(ap_item_id);
Rando::Context::GetInstance()->AddRecievedArchipelagoItem(ap_item_name);
}
void RandomizerOnFlagSetHandler(int16_t flagType, int16_t flag) {

View File

@@ -94,6 +94,7 @@ std::shared_ptr<ItemTrackerSettingsWindow> mItemTrackerSettingsWindow;
std::shared_ptr<ItemTrackerWindow> mItemTrackerWindow;
std::shared_ptr<TimeSplitWindow> mTimeSplitWindow;
std::shared_ptr<PlandomizerWindow> mPlandomizerWindow;
std::shared_ptr<ArchipelagoWindow> mArchipelagoWindow;
std::shared_ptr<RandomizerSettingsWindow> mRandomizerSettingsWindow;
std::shared_ptr<SohModalWindow> mModalWindow;
std::shared_ptr<Notification::Window> mNotificationWindow;
@@ -195,6 +196,9 @@ void SetupGuiElements() {
mPlandomizerWindow =
std::make_shared<PlandomizerWindow>(CVAR_WINDOW("PlandomizerEditor"), "Plandomizer Editor", ImVec2(850, 760));
gui->AddGuiWindow(mPlandomizerWindow);
mArchipelagoWindow =
std::make_shared<ArchipelagoWindow>(CVAR_WINDOW("ArchipelagoWindow"), "Archipelago", ImVec2(850, 760));
gui->AddGuiWindow(mArchipelagoWindow);
mModalWindow = std::make_shared<SohModalWindow>(CVAR_WINDOW("ModalWindow"), "Modal Window");
gui->AddGuiWindow(mModalWindow);
mModalWindow->Show();
@@ -237,6 +241,7 @@ void Destroy() {
mInputViewerSettings = nullptr;
mTimeSplitWindow = nullptr;
mPlandomizerWindow = nullptr;
mArchipelagoWindow = nullptr;
mTimeDisplayWindow = nullptr;
}

View File

@@ -29,6 +29,7 @@
#include "soh/Enhancements/randomizer/randomizer_settings_window.h"
#include "soh/Enhancements/timesplits/TimeSplits.h"
#include "soh/Enhancements/randomizer/Plandomizer.h"
#include "soh/Enhancements/randomizer/archipelago.h"
#include "SohModals.h"
namespace SohGui {

View File

@@ -41,6 +41,7 @@
#include "soh/Enhancements/enemyrandomizer.h"
#include "soh/Enhancements/timesplits/TimeSplits.h"
#include "soh/Enhancements/randomizer/Plandomizer.h"
#include "soh/Enhancements/randomizer/archipelago.h"
#include "soh/Enhancements/TimeDisplay/TimeDisplay.h"
// FA icons are kind of wonky, if they worked how I expected them to the "+ 2.0f" wouldn't be needed, but

View File

@@ -100,6 +100,15 @@ void SohMenu::AddMenuRandomizer() {
.WindowName("Plandomizer Editor")
.Options(WindowButtonOptions().Tooltip("Enables the separate Randomizer Settings Window."));
// Archipelago
path.sidebarName = "Archipelago";
AddSidebarEntry("Randomizer", path.sidebarName, 1);
AddWidget(path, "Popout Archipelago Development Window", WIDGET_WINDOW_BUTTON)
.CVar(CVAR_WINDOW("ArchipelagoWindow"))
.RaceDisable(false)
.WindowName("Archipelago Development")
.Options(WindowButtonOptions().Tooltip("Enables the Archipelago development Window."));
// Item Tracker
path.sidebarName = "Item Tracker";
AddSidebarEntry("Randomizer", path.sidebarName, 1);