From a2e7b21155a6423adffd21287a97aafa45c8138d Mon Sep 17 00:00:00 2001 From: Jerom Venneker Date: Fri, 30 May 2025 20:18:07 +0200 Subject: [PATCH 1/5] Fixed quote typo --- soh/soh/Network/Archipelago/Archipelago.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soh/soh/Network/Archipelago/Archipelago.cpp b/soh/soh/Network/Archipelago/Archipelago.cpp index 9b28a81ee..3efc029c3 100644 --- a/soh/soh/Network/Archipelago/Archipelago.cpp +++ b/soh/soh/Network/Archipelago/Archipelago.cpp @@ -345,7 +345,7 @@ void ArchipelagoClient::SendGameWon() { void ArchipelagoClient::SendMessageToConsole(const std::string message) { // local commands not implemented yet if(message.starts_with("/")) { - ArchipelagoConsole_SendMessage("Ship of Harkinian does not have any local commands yet.\nUse !help\" to see server commands instead", false); + ArchipelagoConsole_SendMessage("Ship of Harkinian does not have any local commands yet.\nUse \"!help\" to see server commands instead", false); return; } From b6990d92bfca5b584d50c9e7c1ff562b685f7e5f Mon Sep 17 00:00:00 2001 From: Jerom Venneker Date: Mon, 2 Jun 2025 19:17:13 +0200 Subject: [PATCH 2/5] Added Rounded corners to text entry field --- soh/soh/Network/Archipelago/ArchipelagoConsoleWindow.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/soh/soh/Network/Archipelago/ArchipelagoConsoleWindow.cpp b/soh/soh/Network/Archipelago/ArchipelagoConsoleWindow.cpp index d8cad457d..021495e53 100644 --- a/soh/soh/Network/Archipelago/ArchipelagoConsoleWindow.cpp +++ b/soh/soh/Network/Archipelago/ArchipelagoConsoleWindow.cpp @@ -64,8 +64,7 @@ void ArchipelagoConsoleWindow::DrawElement() { } } ImGui::EndChild(); - ImGui::PopStyleColor(); - ImGui::PopStyleVar(3); + ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 8.0f); static char textEntryBuf[1024]; static bool keepFocus = false; @@ -86,6 +85,10 @@ void ArchipelagoConsoleWindow::DrawElement() { textEntryBuf[0] = '\0'; keepFocus = true; } + + + ImGui::PopStyleColor(); + ImGui::PopStyleVar(4); }; ImVec4 getColorVal(const std::string& color) { // TODO change color strings to an enum From 53d6374c6ccf77f5704cea6429c9267cf3059315 Mon Sep 17 00:00:00 2001 From: Jerom Venneker Date: Mon, 2 Jun 2025 19:19:13 +0200 Subject: [PATCH 3/5] Fixed issue where client crashes when collecting item while offline --- soh/soh/Network/Archipelago/Archipelago.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/soh/soh/Network/Archipelago/Archipelago.cpp b/soh/soh/Network/Archipelago/Archipelago.cpp index 3efc029c3..4b9abb94f 100644 --- a/soh/soh/Network/Archipelago/Archipelago.cpp +++ b/soh/soh/Network/Archipelago/Archipelago.cpp @@ -278,6 +278,10 @@ void ArchipelagoClient::QueueExternalCheck(const int64_t apLocation) { } bool ArchipelagoClient::IsConnected() { + if(apClient == nullptr) { + return false; + } + return apClient->get_state() == APClient::State::SLOT_CONNECTED; } @@ -287,6 +291,10 @@ void ArchipelagoClient::CheckLocation(RandomizerCheck sohCheckId) { return; } + if(!IsConnected()) { + return; + } + std::string apName = Rando::StaticData::GetLocation(sohCheckId)->GetName(); if (apName.empty()) { return; @@ -296,9 +304,6 @@ void ArchipelagoClient::CheckLocation(RandomizerCheck sohCheckId) { std::string logMessage = "[LOG] Checked: " + apName + "(" + std::to_string(apItemId) + "), sending to AP server"; ArchipelagoConsole_SendMessage(logMessage.c_str(), true); - if(!IsConnected()) { - return; - } apClient->LocationChecks({ apItemId }); } From 5e821ca6415fc79bb922454629a7f9aeafb6136e Mon Sep 17 00:00:00 2001 From: Jerom Venneker Date: Mon, 2 Jun 2025 20:21:17 +0200 Subject: [PATCH 4/5] Fixed items from other games not scouting and recieving right --- soh/soh/Network/Archipelago/Archipelago.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/soh/soh/Network/Archipelago/Archipelago.cpp b/soh/soh/Network/Archipelago/Archipelago.cpp index 4b9abb94f..87b101162 100644 --- a/soh/soh/Network/Archipelago/Archipelago.cpp +++ b/soh/soh/Network/Archipelago/Archipelago.cpp @@ -83,7 +83,7 @@ bool ArchipelagoClient::StartClient() { 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.itemName = apClient->get_item_name(item.item, AP_Client_consts::AP_GAME_NAME); apItem.locationName = apClient->get_location_name(item.location, game); apItem.playerName = apClient->get_player_alias(item.player); apItem.flags = item.flags; @@ -103,7 +103,7 @@ bool ArchipelagoClient::StartClient() { 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.locationName = apClient->get_location_name(item.location, AP_Client_consts::AP_GAME_NAME); apItem.playerName = apClient->get_player_alias(item.player); apItem.flags = item.flags; apItem.index = item.index; From fb0bf1be450ecc61a76df284a279487a8974093a Mon Sep 17 00:00:00 2001 From: Jerom Venneker Date: Wed, 4 Jun 2025 21:03:34 +0200 Subject: [PATCH 5/5] Added setting of flags when externaly checking --- .../Enhancements/randomizer/hook_handlers.cpp | 51 ++++++++++++++++++- .../Archipelago/ArchipelagoSettingsWindow.cpp | 3 ++ 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/soh/soh/Enhancements/randomizer/hook_handlers.cpp b/soh/soh/Enhancements/randomizer/hook_handlers.cpp index 56c4bd0e9..72772e267 100644 --- a/soh/soh/Enhancements/randomizer/hook_handlers.cpp +++ b/soh/soh/Enhancements/randomizer/hook_handlers.cpp @@ -287,7 +287,56 @@ void RandomizerOnSceneFlagSetHandler(int16_t sceneNum, int16_t flagType, int16_t } void RandomizerOnExternalCheckHandler(uint32_t randomizerCheck) { - randomizerQueuedChecks.push(static_cast(randomizerCheck)); + RandomizerCheck rc = static_cast(randomizerCheck); + Rando::Location* loc = Rando::StaticData::GetLocation(rc); + s32 flagID = loc->GetCollectionCheck().flag; + SceneID scene = loc->GetScene(); + + bool inSameArea = false; + if(gPlayState != nullptr) { + inSameArea = scene == gPlayState->sceneNum; + } + + std::string logMessage = ""; + + switch(loc->GetCollectionCheck().type) { + case SPOILER_CHK_CHEST: + if(inSameArea) { + Flags_SetTreasure(gPlayState, flagID); + } else { + gSaveContext.sceneFlags[scene].chest |= 1 << flagID; + randomizerQueuedChecks.push(rc); + } + break; + case SPOILER_CHK_COLLECTABLE: + if(inSameArea) { + Flags_SetCollectible(gPlayState, flagID); + } else { + gSaveContext.sceneFlags[scene].collect |= 1 << flagID; + randomizerQueuedChecks.push(rc); + } + break; + case SPOILER_CHK_RANDOMIZER_INF: + Flags_SetRandomizerInf(static_cast(flagID)); + case SPOILER_CHK_EVENT_CHK_INF: + Flags_SetEventChkInf(flagID); + break; + case SPOILER_CHK_ITEM_GET_INF: + Flags_SetItemGetInf(flagID); + break; + case SPOILER_CHK_INF_TABLE: + Flags_SetInfTable(flagID); + break; + case SPOILER_CHK_GOLD_SKULLTULA: + logMessage = "[LOG] Externaly checked golden skultulla: " + std::to_string(loc->GetActorParams()) + ", " + std::to_string(flagID); + ArchipelagoConsole_SendMessage(logMessage.c_str(), true); + SET_GS_FLAGS((flagID & 0x1F00) >> 8, flagID & 0xFF); + break; + case SPOILER_CHK_GRAVEDIGGER: //This enum is used nowhere in code, so i'll leave it as nothing for now + case SPOILER_CHK_NONE: + // do Nothing + break; + } } static Vec3f spawnPos = { 0.0f, -999.0f, 0.0f }; diff --git a/soh/soh/Network/Archipelago/ArchipelagoSettingsWindow.cpp b/soh/soh/Network/Archipelago/ArchipelagoSettingsWindow.cpp index b2d7524f1..ed850b188 100644 --- a/soh/soh/Network/Archipelago/ArchipelagoSettingsWindow.cpp +++ b/soh/soh/Network/Archipelago/ArchipelagoSettingsWindow.cpp @@ -76,6 +76,9 @@ void ArchipelagoSettingsWindow::DrawElement() { UIWidgets::ButtonOptions().Color(THEME_COLOR).Size(ImVec2(0.0, 0.0)))) { ArchipelagoClient::GetInstance().SendGameWon(); } + if (UIWidgets::Button("Get Mido br chest", UIWidgets::ButtonOptions().Color(THEME_COLOR).Size(ImVec2(0.0, 0.0)))) { + ArchipelagoClient::GetInstance().QueueExternalCheck(16711707); + } } static bool sArchipelagoTexturesLoaded = false;