Core/Loot: Implemented personal loot and tag sharing for non-boss loot

This commit is contained in:
Shauren
2022-10-17 23:11:46 +02:00
parent af76b41ace
commit 133334a902
36 changed files with 321 additions and 350 deletions
+11 -18
View File
@@ -933,11 +933,14 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (!me)
break;
if (Player* player = me->GetLootRecipient())
for (ObjectGuid tapperGuid : me->GetTapList())
{
player->RewardPlayerAndGroupAtEvent(e.action.killedMonster.creature, player);
TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction: SMART_ACTION_CALL_KILLEDMONSTER: Player %s, Killcredit: %u",
player->GetGUID().ToString().c_str(), e.action.killedMonster.creature);
if (Player* tapper = ObjectAccessor::GetPlayer(*me, tapperGuid))
{
tapper->KilledMonsterCredit(e.action.killedMonster.creature, me->GetGUID());
TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction: SMART_ACTION_CALL_KILLEDMONSTER: Player %s, Killcredit: %u",
tapper->GetGUID().ToString().c_str(), e.action.killedMonster.creature);
}
}
}
else // Specific target type
@@ -2947,20 +2950,10 @@ void SmartScript::GetTargets(ObjectVector& targets, SmartScriptHolder const& e,
case SMART_TARGET_LOOT_RECIPIENTS:
{
if (me)
{
if (Group* lootGroup = me->GetLootRecipientGroup())
{
for (GroupReference* it = lootGroup->GetFirstMember(); it != nullptr; it = it->next())
if (Player* recipient = it->GetSource())
if (recipient->IsInMap(me))
targets.push_back(recipient);
}
else
{
if (Player* recipient = me->GetLootRecipient())
targets.push_back(recipient);
}
}
for (ObjectGuid tapperGuid : me->GetTapList())
if (Player* tapper = ObjectAccessor::GetPlayer(*me, tapperGuid))
targets.push_back(tapper);
break;
}
case SMART_TARGET_VEHICLE_PASSENGER: