mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-01-21 04:07:01 +00:00
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:
parent
2209a4432f
commit
c968dc9028
@ -5,6 +5,7 @@
|
||||
#include "Logger.h"
|
||||
#include "Game.h"
|
||||
|
||||
#include <type_traits>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
@ -257,10 +258,10 @@ public:
|
||||
*
|
||||
* @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);
|
||||
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;
|
||||
}
|
||||
|
||||
void Reset() {
|
||||
m_Associative.clear();
|
||||
m_Dense.clear();
|
||||
}
|
||||
|
||||
private:
|
||||
/**
|
||||
* The associative portion. These values are key'd with strings to an AMFValue.
|
||||
|
@ -10,49 +10,38 @@ void NsLegoClubDoor::OnStartup(Entity* self) {
|
||||
self->SetVar(u"teleportString", m_TeleportString);
|
||||
self->SetVar(u"spawnPoint", m_SpawnPoint);
|
||||
|
||||
args = {};
|
||||
teleportArgs.Reset();
|
||||
|
||||
args.Insert("callbackClient", std::to_string(self->GetObjectID()));
|
||||
args.Insert("strIdentifier", "choiceDoor");
|
||||
args.Insert("title", "%[UI_CHOICE_DESTINATION]");
|
||||
teleportArgs.Insert("callbackClient", std::to_string(self->GetObjectID()));
|
||||
teleportArgs.Insert("strIdentifier", "choiceDoor");
|
||||
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("caption", "%[UI_CHOICE_NS]");
|
||||
nsArgs->Insert("identifier", "zoneID_1200");
|
||||
nsArgs->Insert("tooltipText", "%[UI_CHOICE_NS_HOVER]");
|
||||
nsArgs.Insert("image", "textures/ui/zone_thumnails/Nimbus_Station.dds");
|
||||
nsArgs.Insert("caption", "%[UI_CHOICE_NS]");
|
||||
nsArgs.Insert("identifier", "zoneID_1200");
|
||||
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("caption", "%[UI_CHOICE_NT]");
|
||||
ntArgs->Insert("identifier", "zoneID_1900");
|
||||
ntArgs->Insert("tooltipText", "%[UI_CHOICE_NT_HOVER]");
|
||||
ntArgs.Insert("image", "textures/ui/zone_thumnails/Nexus_Tower.dds");
|
||||
ntArgs.Insert("caption", "%[UI_CHOICE_NT]");
|
||||
ntArgs.Insert("identifier", "zoneID_1900");
|
||||
ntArgs.Insert("tooltipText", "%[UI_CHOICE_NT_HOVER]");
|
||||
}
|
||||
|
||||
options = choiceOptions;
|
||||
}
|
||||
|
||||
void NsLegoClubDoor::OnUse(Entity* self, Entity* user) {
|
||||
auto* player = user;
|
||||
|
||||
if (CheckChoice(self, player)) {
|
||||
AMFArrayValue multiArgs;
|
||||
|
||||
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!
|
||||
GameMessages::SendUIMessageServerToSingleClient(player, player->GetSystemAddress(), "QueueChoiceBox", teleportArgs);
|
||||
} else if (self->GetVar<int32_t>(u"currentZone") != m_ChoiceZoneID) {
|
||||
AMFArrayValue multiArgs;
|
||||
multiArgs.Insert("state", "Lobby");
|
||||
|
@ -19,6 +19,5 @@ private:
|
||||
std::string m_SpawnPoint = "NS_LEGO_Club";
|
||||
std::u16string m_TeleportAnim = u"lup-teleport";
|
||||
std::u16string m_TeleportString = u"ROCKET_TOOLTIP_USE_THE_GATEWAY_TO_TRAVEL_TO_LUP_WORLD";
|
||||
AMFArrayValue args = {};
|
||||
AMFArrayValue* options = {};
|
||||
AMFArrayValue teleportArgs{};
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user