Init archipelago data, place different AP item types
This commit is contained in:
@@ -170,7 +170,7 @@ typedef struct ShipBossRushSaveContextData {
|
||||
} ShipBossRushSaveContextData;
|
||||
|
||||
typedef struct ArchipelagoLocationData {
|
||||
u8 itemType;
|
||||
s8 itemType;
|
||||
char itemName[100];
|
||||
char locationName[100];
|
||||
char playerName[17];
|
||||
|
||||
@@ -484,8 +484,8 @@ void Context::ParseItemLocationsJson(nlohmann::json spoilerFileJson) {
|
||||
void Context::ParseArchipelagoItemsLocations(const std::vector<ArchipelagoClient::ApItem>& scouted_items) {
|
||||
const std::string SlotName = ArchipelagoClient::GetInstance().GetSlotName();
|
||||
|
||||
// Zero out the item table first
|
||||
for(int rc = 1; rc <= RC_MAX; rc++) {
|
||||
// Zero out the location table first
|
||||
for(int rc = 1; rc < RC_MAX; rc++) {
|
||||
itemLocationTable[rc].SetPlacedItem(RG_NONE);
|
||||
}
|
||||
|
||||
@@ -497,15 +497,20 @@ void Context::ParseArchipelagoItemsLocations(const std::vector<ArchipelagoClient
|
||||
// our item
|
||||
SPDLOG_TRACE("Populated item {} at location {}", ap_item.itemName, ap_item.locationName);
|
||||
const RandomizerGet item = StaticData::itemNameToEnum[ap_item.itemName];
|
||||
//const RandomizerGet item = StaticData::APitemToSoh.find(ap_item.itemName)->second;
|
||||
itemLocationTable[rc].SetPlacedItem(item);
|
||||
} else {
|
||||
// other player item
|
||||
itemLocationTable[rc].SetPlacedItem(RG_ARCHIPELAGO_ITEM_USEFUL);
|
||||
// i'll have to figure out custom names at some point, this currently does nothing
|
||||
//overrides[rc] = ItemOverride(rc, RG_DEKU_NUTS_5);
|
||||
//std::string getText = ap_item.playerName + "'s " + ap_item.itemName;
|
||||
//overrides[rc].SetTrickName(Text(getText, getText, getText));
|
||||
switch (ap_item.flags) {
|
||||
case 0:
|
||||
itemLocationTable[rc].SetPlacedItem(RG_ARCHIPELAGO_ITEM_JUNK);
|
||||
break;
|
||||
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!",
|
||||
"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!"),
|
||||
GIMESSAGE_NO_GERMAN(RG_ARCHIPELAGO_ITEM_USEFUL, ITEM_BEAN, "You found an useful %rAP_ITEM%w!",
|
||||
"Needs French Translation"),
|
||||
GIMESSAGE_NO_GERMAN(RG_ARCHIPELAGO_ITEM_JUNK, ITEM_BEAN, "You found a junk %rAP_ITEM%w!",
|
||||
"Needs French Translation"),
|
||||
GIMESSAGE_NO_GERMAN(RG_ARCHIPELAGO_ITEM_PROGRESSIVE, ITEM_BEAN, "You found a progressive %rAP_ITEM%w!",
|
||||
"Needs French Translation"),
|
||||
GIMESSAGE_UNTRANSLATED(RG_ARCHIPELAGO_ITEM_USEFUL, ITEM_NUT, "You found an useful %gAP Item%w!"),
|
||||
GIMESSAGE_UNTRANSLATED(RG_ARCHIPELAGO_ITEM_JUNK, ITEM_NUT, "You found a junk %gAP Item%w!"),
|
||||
GIMESSAGE_UNTRANSLATED(RG_ARCHIPELAGO_ITEM_PROGRESSIVE, ITEM_NUT, "You found a progressive %gAP Item%w!"),
|
||||
} };
|
||||
CreateGetItemMessages(getItemMessages);
|
||||
CreateRupeeMessages();
|
||||
|
||||
@@ -114,21 +114,20 @@ bool ArchipelagoClient::IsConnected() {
|
||||
return apClient->get_state() == APClient::State::SLOT_CONNECTED;
|
||||
}
|
||||
|
||||
void ArchipelagoClient::CheckLocation(RandomizerCheck SoH_check_id) {
|
||||
//std::string_view ap_name = Rando::StaticData::SohCheckToAP[SoH_check_id];
|
||||
std::string ap_name = Rando::StaticData::GetLocation(SoH_check_id)->GetName();
|
||||
if(ap_name.empty()) {
|
||||
void ArchipelagoClient::CheckLocation(RandomizerCheck sohCheckId) {
|
||||
std::string apName = Rando::StaticData::GetLocation(sohCheckId)->GetName();
|
||||
if (apName.empty()) {
|
||||
return;
|
||||
}
|
||||
int64_t ap_item_id = apClient->get_location_id(std::string(ap_name));
|
||||
std::string logMessage = "[LOG] Checked: " + ap_name + "(" + std::to_string(ap_item_id) + "), sending to AP server";
|
||||
int64_t apItemId = apClient->get_location_id(std::string(apName));
|
||||
|
||||
std::string logMessage = "[LOG] Checked: " + apName + "(" + std::to_string(apItemId) + "), sending to AP server";
|
||||
ArchipelagoConsole_SendMessage(logMessage.c_str());
|
||||
|
||||
// currently not sending, because i only get so many real chances
|
||||
if(!IsConnected()) {
|
||||
return;
|
||||
}
|
||||
apClient->LocationChecks({ap_item_id});
|
||||
apClient->LocationChecks({ apItemId });
|
||||
}
|
||||
|
||||
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() {
|
||||
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, "",
|
||||
ARRAY_COUNT(gSaveContext.ship.quest.data.archipelago.slotName));
|
||||
|
||||
for (uint32_t i; i < ARRAY_COUNT(gSaveContext.ship.quest.data.archipelago.locations); i++) {
|
||||
gSaveContext.ship.quest.data.archipelago.locations[i].itemType = 0;
|
||||
for (uint32_t i = 0; i < ARRAY_COUNT(gSaveContext.ship.quest.data.archipelago.locations); i++) {
|
||||
gSaveContext.ship.quest.data.archipelago.locations[i].itemType = -1;
|
||||
|
||||
SohUtils::CopyStringToCharArray(gSaveContext.ship.quest.data.archipelago.locations[i].itemName, "",
|
||||
ARRAY_COUNT(gSaveContext.ship.quest.data.archipelago.locations[i].itemName));
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#pragma once
|
||||
#ifdef __cplusplus
|
||||
#include "soh/Enhancements/randomizer/randomizerTypes.h"
|
||||
#include "soh/Enhancements/randomizer/static_data.h"
|
||||
#include <vector>
|
||||
@@ -83,3 +84,9 @@ class ArchipelagoClient{
|
||||
void LoadArchipelagoData();
|
||||
void SaveArchipelagoData(SaveContext* saveContext, int sectionID, bool fullSave);
|
||||
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/SaveManager.h"
|
||||
#include "soh/ResourceManagerHelpers.h"
|
||||
#include "soh/Network/Archipelago/Archipelago.h"
|
||||
|
||||
#define NUM_DUNGEONS 8
|
||||
#define NUM_COWS 10
|
||||
@@ -261,10 +262,19 @@ void Sram_InitSave(FileChooseContext* fileChooseCtx) {
|
||||
|
||||
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;
|
||||
|
||||
Randomizer_InitSaveFile();
|
||||
if (currentQuest == QUEST_ARCHIPELAGO) {
|
||||
Archipelago_InitSaveFile();
|
||||
}
|
||||
} else {
|
||||
gSaveContext.ship.quest.id = currentQuest;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user