diff options
| author | Shauren <shauren.trinity@gmail.com> | 2022-10-17 23:11:46 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2022-10-17 23:11:46 +0200 |
| commit | 133334a902b705dae6f7e92bb1009b84cf1c51d2 (patch) | |
| tree | 5a48c30a00441d36c285b78da396b5549eabbb87 /src/server/game/AI/SmartScripts | |
| parent | af76b41ace2917ece0aa3f97e4f46e095a7c815f (diff) | |
Core/Loot: Implemented personal loot and tag sharing for non-boss loot
Diffstat (limited to 'src/server/game/AI/SmartScripts')
| -rw-r--r-- | src/server/game/AI/SmartScripts/SmartScript.cpp | 29 |
1 files changed, 11 insertions, 18 deletions
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: |
