clang-format
This commit is contained in:
@@ -325,7 +325,8 @@ void RandomizerOnExternalCheckHandler(uint32_t randomizerCheck) {
|
|||||||
Flags_SetInfTable(flagID);
|
Flags_SetInfTable(flagID);
|
||||||
break;
|
break;
|
||||||
case SPOILER_CHK_GOLD_SKULLTULA:
|
case SPOILER_CHK_GOLD_SKULLTULA:
|
||||||
logMessage = "[LOG] Externaly checked golden skultulla: " + std::to_string(loc->GetActorParams()) + ", " + std::to_string(flagID);
|
logMessage = "[LOG] Externaly checked golden skultulla: " + std::to_string(loc->GetActorParams()) + ", " +
|
||||||
|
std::to_string(flagID);
|
||||||
ArchipelagoConsole_SendMessage(logMessage.c_str(), true);
|
ArchipelagoConsole_SendMessage(logMessage.c_str(), true);
|
||||||
SET_GS_FLAGS((flagID & 0x1F00) >> 8, flagID & 0xFF);
|
SET_GS_FLAGS((flagID & 0x1F00) >> 8, flagID & 0xFF);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -5352,7 +5352,8 @@ void CreateArchipelagoItemMessage() {
|
|||||||
customMessageManager->AddCustomMessageTable(Randomizer::archipelagoItemsTableID);
|
customMessageManager->AddCustomMessageTable(Randomizer::archipelagoItemsTableID);
|
||||||
customMessageManager->CreateMessage(
|
customMessageManager->CreateMessage(
|
||||||
Randomizer::archipelagoItemsTableID, 0,
|
Randomizer::archipelagoItemsTableID, 0,
|
||||||
CustomMessage("You found [[apcolor]][[apitem]]%w for %r[[applayer]]%w!", "You found \x05\x06[[apitem]]\x05\x00 for \x05\x05[[applayer]]\x05\x00!",
|
CustomMessage("You found [[apcolor]][[apitem]]%w for %r[[applayer]]%w!",
|
||||||
|
"You found \x05\x06[[apitem]]\x05\x00 for \x05\x05[[applayer]]\x05\x00!",
|
||||||
"You found \x05\x06[[apitem]]\x05\x00 for \x05\x05[[applayer]]\x05\x00!"));
|
"You found \x05\x06[[apitem]]\x05\x00 for \x05\x05[[applayer]]\x05\x00!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5370,7 +5371,8 @@ CustomMessage Randomizer::GetArchipelagoItemMessage(int16_t randomizerGet, uint3
|
|||||||
}
|
}
|
||||||
|
|
||||||
messageEntry.Replace("[[apcolor]]", itemColor);
|
messageEntry.Replace("[[apcolor]]", itemColor);
|
||||||
messageEntry.Replace("[[apitem]]", std::string(gSaveContext.ship.quest.data.archipelago.locations[randomizerCheck].itemName));
|
messageEntry.Replace("[[apitem]]",
|
||||||
|
std::string(gSaveContext.ship.quest.data.archipelago.locations[randomizerCheck].itemName));
|
||||||
messageEntry.Replace("[[applayer]]",
|
messageEntry.Replace("[[applayer]]",
|
||||||
std::string(gSaveContext.ship.quest.data.archipelago.locations[randomizerCheck].playerName));
|
std::string(gSaveContext.ship.quest.data.archipelago.locations[randomizerCheck].playerName));
|
||||||
messageEntry.AutoFormat();
|
messageEntry.AutoFormat();
|
||||||
|
|||||||
@@ -51,8 +51,7 @@ bool ArchipelagoClient::StartClient() {
|
|||||||
std::list<std::string> tags;
|
std::list<std::string> tags;
|
||||||
// tags.push_back("DeathLink"); // todo, implement deathlink
|
// tags.push_back("DeathLink"); // todo, implement deathlink
|
||||||
apClient->ConnectSlot(CVarGetString(CVAR_REMOTE_ARCHIPELAGO("SlotName"), ""),
|
apClient->ConnectSlot(CVarGetString(CVAR_REMOTE_ARCHIPELAGO("SlotName"), ""),
|
||||||
CVarGetString(CVAR_REMOTE_ARCHIPELAGO("Password"), ""),
|
CVarGetString(CVAR_REMOTE_ARCHIPELAGO("Password"), ""), 0b001, tags);
|
||||||
0b001, tags);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
apClient->set_slot_connected_handler([&](const nlohmann::json data) {
|
apClient->set_slot_connected_handler([&](const nlohmann::json data) {
|
||||||
@@ -112,7 +111,8 @@ bool ArchipelagoClient::StartClient() {
|
|||||||
const std::string itemName = apItem.itemName;
|
const std::string itemName = apItem.itemName;
|
||||||
const std::string playerName = apItem.playerName;
|
const std::string playerName = apItem.playerName;
|
||||||
const std::string locationName = apItem.locationName;
|
const std::string locationName = apItem.locationName;
|
||||||
std::string logMessage = "[LOG] Location scouted: " + itemName + " for " + playerName + " in location " + locationName;
|
std::string logMessage =
|
||||||
|
"[LOG] Location scouted: " + itemName + " for " + playerName + " in location " + locationName;
|
||||||
ArchipelagoConsole_SendMessage(logMessage.c_str(), true);
|
ArchipelagoConsole_SendMessage(logMessage.c_str(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,30 +143,43 @@ bool ArchipelagoClient::StartClient() {
|
|||||||
|
|
||||||
if (node.type == "player_id") {
|
if (node.type == "player_id") {
|
||||||
int id = std::stoi(node.text);
|
int id = std::stoi(node.text);
|
||||||
if (color.empty() && id == client->get_player_number()) color = "magenta";
|
if (color.empty() && id == client->get_player_number())
|
||||||
else if(color.empty()) color = "yellow";
|
color = "magenta";
|
||||||
|
else if (color.empty())
|
||||||
|
color = "yellow";
|
||||||
text = client->get_player_alias(id);
|
text = client->get_player_alias(id);
|
||||||
} else if (node.type == "item_id") {
|
} else if (node.type == "item_id") {
|
||||||
int64_t id = std::stoll(node.text);
|
int64_t id = std::stoll(node.text);
|
||||||
if (color.empty()) {
|
if (color.empty()) {
|
||||||
if (node.flags & APClient::ItemFlags::FLAG_ADVANCEMENT) color = "plum";
|
if (node.flags & APClient::ItemFlags::FLAG_ADVANCEMENT)
|
||||||
else if (node.flags & APClient::ItemFlags::FLAG_NEVER_EXCLUDE) color = "slateblue";
|
color = "plum";
|
||||||
else if (node.flags & APClient::ItemFlags::FLAG_TRAP) color = "salmon";
|
else if (node.flags & APClient::ItemFlags::FLAG_NEVER_EXCLUDE)
|
||||||
else color = "cyan";
|
color = "slateblue";
|
||||||
|
else if (node.flags & APClient::ItemFlags::FLAG_TRAP)
|
||||||
|
color = "salmon";
|
||||||
|
else
|
||||||
|
color = "cyan";
|
||||||
}
|
}
|
||||||
text = client->get_item_name(id, client->get_player_game(node.player));
|
text = client->get_item_name(id, client->get_player_game(node.player));
|
||||||
} else if (node.type == "location_id") {
|
} else if (node.type == "location_id") {
|
||||||
int64_t id = std::stoll(node.text);
|
int64_t id = std::stoll(node.text);
|
||||||
if (color.empty()) color = "blue";
|
if (color.empty())
|
||||||
|
color = "blue";
|
||||||
text = client->get_location_name(id, client->get_player_game(node.player));
|
text = client->get_location_name(id, client->get_player_game(node.player));
|
||||||
} else if (node.type == "hint_status") {
|
} else if (node.type == "hint_status") {
|
||||||
text = node.text;
|
text = node.text;
|
||||||
if (node.hintStatus == APClient::HINT_FOUND) color = "green";
|
if (node.hintStatus == APClient::HINT_FOUND)
|
||||||
else if (node.hintStatus == APClient::HINT_UNSPECIFIED) color = "grey";
|
color = "green";
|
||||||
else if (node.hintStatus == APClient::HINT_NO_PRIORITY) color = "slateblue";
|
else if (node.hintStatus == APClient::HINT_UNSPECIFIED)
|
||||||
else if (node.hintStatus == APClient::HINT_AVOID) color = "salmon";
|
color = "grey";
|
||||||
else if (node.hintStatus == APClient::HINT_PRIORITY) color = "plum";
|
else if (node.hintStatus == APClient::HINT_NO_PRIORITY)
|
||||||
else color = "red"; // unknown status -> red
|
color = "slateblue";
|
||||||
|
else if (node.hintStatus == APClient::HINT_AVOID)
|
||||||
|
color = "salmon";
|
||||||
|
else if (node.hintStatus == APClient::HINT_PRIORITY)
|
||||||
|
color = "plum";
|
||||||
|
else
|
||||||
|
color = "red"; // unknown status -> red
|
||||||
} else if (node.type == "ERROR") {
|
} else if (node.type == "ERROR") {
|
||||||
color = "ERROR";
|
color = "ERROR";
|
||||||
text = node.text;
|
text = node.text;
|
||||||
@@ -244,7 +257,8 @@ void ArchipelagoClient::SynchSentLocations() {
|
|||||||
checkedLocations.emplace_back(apLocation);
|
checkedLocations.emplace_back(apLocation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::string locationLog = "[LOG] Synching " + std::to_string(checkedLocations.size())+ " checks already found in game";
|
std::string locationLog =
|
||||||
|
"[LOG] Synching " + std::to_string(checkedLocations.size()) + " checks already found in game";
|
||||||
ArchipelagoConsole_SendMessage(locationLog.c_str(), true);
|
ArchipelagoConsole_SendMessage(locationLog.c_str(), true);
|
||||||
|
|
||||||
apClient->LocationChecks(checkedLocations);
|
apClient->LocationChecks(checkedLocations);
|
||||||
@@ -350,7 +364,9 @@ void ArchipelagoClient::SendGameWon() {
|
|||||||
void ArchipelagoClient::SendMessageToConsole(const std::string message) {
|
void ArchipelagoClient::SendMessageToConsole(const std::string message) {
|
||||||
// local commands not implemented yet
|
// local commands not implemented yet
|
||||||
if (message.starts_with("/")) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -472,8 +488,7 @@ void LoadArchipelagoData() {
|
|||||||
ARRAY_COUNT(gSaveContext.ship.quest.data.archipelago.slotName));
|
ARRAY_COUNT(gSaveContext.ship.quest.data.archipelago.slotName));
|
||||||
|
|
||||||
SaveManager::Instance->LoadArray(
|
SaveManager::Instance->LoadArray(
|
||||||
"locations", ARRAY_COUNT(gSaveContext.ship.quest.data.archipelago.locations),
|
"locations", ARRAY_COUNT(gSaveContext.ship.quest.data.archipelago.locations), [](size_t i) {
|
||||||
[](size_t i) {
|
|
||||||
SaveManager::Instance->LoadStruct("", [&i]() {
|
SaveManager::Instance->LoadStruct("", [&i]() {
|
||||||
SaveManager::Instance->LoadCharArray(
|
SaveManager::Instance->LoadCharArray(
|
||||||
"itemName", gSaveContext.ship.quest.data.archipelago.locations[i].itemName,
|
"itemName", gSaveContext.ship.quest.data.archipelago.locations[i].itemName,
|
||||||
@@ -530,8 +545,10 @@ void RegisterArchipelago() {
|
|||||||
CVarSetInteger(CVAR_REMOTE_ARCHIPELAGO("Connected"), 0);
|
CVarSetInteger(CVAR_REMOTE_ARCHIPELAGO("Connected"), 0);
|
||||||
|
|
||||||
COND_HOOK(GameInteractor::OnGameFrameUpdate, true, []() { ArchipelagoClient::GetInstance().Poll(); });
|
COND_HOOK(GameInteractor::OnGameFrameUpdate, true, []() { ArchipelagoClient::GetInstance().Poll(); });
|
||||||
COND_HOOK(GameInteractor::PostLoadGame, true, [](int32_t file_id){ArchipelagoClient::GetInstance().GameLoaded();});
|
COND_HOOK(GameInteractor::PostLoadGame, true,
|
||||||
COND_HOOK(GameInteractor::OnRandomizerItemGivenHooks, IS_ARCHIPELAGO,
|
[](int32_t file_id) { ArchipelagoClient::GetInstance().GameLoaded(); });
|
||||||
|
COND_HOOK(
|
||||||
|
GameInteractor::OnRandomizerItemGivenHooks, IS_ARCHIPELAGO,
|
||||||
[](uint32_t rc, GetItemEntry gi, uint8_t isGiSkipped) {
|
[](uint32_t rc, GetItemEntry gi, uint8_t isGiSkipped) {
|
||||||
if (rc == RC_ARCHIPELAGO_RECEIVED_ITEM) {
|
if (rc == RC_ARCHIPELAGO_RECEIVED_ITEM) {
|
||||||
gSaveContext.ship.quest.data.archipelago.lastReceivedItemIndex++;
|
gSaveContext.ship.quest.data.archipelago.lastReceivedItemIndex++;
|
||||||
@@ -556,12 +573,11 @@ void RegisterArchipelago() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Notification::Emit({
|
Notification::Emit(
|
||||||
.itemIcon = itemIcon,
|
{ .itemIcon = itemIcon,
|
||||||
.prefix = std::string(gSaveContext.ship.quest.data.archipelago.locations[rc].itemName),
|
.prefix = std::string(gSaveContext.ship.quest.data.archipelago.locations[rc].itemName),
|
||||||
.message = " for ",
|
.message = " for ",
|
||||||
.suffix = std::string(gSaveContext.ship.quest.data.archipelago.locations[rc].playerName)
|
.suffix = std::string(gSaveContext.ship.quest.data.archipelago.locations[rc].playerName) });
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ namespace AP_Client_consts {
|
|||||||
static constexpr int MAX_PASSWORD_LENGTH = 32;
|
static constexpr int MAX_PASSWORD_LENGTH = 32;
|
||||||
|
|
||||||
static constexpr char const* AP_GAME_NAME = "Ship of Harkinian";
|
static constexpr char const* AP_GAME_NAME = "Ship of Harkinian";
|
||||||
}
|
} // namespace AP_Client_consts
|
||||||
|
|
||||||
class ArchipelagoClient {
|
class ArchipelagoClient {
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -86,7 +86,6 @@ void ArchipelagoConsoleWindow::DrawElement() {
|
|||||||
keepFocus = true;
|
keepFocus = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ImGui::PopStyleColor();
|
ImGui::PopStyleColor();
|
||||||
ImGui::PopStyleVar(4);
|
ImGui::PopStyleVar(4);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -72,11 +72,11 @@ void ArchipelagoSettingsWindow::DrawElement() {
|
|||||||
ArchipelagoClient::GetInstance().OnItemReceived(apItem);
|
ArchipelagoClient::GetInstance().OnItemReceived(apItem);
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if (UIWidgets::Button("Send Game Won",
|
if (UIWidgets::Button("Send Game Won", UIWidgets::ButtonOptions().Color(THEME_COLOR).Size(ImVec2(0.0, 0.0)))) {
|
||||||
UIWidgets::ButtonOptions().Color(THEME_COLOR).Size(ImVec2(0.0, 0.0)))) {
|
|
||||||
ArchipelagoClient::GetInstance().SendGameWon();
|
ArchipelagoClient::GetInstance().SendGameWon();
|
||||||
}
|
}
|
||||||
if (UIWidgets::Button("Get Mido br chest", UIWidgets::ButtonOptions().Color(THEME_COLOR).Size(ImVec2(0.0, 0.0)))) {
|
if (UIWidgets::Button("Get Mido br chest",
|
||||||
|
UIWidgets::ButtonOptions().Color(THEME_COLOR).Size(ImVec2(0.0, 0.0)))) {
|
||||||
ArchipelagoClient::GetInstance().QueueExternalCheck(16711707);
|
ArchipelagoClient::GetInstance().QueueExternalCheck(16711707);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -96,7 +96,6 @@ void ArchipelagoSettingsWindow::DrawElement() {
|
|||||||
|
|
||||||
void ArchipelagoSettingsWindow::InitElement() {
|
void ArchipelagoSettingsWindow::InitElement() {
|
||||||
SaveManager::Instance->AddLoadFunction("archipelagoData", 1, LoadArchipelagoData);
|
SaveManager::Instance->AddLoadFunction("archipelagoData", 1, LoadArchipelagoData);
|
||||||
SaveManager::Instance->AddSaveFunction("archipelagoData", 1, SaveArchipelagoData, true,
|
SaveManager::Instance->AddSaveFunction("archipelagoData", 1, SaveArchipelagoData, true, SECTION_PARENT_NONE);
|
||||||
SECTION_PARENT_NONE);
|
|
||||||
SaveManager::Instance->AddInitFunction(InitArchipelagoData);
|
SaveManager::Instance->AddInitFunction(InitArchipelagoData);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user