fix lego club teleport (#1731)

Tested that the lego club teleport and starbase 3001 teleports work now both before and after you visit nexus tower
This commit is contained in:
David Markowitz 2025-01-13 23:28:24 -08:00 committed by GitHub
parent 2209a4432f
commit c968dc9028
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 25 additions and 31 deletions

View File

@ -5,6 +5,7 @@
#include "Logger.h" #include "Logger.h"
#include "Game.h" #include "Game.h"
#include <type_traits>
#include <unordered_map> #include <unordered_map>
#include <vector> #include <vector>
@ -257,10 +258,10 @@ public:
* *
* @param key The key to remove from the associative portion * @param key The key to remove from the associative portion
*/ */
void Remove(const std::string& key, const bool deleteValue = true) { void Remove(const std::string& key) {
const AMFAssociative::const_iterator it = m_Associative.find(key); const AMFAssociative::const_iterator it = m_Associative.find(key);
if (it != m_Associative.cend()) { if (it != m_Associative.cend()) {
if (deleteValue) m_Associative.erase(it); m_Associative.erase(it);
} }
} }
@ -343,6 +344,11 @@ public:
return index < m_Dense.size() ? m_Dense.at(index).get() : nullptr; return index < m_Dense.size() ? m_Dense.at(index).get() : nullptr;
} }
void Reset() {
m_Associative.clear();
m_Dense.clear();
}
private: private:
/** /**
* The associative portion. These values are key'd with strings to an AMFValue. * The associative portion. These values are key'd with strings to an AMFValue.

View File

@ -10,49 +10,38 @@ void NsLegoClubDoor::OnStartup(Entity* self) {
self->SetVar(u"teleportString", m_TeleportString); self->SetVar(u"teleportString", m_TeleportString);
self->SetVar(u"spawnPoint", m_SpawnPoint); self->SetVar(u"spawnPoint", m_SpawnPoint);
args = {}; teleportArgs.Reset();
args.Insert("callbackClient", std::to_string(self->GetObjectID())); teleportArgs.Insert("callbackClient", std::to_string(self->GetObjectID()));
args.Insert("strIdentifier", "choiceDoor"); teleportArgs.Insert("strIdentifier", "choiceDoor");
args.Insert("title", "%[UI_CHOICE_DESTINATION]"); teleportArgs.Insert("title", "%[UI_CHOICE_DESTINATION]");
AMFArrayValue* choiceOptions = args.InsertArray("options"); auto& choiceOptions = *teleportArgs.InsertArray("options");
{ {
AMFArrayValue* nsArgs = choiceOptions->PushArray(); auto& nsArgs = *choiceOptions.PushArray();
nsArgs->Insert("image", "textures/ui/zone_thumnails/Nimbus_Station.dds"); nsArgs.Insert("image", "textures/ui/zone_thumnails/Nimbus_Station.dds");
nsArgs->Insert("caption", "%[UI_CHOICE_NS]"); nsArgs.Insert("caption", "%[UI_CHOICE_NS]");
nsArgs->Insert("identifier", "zoneID_1200"); nsArgs.Insert("identifier", "zoneID_1200");
nsArgs->Insert("tooltipText", "%[UI_CHOICE_NS_HOVER]"); nsArgs.Insert("tooltipText", "%[UI_CHOICE_NS_HOVER]");
} }
{ {
AMFArrayValue* ntArgs = choiceOptions->PushArray(); auto& ntArgs = *choiceOptions.PushArray();
ntArgs->Insert("image", "textures/ui/zone_thumnails/Nexus_Tower.dds"); ntArgs.Insert("image", "textures/ui/zone_thumnails/Nexus_Tower.dds");
ntArgs->Insert("caption", "%[UI_CHOICE_NT]"); ntArgs.Insert("caption", "%[UI_CHOICE_NT]");
ntArgs->Insert("identifier", "zoneID_1900"); ntArgs.Insert("identifier", "zoneID_1900");
ntArgs->Insert("tooltipText", "%[UI_CHOICE_NT_HOVER]"); ntArgs.Insert("tooltipText", "%[UI_CHOICE_NT_HOVER]");
} }
options = choiceOptions;
} }
void NsLegoClubDoor::OnUse(Entity* self, Entity* user) { void NsLegoClubDoor::OnUse(Entity* self, Entity* user) {
auto* player = user; auto* player = user;
if (CheckChoice(self, player)) { if (CheckChoice(self, player)) {
AMFArrayValue multiArgs; GameMessages::SendUIMessageServerToSingleClient(player, player->GetSystemAddress(), "QueueChoiceBox", teleportArgs);
multiArgs.Insert("callbackClient", std::to_string(self->GetObjectID()));
multiArgs.Insert("strIdentifier", "choiceDoor");
multiArgs.Insert("title", "%[UI_CHOICE_DESTINATION]");
multiArgs.Insert("options", static_cast<AMFBaseValue*>(options));
GameMessages::SendUIMessageServerToSingleClient(player, player->GetSystemAddress(), "QueueChoiceBox", multiArgs);
multiArgs.Remove("options", false); // We do not want the local amf to delete the options!
} else if (self->GetVar<int32_t>(u"currentZone") != m_ChoiceZoneID) { } else if (self->GetVar<int32_t>(u"currentZone") != m_ChoiceZoneID) {
AMFArrayValue multiArgs; AMFArrayValue multiArgs;
multiArgs.Insert("state", "Lobby"); multiArgs.Insert("state", "Lobby");

View File

@ -19,6 +19,5 @@ private:
std::string m_SpawnPoint = "NS_LEGO_Club"; std::string m_SpawnPoint = "NS_LEGO_Club";
std::u16string m_TeleportAnim = u"lup-teleport"; std::u16string m_TeleportAnim = u"lup-teleport";
std::u16string m_TeleportString = u"ROCKET_TOOLTIP_USE_THE_GATEWAY_TO_TRAVEL_TO_LUP_WORLD"; std::u16string m_TeleportString = u"ROCKET_TOOLTIP_USE_THE_GATEWAY_TO_TRAVEL_TO_LUP_WORLD";
AMFArrayValue args = {}; AMFArrayValue teleportArgs{};
AMFArrayValue* options = {};
}; };