Files
DarkflameServer/dScripts/02_server/Map/VE/VeMissionConsole.cpp
Aaron Kimbrell b7e3c5e899 fix(loot): activity rewards drop from the player at the activity object
Live sent quickbuild completion loot (about 190 samples) and the dragon,
BONS, spider queen and Frakjaw chest and wishing well rewards with the
player who earned them as the DropClientLoot source and owner,
use_position true and the spawn position at the object. DLU used the object
as the source, so use_position was false.

DropActivityLoot now uses the player as the source by default. The growing
flowers and the VE mission console have no live samples and keep the
object as the source.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 13:06:37 -05:00

30 lines
1.1 KiB
C++

#include "VeMissionConsole.h"
#include "InventoryComponent.h"
#include "Character.h"
#include "GameMessages.h"
#include "ObjectMessages.h"
#include "Loot.h"
#include "eTerminateType.h"
void VeMissionConsole::OnUse(Entity* self, Entity* user) {
// No live samples of this drop: kept sourced from the console
Loot::DropActivityLoot(user, self->GetObjectID(), 12551, 0, false);
auto* inventoryComponent = user->GetComponent<InventoryComponent>();
if (inventoryComponent != nullptr) {
inventoryComponent->AddItem(12547, 1, eLootSourceType::NONE); // Add the panel required for pickup
}
// The flag to set is 101<number>
const auto flagNumber = self->GetVar<std::u16string>(m_NumberVariable);
const int32_t flag = GeneralUtils::TryParse("101" + GeneralUtils::UTF16ToWTF8(flagNumber), 0);
auto* character = user->GetCharacter();
if (character != nullptr) {
character->SetPlayerFlag(flag, true);
}
GameMessages::NotifyClientObject(self->GetObjectID(), u"").Send(UNASSIGNED_SYSTEM_ADDRESS);
GameMessages::TerminateInteraction(user->GetObjectID(), eTerminateType::FROM_INTERACTION, self->GetObjectID()).Send(UNASSIGNED_SYSTEM_ADDRESS);
}