2021-12-05 17:54:36 +00:00
|
|
|
#include "PropertyBankInteract.h"
|
|
|
|
#include "EntityManager.h"
|
|
|
|
#include "GameMessages.h"
|
2023-05-13 22:22:00 +00:00
|
|
|
#include "Amf3.h"
|
|
|
|
#include "Entity.h"
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
void PropertyBankInteract::OnStartup(Entity* self) {
|
|
|
|
auto* zoneControl = EntityManager::Instance()->GetZoneControlEntity();
|
|
|
|
if (zoneControl != nullptr) {
|
|
|
|
zoneControl->OnFireEventServerSide(self, "CheckForPropertyOwner");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void PropertyBankInteract::OnPlayerLoaded(Entity* self, Entity* player) {
|
|
|
|
auto* zoneControl = EntityManager::Instance()->GetZoneControlEntity();
|
|
|
|
if (zoneControl != nullptr) {
|
|
|
|
zoneControl->OnFireEventServerSide(self, "CheckForPropertyOwner");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void PropertyBankInteract::OnUse(Entity* self, Entity* user) {
|
|
|
|
|
|
|
|
AMFArrayValue args;
|
|
|
|
|
2023-05-13 22:22:00 +00:00
|
|
|
args.Insert("state", "bank");
|
|
|
|
|
|
|
|
GameMessages::SendUIMessageServerToSingleClient(user, user->GetSystemAddress(), "pushGameState", args);
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"OpenBank", 0, 0, LWOOBJID_EMPTY,
|
|
|
|
"", user->GetSystemAddress());
|
|
|
|
}
|
|
|
|
|
|
|
|
void PropertyBankInteract::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1,
|
|
|
|
int32_t param2, int32_t param3) {
|
|
|
|
if (args == "ToggleBank") {
|
|
|
|
AMFArrayValue amfArgs;
|
|
|
|
|
2023-05-13 22:22:00 +00:00
|
|
|
amfArgs.Insert("visible", false);
|
|
|
|
|
|
|
|
GameMessages::SendUIMessageServerToSingleClient(sender, sender->GetSystemAddress(), "ToggleBank", amfArgs);
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"CloseBank", 0, 0, LWOOBJID_EMPTY,
|
|
|
|
"", sender->GetSystemAddress());
|
|
|
|
}
|
|
|
|
}
|