Core/SmartScripts: Add SMART_TARGET_LOOT_RECIPIENTS. Does what it says on the tin.

Use this new target type to fix The Rider of Blood, The Rider of Frost, The Rider of the Unholy. Closes #17817.
This commit is contained in:
treeston
2016-08-19 14:25:23 +02:00
committed by Aokromes
parent 8d12a82f5b
commit c2fd73c95d
4 changed files with 22 additions and 1 deletions

View File

@@ -0,0 +1,2 @@
-- fix Rider of the Unholy / Blood / Frost (issue #17817)
UPDATE `smart_scripts` SET `target_type`=27 WHERE `source_type`=0 AND `entryorguid` IN (30954,30956,30953) AND `action_type`=33;

View File

@@ -2761,6 +2761,23 @@ ObjectList* SmartScript::GetTargets(SmartScriptHolder const& e, Unit* invoker /*
l->push_back(target);
break;
}
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())
l->push_back(recipient);
}
else
{
if (Player* recipient = me->GetLootRecipient())
l->push_back(recipient);
}
}
}
case SMART_TARGET_POSITION:
case SMART_TARGET_NONE:
default:

View File

@@ -374,6 +374,7 @@ bool SmartAIMgr::IsTargetValid(SmartScriptHolder const& e)
case SMART_TARGET_CLOSEST_ENEMY:
case SMART_TARGET_CLOSEST_FRIENDLY:
case SMART_TARGET_STORED:
case SMART_TARGET_LOOT_RECIPIENTS:
break;
default:
TC_LOG_ERROR("sql.sql", "SmartAIMgr: Not handled target_type(%u), Entry %d SourceType %u Event %u Action %u, skipped.", e.GetTargetType(), e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());

View File

@@ -1104,8 +1104,9 @@ enum SMARTAI_TARGETS
SMART_TARGET_THREAT_LIST = 24, // All units on creature's threat list
SMART_TARGET_CLOSEST_ENEMY = 25, // maxDist, playerOnly
SMART_TARGET_CLOSEST_FRIENDLY = 26, // maxDist, playerOnly
SMART_TARGET_LOOT_RECIPIENTS = 27, // all players that have tagged this creature (for kill credit)
SMART_TARGET_END = 27
SMART_TARGET_END = 28
};
struct SmartTarget