Init archipelago data, place different AP item types
This commit is contained in:
@@ -170,7 +170,7 @@ typedef struct ShipBossRushSaveContextData {
|
|||||||
} ShipBossRushSaveContextData;
|
} ShipBossRushSaveContextData;
|
||||||
|
|
||||||
typedef struct ArchipelagoLocationData {
|
typedef struct ArchipelagoLocationData {
|
||||||
u8 itemType;
|
s8 itemType;
|
||||||
char itemName[100];
|
char itemName[100];
|
||||||
char locationName[100];
|
char locationName[100];
|
||||||
char playerName[17];
|
char playerName[17];
|
||||||
|
|||||||
@@ -484,8 +484,8 @@ void Context::ParseItemLocationsJson(nlohmann::json spoilerFileJson) {
|
|||||||
void Context::ParseArchipelagoItemsLocations(const std::vector<ArchipelagoClient::ApItem>& scouted_items) {
|
void Context::ParseArchipelagoItemsLocations(const std::vector<ArchipelagoClient::ApItem>& scouted_items) {
|
||||||
const std::string SlotName = ArchipelagoClient::GetInstance().GetSlotName();
|
const std::string SlotName = ArchipelagoClient::GetInstance().GetSlotName();
|
||||||
|
|
||||||
// Zero out the item table first
|
// Zero out the location table first
|
||||||
for(int rc = 1; rc <= RC_MAX; rc++) {
|
for(int rc = 1; rc < RC_MAX; rc++) {
|
||||||
itemLocationTable[rc].SetPlacedItem(RG_NONE);
|
itemLocationTable[rc].SetPlacedItem(RG_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -497,15 +497,20 @@ void Context::ParseArchipelagoItemsLocations(const std::vector<ArchipelagoClient
|
|||||||
// our item
|
// our item
|
||||||
SPDLOG_TRACE("Populated item {} at location {}", ap_item.itemName, ap_item.locationName);
|
SPDLOG_TRACE("Populated item {} at location {}", ap_item.itemName, ap_item.locationName);
|
||||||
const RandomizerGet item = StaticData::itemNameToEnum[ap_item.itemName];
|
const RandomizerGet item = StaticData::itemNameToEnum[ap_item.itemName];
|
||||||
//const RandomizerGet item = StaticData::APitemToSoh.find(ap_item.itemName)->second;
|
|
||||||
itemLocationTable[rc].SetPlacedItem(item);
|
itemLocationTable[rc].SetPlacedItem(item);
|
||||||
} else {
|
} else {
|
||||||
// other player item
|
// other player item
|
||||||
itemLocationTable[rc].SetPlacedItem(RG_ARCHIPELAGO_ITEM_USEFUL);
|
switch (ap_item.flags) {
|
||||||
// i'll have to figure out custom names at some point, this currently does nothing
|
case 0:
|
||||||
//overrides[rc] = ItemOverride(rc, RG_DEKU_NUTS_5);
|
itemLocationTable[rc].SetPlacedItem(RG_ARCHIPELAGO_ITEM_JUNK);
|
||||||
//std::string getText = ap_item.playerName + "'s " + ap_item.itemName;
|
break;
|
||||||
//overrides[rc].SetTrickName(Text(getText, getText, getText));
|
case 1:
|
||||||
|
itemLocationTable[rc].SetPlacedItem(RG_ARCHIPELAGO_ITEM_PROGRESSIVE);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
itemLocationTable[rc].SetPlacedItem(RG_ARCHIPELAGO_ITEM_USEFUL);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5540,12 +5540,9 @@ void Randomizer::CreateCustomMessages() {
|
|||||||
GIMESSAGE(RG_DEKU_NUT_BAG, ITEM_NUT, "You found the %rDeku Nut Bag%w!&You can now hold Deku Nuts!",
|
GIMESSAGE(RG_DEKU_NUT_BAG, ITEM_NUT, "You found the %rDeku Nut Bag%w!&You can now hold Deku Nuts!",
|
||||||
"Du hast eine %rDeku-Nuß-Tasche%w&gefunden! Nun kannst Du &%yDeku-Nüsse%w halten!",
|
"Du hast eine %rDeku-Nuß-Tasche%w&gefunden! Nun kannst Du &%yDeku-Nüsse%w halten!",
|
||||||
"Vous avez trouvé le %rSac de Noix& Mojo%w!&Vous pouvez maintenant porter des&Noix Mojo!"),
|
"Vous avez trouvé le %rSac de Noix& Mojo%w!&Vous pouvez maintenant porter des&Noix Mojo!"),
|
||||||
GIMESSAGE_NO_GERMAN(RG_ARCHIPELAGO_ITEM_USEFUL, ITEM_BEAN, "You found an useful %rAP_ITEM%w!",
|
GIMESSAGE_UNTRANSLATED(RG_ARCHIPELAGO_ITEM_USEFUL, ITEM_NUT, "You found an useful %gAP Item%w!"),
|
||||||
"Needs French Translation"),
|
GIMESSAGE_UNTRANSLATED(RG_ARCHIPELAGO_ITEM_JUNK, ITEM_NUT, "You found a junk %gAP Item%w!"),
|
||||||
GIMESSAGE_NO_GERMAN(RG_ARCHIPELAGO_ITEM_JUNK, ITEM_BEAN, "You found a junk %rAP_ITEM%w!",
|
GIMESSAGE_UNTRANSLATED(RG_ARCHIPELAGO_ITEM_PROGRESSIVE, ITEM_NUT, "You found a progressive %gAP Item%w!"),
|
||||||
"Needs French Translation"),
|
|
||||||
GIMESSAGE_NO_GERMAN(RG_ARCHIPELAGO_ITEM_PROGRESSIVE, ITEM_BEAN, "You found a progressive %rAP_ITEM%w!",
|
|
||||||
"Needs French Translation"),
|
|
||||||
} };
|
} };
|
||||||
CreateGetItemMessages(getItemMessages);
|
CreateGetItemMessages(getItemMessages);
|
||||||
CreateRupeeMessages();
|
CreateRupeeMessages();
|
||||||
|
|||||||
@@ -114,21 +114,20 @@ bool ArchipelagoClient::IsConnected() {
|
|||||||
return apClient->get_state() == APClient::State::SLOT_CONNECTED;
|
return apClient->get_state() == APClient::State::SLOT_CONNECTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArchipelagoClient::CheckLocation(RandomizerCheck SoH_check_id) {
|
void ArchipelagoClient::CheckLocation(RandomizerCheck sohCheckId) {
|
||||||
//std::string_view ap_name = Rando::StaticData::SohCheckToAP[SoH_check_id];
|
std::string apName = Rando::StaticData::GetLocation(sohCheckId)->GetName();
|
||||||
std::string ap_name = Rando::StaticData::GetLocation(SoH_check_id)->GetName();
|
if (apName.empty()) {
|
||||||
if(ap_name.empty()) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int64_t ap_item_id = apClient->get_location_id(std::string(ap_name));
|
int64_t apItemId = apClient->get_location_id(std::string(apName));
|
||||||
std::string logMessage = "[LOG] Checked: " + ap_name + "(" + std::to_string(ap_item_id) + "), sending to AP server";
|
|
||||||
|
std::string logMessage = "[LOG] Checked: " + apName + "(" + std::to_string(apItemId) + "), sending to AP server";
|
||||||
ArchipelagoConsole_SendMessage(logMessage.c_str());
|
ArchipelagoConsole_SendMessage(logMessage.c_str());
|
||||||
|
|
||||||
// currently not sending, because i only get so many real chances
|
|
||||||
if(!IsConnected()) {
|
if(!IsConnected()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
apClient->LocationChecks({ap_item_id});
|
apClient->LocationChecks({ apItemId });
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArchipelagoClient::AddItemRecievedCallback(std::function<void(const std::string&)> callback) {
|
void ArchipelagoClient::AddItemRecievedCallback(std::function<void(const std::string&)> callback) {
|
||||||
@@ -204,6 +203,26 @@ const char* ArchipelagoClient::GetConnectionStatus() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" void Archipelago_InitSaveFile() {
|
||||||
|
gSaveContext.ship.quest.data.archipelago.isArchipelago = 1;
|
||||||
|
|
||||||
|
std::vector<ArchipelagoClient::ApItem> scoutedItems = ArchipelagoClient::GetInstance().GetScoutedItems();
|
||||||
|
|
||||||
|
for (uint32_t i = 0; i < scoutedItems.size(); i++) {
|
||||||
|
RandomizerCheck rc = Rando::StaticData::locationNameToEnum[scoutedItems[i].locationName];
|
||||||
|
gSaveContext.ship.quest.data.archipelago.locations[rc].itemType = scoutedItems[i].flags;
|
||||||
|
|
||||||
|
SohUtils::CopyStringToCharArray(gSaveContext.ship.quest.data.archipelago.locations[rc].itemName,
|
||||||
|
scoutedItems[i].itemName,
|
||||||
|
ARRAY_COUNT(gSaveContext.ship.quest.data.archipelago.locations[rc].itemName));
|
||||||
|
SohUtils::CopyStringToCharArray(gSaveContext.ship.quest.data.archipelago.locations[rc].locationName,
|
||||||
|
scoutedItems[i].locationName,
|
||||||
|
ARRAY_COUNT(gSaveContext.ship.quest.data.archipelago.locations[rc].locationName));
|
||||||
|
SohUtils::CopyStringToCharArray(gSaveContext.ship.quest.data.archipelago.locations[rc].playerName,
|
||||||
|
scoutedItems[i].playerName,
|
||||||
|
ARRAY_COUNT(gSaveContext.ship.quest.data.archipelago.locations[rc].playerName));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void LoadArchipelagoData() {
|
void LoadArchipelagoData() {
|
||||||
SaveManager::Instance->LoadData("isArchipelago", gSaveContext.ship.quest.data.archipelago.isArchipelago);
|
SaveManager::Instance->LoadData("isArchipelago", gSaveContext.ship.quest.data.archipelago.isArchipelago);
|
||||||
@@ -271,8 +290,8 @@ void InitArchipelagoData(bool isDebug) {
|
|||||||
SohUtils::CopyStringToCharArray(gSaveContext.ship.quest.data.archipelago.slotName, "",
|
SohUtils::CopyStringToCharArray(gSaveContext.ship.quest.data.archipelago.slotName, "",
|
||||||
ARRAY_COUNT(gSaveContext.ship.quest.data.archipelago.slotName));
|
ARRAY_COUNT(gSaveContext.ship.quest.data.archipelago.slotName));
|
||||||
|
|
||||||
for (uint32_t i; i < ARRAY_COUNT(gSaveContext.ship.quest.data.archipelago.locations); i++) {
|
for (uint32_t i = 0; i < ARRAY_COUNT(gSaveContext.ship.quest.data.archipelago.locations); i++) {
|
||||||
gSaveContext.ship.quest.data.archipelago.locations[i].itemType = 0;
|
gSaveContext.ship.quest.data.archipelago.locations[i].itemType = -1;
|
||||||
|
|
||||||
SohUtils::CopyStringToCharArray(gSaveContext.ship.quest.data.archipelago.locations[i].itemName, "",
|
SohUtils::CopyStringToCharArray(gSaveContext.ship.quest.data.archipelago.locations[i].itemName, "",
|
||||||
ARRAY_COUNT(gSaveContext.ship.quest.data.archipelago.locations[i].itemName));
|
ARRAY_COUNT(gSaveContext.ship.quest.data.archipelago.locations[i].itemName));
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
#ifdef __cplusplus
|
||||||
#include "soh/Enhancements/randomizer/randomizerTypes.h"
|
#include "soh/Enhancements/randomizer/randomizerTypes.h"
|
||||||
#include "soh/Enhancements/randomizer/static_data.h"
|
#include "soh/Enhancements/randomizer/static_data.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@@ -83,3 +84,9 @@ class ArchipelagoClient{
|
|||||||
void LoadArchipelagoData();
|
void LoadArchipelagoData();
|
||||||
void SaveArchipelagoData(SaveContext* saveContext, int sectionID, bool fullSave);
|
void SaveArchipelagoData(SaveContext* saveContext, int sectionID, bool fullSave);
|
||||||
void InitArchipelagoData(bool isDebug);
|
void InitArchipelagoData(bool isDebug);
|
||||||
|
extern "C" {
|
||||||
|
#endif // END __cplusplus
|
||||||
|
void Archipelago_InitSaveFile();
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
#include "soh/OTRGlobals.h"
|
#include "soh/OTRGlobals.h"
|
||||||
#include "soh/SaveManager.h"
|
#include "soh/SaveManager.h"
|
||||||
#include "soh/ResourceManagerHelpers.h"
|
#include "soh/ResourceManagerHelpers.h"
|
||||||
|
#include "soh/Network/Archipelago/Archipelago.h"
|
||||||
|
|
||||||
#define NUM_DUNGEONS 8
|
#define NUM_DUNGEONS 8
|
||||||
#define NUM_COWS 10
|
#define NUM_COWS 10
|
||||||
@@ -261,10 +262,19 @@ void Sram_InitSave(FileChooseContext* fileChooseCtx) {
|
|||||||
|
|
||||||
u8 currentQuest = fileChooseCtx->questType[fileChooseCtx->buttonIndex];
|
u8 currentQuest = fileChooseCtx->questType[fileChooseCtx->buttonIndex];
|
||||||
|
|
||||||
if (currentQuest == QUEST_RANDOMIZER && (Randomizer_IsSeedGenerated() || Randomizer_IsSpoilerLoaded())) {
|
// Temporary
|
||||||
|
if (CVarGetInteger(CVAR_REMOTE_ARCHIPELAGO("Connected"), 0)) {
|
||||||
|
currentQuest = QUEST_ARCHIPELAGO;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((currentQuest == QUEST_RANDOMIZER && (Randomizer_IsSeedGenerated() || Randomizer_IsSpoilerLoaded())) ||
|
||||||
|
currentQuest == QUEST_ARCHIPELAGO) {
|
||||||
gSaveContext.ship.quest.id = QUEST_RANDOMIZER;
|
gSaveContext.ship.quest.id = QUEST_RANDOMIZER;
|
||||||
|
|
||||||
Randomizer_InitSaveFile();
|
Randomizer_InitSaveFile();
|
||||||
|
if (currentQuest == QUEST_ARCHIPELAGO) {
|
||||||
|
Archipelago_InitSaveFile();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
gSaveContext.ship.quest.id = currentQuest;
|
gSaveContext.ship.quest.id = currentQuest;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user