mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-06 10:44:08 +00:00
loot source for item drops
Added support for Items to have a loot source attached to them when dropped or rolled. This fixes the issue where achievements would give the item before it appeared in the achievement window.
This commit is contained in:
@@ -141,6 +141,7 @@ const EquipmentMap& InventoryComponent::GetEquippedItems() const
|
||||
void InventoryComponent::AddItem(
|
||||
const LOT lot,
|
||||
const uint32_t count,
|
||||
eLootSourceType lootSourceType,
|
||||
eInventoryType inventoryType,
|
||||
const std::vector<LDFBaseData*>& config,
|
||||
const LWOOBJID parent,
|
||||
@@ -150,8 +151,7 @@ void InventoryComponent::AddItem(
|
||||
const eInventoryType inventorySourceType,
|
||||
const int32_t sourceType,
|
||||
const bool bound,
|
||||
int32_t preferredSlot,
|
||||
eLootSourceType lootSourceType)
|
||||
int32_t preferredSlot)
|
||||
{
|
||||
if (count == 0)
|
||||
{
|
||||
@@ -181,7 +181,7 @@ void InventoryComponent::AddItem(
|
||||
|
||||
if (!config.empty() || bound)
|
||||
{
|
||||
const auto slot = inventory->FindEmptySlot();
|
||||
const auto slot = preferredSlot != -1 && inventory->IsSlotEmpty(preferredSlot) ? preferredSlot : inventory->FindEmptySlot();
|
||||
|
||||
if (slot == -1)
|
||||
{
|
||||
@@ -224,7 +224,7 @@ void InventoryComponent::AddItem(
|
||||
|
||||
left -= delta;
|
||||
|
||||
existing->SetCount(existing->GetCount() + delta, false, true, showFlyingLoot);
|
||||
existing->SetCount(existing->GetCount() + delta, false, true, showFlyingLoot, lootSourceType);
|
||||
|
||||
if (isModMoveAndEquip)
|
||||
{
|
||||
@@ -255,9 +255,6 @@ void InventoryComponent::AddItem(
|
||||
|
||||
if (slot == -1)
|
||||
{
|
||||
// if (inventoryType == eInventoryType::VAULT_ITEMS || inventoryType == eInventoryType::VAULT_MODELS) {
|
||||
|
||||
// }
|
||||
auto* player = dynamic_cast<Player*>(GetParent());
|
||||
|
||||
if (player == nullptr)
|
||||
@@ -372,7 +369,7 @@ void InventoryComponent::MoveItemToInventory(Item* item, const eInventoryType in
|
||||
|
||||
left -= delta;
|
||||
|
||||
AddItem(lot, delta, inventory, {}, LWOOBJID_EMPTY, showFlyingLot, isModMoveAndEquip, LWOOBJID_EMPTY, origin->GetType(), 0, false, preferredSlot, eLootSourceType::LOOT_SOURCE_NONE);
|
||||
AddItem(lot, delta, eLootSourceType::LOOT_SOURCE_NONE, inventory, {}, LWOOBJID_EMPTY, showFlyingLot, isModMoveAndEquip, LWOOBJID_EMPTY, origin->GetType(), 0, false, preferredSlot);
|
||||
|
||||
item->SetCount(item->GetCount() - delta, false, false);
|
||||
|
||||
@@ -390,7 +387,7 @@ void InventoryComponent::MoveItemToInventory(Item* item, const eInventoryType in
|
||||
|
||||
const auto delta = std::min<uint32_t>(item->GetCount(), count);
|
||||
|
||||
AddItem(lot, delta, inventory, config, LWOOBJID_EMPTY, showFlyingLot, isModMoveAndEquip, LWOOBJID_EMPTY, origin->GetType(), 0, item->GetBound(), preferredSlot, eLootSourceType::LOOT_SOURCE_NONE);
|
||||
AddItem(lot, delta, eLootSourceType::LOOT_SOURCE_NONE, inventory, config, LWOOBJID_EMPTY, showFlyingLot, isModMoveAndEquip, LWOOBJID_EMPTY, origin->GetType(), 0, item->GetBound(), preferredSlot);
|
||||
|
||||
item->SetCount(item->GetCount() - delta, false, false);
|
||||
}
|
||||
|
Reference in New Issue
Block a user