mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-26 15:37:20 +00:00
Merge pull request #478 from EmosewaMC/hp-item-mission-triggers-fix
Fixed mission progression for item proxies
This commit is contained in:
commit
acb7ad78e8
@ -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);
|
||||
|
||||
|
@ -193,15 +193,15 @@ public:
|
||||
|
||||
/**
|
||||
* Adds a buff related to equipping a lot to the entity
|
||||
* @param lot the lot to find buffs for
|
||||
* @param item the item to find buffs for
|
||||
*/
|
||||
void ApplyBuff(LOT lot) const;
|
||||
void ApplyBuff(Item* item) const;
|
||||
|
||||
/**
|
||||
* Removes buffs related to equipping a lot from the entity
|
||||
* @param lot the lot to find buffs for
|
||||
* @param item the item to find buffs for
|
||||
*/
|
||||
void RemoveBuff(LOT lot) const;
|
||||
void RemoveBuff(Item* item) const;
|
||||
|
||||
/**
|
||||
* Saves the equipped items into a temp state
|
||||
@ -240,11 +240,11 @@ public:
|
||||
|
||||
/**
|
||||
* Finds all the buffs related to a lot
|
||||
* @param lot the lot to get the buffs for
|
||||
* @param item the item to get the buffs for
|
||||
* @param castOnEquip if true, the skill missions for these buffs will be progressed
|
||||
* @return the buffs related to the specified lot
|
||||
*/
|
||||
std::vector<uint32_t> FindBuffs(LOT lot, bool castOnEquip) const;
|
||||
std::vector<uint32_t> FindBuffs(Item* item, bool castOnEquip) const;
|
||||
|
||||
/**
|
||||
* Initializes the equipped items with a list of items
|
||||
|
Loading…
Reference in New Issue
Block a user