Repaired some bugs

- Fixed Team loot
- LMI dropping for team sizes
- No more > 4 player teams
This commit is contained in:
Jett
2021-12-24 00:25:52 +00:00
parent 0afba0d1d3
commit 9440af0d67
4 changed files with 62 additions and 11 deletions

View File

@@ -769,25 +769,32 @@ void DestroyableComponent::Smash(const LWOOBJID source, const eKillType killType
if (team != nullptr && m_Parent->GetComponent<BaseCombatAIComponent>() != nullptr)
{
LWOOBJID specificOwner = LWOOBJID_EMPTY;
auto* scriptedActivityComponent = m_Parent->GetComponent<ScriptedActivityComponent>();
uint32_t teamSize = team->members.size();
uint32_t lootMatrixId = GetLootMatrixID();
if (team->lootOption == 0) // Round robin
{
specificOwner = TeamManager::Instance()->GetNextLootOwner(team);
if (scriptedActivityComponent) {
lootMatrixId = scriptedActivityComponent->GetLootMatrixForTeamSize(teamSize);
}
for (const auto memberId : team->members)
{
if (specificOwner != LWOOBJID_EMPTY && memberId != specificOwner) continue;
if (team->lootOption == 0) { // Round robin
specificOwner = TeamManager::Instance()->GetNextLootOwner(team);
auto* member = EntityManager::Instance()->GetEntity(memberId);
auto* member = EntityManager::Instance()->GetEntity(specificOwner);
if (member == nullptr) continue;
if (member) LootGenerator::Instance().DropLoot(member, m_Parent, lootMatrixId, GetMinCoins(), GetMaxCoins());
}
else {
for (const auto memberId : team->members) { // Free for all
auto* member = EntityManager::Instance()->GetEntity(memberId);
LootGenerator::Instance().DropLoot(member, m_Parent, GetLootMatrixID(), GetMinCoins(), GetMaxCoins());
if (member == nullptr) continue;
LootGenerator::Instance().DropLoot(member, m_Parent, lootMatrixId, GetMinCoins(), GetMaxCoins());
}
}
}
else
{
else { // drop loot for non team user
LootGenerator::Instance().DropLoot(owner, m_Parent, GetLootMatrixID(), GetMinCoins(), GetMaxCoins());
}
}