From 133334a902b705dae6f7e92bb1009b84cf1c51d2 Mon Sep 17 00:00:00 2001 From: Shauren Date: Mon, 17 Oct 2022 23:11:46 +0200 Subject: Core/Loot: Implemented personal loot and tag sharing for non-boss loot --- src/server/game/AI/SmartScripts/SmartScript.cpp | 29 ++++++++++--------------- 1 file changed, 11 insertions(+), 18 deletions(-) (limited to 'src/server/game/AI/SmartScripts') diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 014475d0d4e..c045eda5288 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -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: -- cgit v1.2.3