DarkflameServer/dScripts/02_server/Map/VE/VeMissionConsole.cpp
David Markowitz fc75d6048f
dGame Precompiled header improvements (#876)
* moving branch

* Add deleteinven slash command

* Change name of BRICKS_IN_BBB

* Use string_view instead of strcmp

* Clean up include tree

* Remove unneeded headers from PCH files

Removes unneeded headers from pre-compiled headers.  This increases compile time, however reduces development time for most files.

* Update Entity.h

* Update EntityManager.h

* Update GameMessages.cpp

* There it compiles now

Co-authored-by: Aaron Kimbrell <aronwk.aaron@gmail.com>
2023-01-06 23:17:05 -06:00

27 lines
952 B
C++

#include "VeMissionConsole.h"
#include "InventoryComponent.h"
#include "Character.h"
#include "GameMessages.h"
#include "Loot.h"
void VeMissionConsole::OnUse(Entity* self, Entity* user) {
LootGenerator::Instance().DropActivityLoot(user, self, 12551);
auto* inventoryComponent = user->GetComponent<InventoryComponent>();
if (inventoryComponent != nullptr) {
inventoryComponent->AddItem(12547, 1, eLootSourceType::LOOT_SOURCE_ACTIVITY); // Add the panel required for pickup
}
// The flag to set is 101<number>
const auto flagNumber = self->GetVar<std::u16string>(m_NumberVariable);
const auto flag = std::stoi("101" + GeneralUtils::UTF16ToWTF8(flagNumber));
auto* character = user->GetCharacter();
if (character != nullptr) {
character->SetPlayerFlag(flag, true);
}
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"");
GameMessages::SendTerminateInteraction(user->GetObjectID(), FROM_INTERACTION, self->GetObjectID());
}