DarkflameServer/dScripts/VeMissionConsole.cpp
Jett 0531365cb5
Make loot accurate to the loot drop rates during live. (#216)
* loot fix (broken)

* Fixed loot

* Update SlashCommandHandler.cpp

* Remove debug command

* Roll loot command

* Remove debug log

* Added const references
When this commit is applied it adds const references to the loot system avoid some unnecessary copies.

Co-authored-by: wincent <wincent.holm@gmail.com>
Co-authored-by: Avery <averysumner@gmail.com>
2021-12-20 02:25:45 -08:00

26 lines
943 B
C++

#include "VeMissionConsole.h"
#include "InventoryComponent.h"
#include "Character.h"
#include "GameMessages.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); // 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());
}