2021-12-05 17:54:36 +00:00
|
|
|
#include "VeMissionConsole.h"
|
|
|
|
#include "InventoryComponent.h"
|
|
|
|
#include "Character.h"
|
|
|
|
#include "GameMessages.h"
|
2023-01-07 05:17:05 +00:00
|
|
|
#include "Loot.h"
|
2023-05-02 22:39:21 +00:00
|
|
|
#include "eTerminateType.h"
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
void VeMissionConsole::OnUse(Entity* self, Entity* user) {
|
2021-12-20 10:25:45 +00:00
|
|
|
LootGenerator::Instance().DropActivityLoot(user, self, 12551);
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2023-06-09 08:27:05 +00:00
|
|
|
auto* inventoryComponent = user->GetComponent<InventoryComponent>();
|
2021-12-05 17:54:36 +00:00
|
|
|
if (inventoryComponent != nullptr) {
|
2023-05-02 22:39:21 +00:00
|
|
|
inventoryComponent->AddItem(12547, 1, eLootSourceType::ACTIVITY); // Add the panel required for pickup
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// The flag to set is 101<number>
|
|
|
|
const auto flagNumber = self->GetVar<std::u16string>(m_NumberVariable);
|
2023-05-02 22:39:21 +00:00
|
|
|
const int32_t flag = std::stoi("101" + GeneralUtils::UTF16ToWTF8(flagNumber));
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
auto* character = user->GetCharacter();
|
|
|
|
if (character != nullptr) {
|
|
|
|
character->SetPlayerFlag(flag, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"");
|
2023-05-02 22:39:21 +00:00
|
|
|
GameMessages::SendTerminateInteraction(user->GetObjectID(), eTerminateType::FROM_INTERACTION, self->GetObjectID());
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|