mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-06 18:54:13 +00:00
Fixed mission progression
This commit is contained in:
@@ -1043,7 +1043,7 @@ void InventoryComponent::EquipItem(Item* item, const bool skipChecks)
|
||||
|
||||
UpdateSlot(item->GetInfo().equipLocation, { item->GetId(), item->GetLot(), item->GetCount(), item->GetSlot() });
|
||||
|
||||
if (item->GetParent() == LWOOBJID_EMPTY) ApplyBuff(item->GetLot());
|
||||
ApplyBuff(item);
|
||||
|
||||
AddItemSkills(item->GetLot());
|
||||
|
||||
@@ -1071,7 +1071,7 @@ void InventoryComponent::UnEquipItem(Item* item)
|
||||
set->OnUnEquip(lot);
|
||||
}
|
||||
|
||||
if (item->GetParent() == LWOOBJID_EMPTY) RemoveBuff(item->GetLot());
|
||||
RemoveBuff(item);
|
||||
|
||||
RemoveItemSkills(item->GetLot());
|
||||
|
||||
@@ -1089,9 +1089,9 @@ void InventoryComponent::UnEquipItem(Item* item)
|
||||
}
|
||||
}
|
||||
|
||||
void InventoryComponent::ApplyBuff(const LOT lot) const
|
||||
void InventoryComponent::ApplyBuff(Item* item) const
|
||||
{
|
||||
const auto buffs = FindBuffs(lot, true);
|
||||
const auto buffs = FindBuffs(item, true);
|
||||
|
||||
for (const auto buff : buffs)
|
||||
{
|
||||
@@ -1099,9 +1099,9 @@ void InventoryComponent::ApplyBuff(const LOT lot) const
|
||||
}
|
||||
}
|
||||
|
||||
void InventoryComponent::RemoveBuff(const LOT lot) const
|
||||
void InventoryComponent::RemoveBuff(Item* item) const
|
||||
{
|
||||
const auto buffs = FindBuffs(lot, false);
|
||||
const auto buffs = FindBuffs(item, false);
|
||||
|
||||
for (const auto buff : buffs)
|
||||
{
|
||||
@@ -1418,18 +1418,18 @@ uint32_t InventoryComponent::FindSkill(const LOT lot)
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::vector<uint32_t> InventoryComponent::FindBuffs(const LOT lot, bool castOnEquip) const
|
||||
std::vector<uint32_t> InventoryComponent::FindBuffs(Item* item, bool castOnEquip) const
|
||||
{
|
||||
std::vector<uint32_t> buffs;
|
||||
if (item == nullptr) return buffs;
|
||||
auto* table = CDClientManager::Instance()->GetTable<CDObjectSkillsTable>("ObjectSkills");
|
||||
auto* behaviors = CDClientManager::Instance()->GetTable<CDSkillBehaviorTable>("SkillBehavior");
|
||||
|
||||
const auto results = table->Query([=](const CDObjectSkills& entry)
|
||||
{
|
||||
return entry.objectTemplate == static_cast<unsigned int>(lot);
|
||||
return entry.objectTemplate == static_cast<unsigned int>(item->GetLot());
|
||||
});
|
||||
|
||||
std::vector<uint32_t> buffs;
|
||||
|
||||
auto* missions = static_cast<MissionComponent*>(m_Parent->GetComponent(COMPONENT_TYPE_MISSION));
|
||||
|
||||
for (const auto& result : results)
|
||||
@@ -1449,8 +1449,8 @@ std::vector<uint32_t> InventoryComponent::FindBuffs(const LOT lot, bool castOnEq
|
||||
{
|
||||
missions->Progress(MissionTaskType::MISSION_TASK_TYPE_SKILL, result.skillID);
|
||||
}
|
||||
|
||||
buffs.push_back(static_cast<uint32_t>(entry.behaviorID));
|
||||
// If item is not a proxy, add its buff to the added buffs.
|
||||
if (item->GetParent() == LWOOBJID_EMPTY) buffs.push_back(static_cast<uint32_t>(entry.behaviorID));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1531,7 +1531,7 @@ std::vector<Item*> InventoryComponent::GenerateProxies(Item* parent)
|
||||
|
||||
auto* inventory = GetInventory(ITEM_SETS);
|
||||
|
||||
auto* proxy = new Item(lot, inventory, inventory->FindEmptySlot(), 1, {}, parent->GetId(), false, parent->GetId());
|
||||
auto* proxy = new Item(lot, inventory, inventory->FindEmptySlot(), 1, {}, parent->GetId(), false);
|
||||
|
||||
EquipItem(proxy);
|
||||
|
||||
|
Reference in New Issue
Block a user