Core/SAI: Add maxSize parameter to SMART_TARGET_CREATURE_DISTANCE, SMART_TARGET_GAMEOBJECT_DISTANCE, SMART_TARGET_CREATURE_RANGE and SMART_TARGET_GAMEOBJECT_RANGE

This commit is contained in:
jackpoz
2018-09-21 16:07:50 +02:00
parent 7634a57f64
commit 46368188ce
2 changed files with 16 additions and 0 deletions

View File

@@ -2544,6 +2544,9 @@ void SmartScript::GetTargets(ObjectVector& targets, SmartScriptHolder const& e,
if ((!e.target.unitRange.creature || unit->ToCreature()->GetEntry() == e.target.unitRange.creature) && baseObject->IsInRange(unit, float(e.target.unitRange.minDist), float(e.target.unitRange.maxDist)))
targets.push_back(unit);
}
if (e.target.unitRange.maxSize)
Trinity::Containers::RandomResize(targets, e.target.unitRange.maxSize);
break;
}
case SMART_TARGET_CREATURE_DISTANCE:
@@ -2562,6 +2565,9 @@ void SmartScript::GetTargets(ObjectVector& targets, SmartScriptHolder const& e,
if (!e.target.unitDistance.creature || unit->ToCreature()->GetEntry() == e.target.unitDistance.creature)
targets.push_back(unit);
}
if (e.target.unitDistance.maxSize)
Trinity::Containers::RandomResize(targets, e.target.unitDistance.maxSize);
break;
}
case SMART_TARGET_GAMEOBJECT_DISTANCE:
@@ -2580,6 +2586,9 @@ void SmartScript::GetTargets(ObjectVector& targets, SmartScriptHolder const& e,
if (!e.target.goDistance.entry || unit->ToGameObject()->GetEntry() == e.target.goDistance.entry)
targets.push_back(unit);
}
if (e.target.goDistance.maxSize)
Trinity::Containers::RandomResize(targets, e.target.goDistance.maxSize);
break;
}
case SMART_TARGET_GAMEOBJECT_RANGE:
@@ -2598,6 +2607,9 @@ void SmartScript::GetTargets(ObjectVector& targets, SmartScriptHolder const& e,
if ((!e.target.goRange.entry && unit->ToGameObject()->GetEntry() == e.target.goRange.entry) && baseObject->IsInRange(unit, float(e.target.goRange.minDist), float(e.target.goRange.maxDist)))
targets.push_back(unit);
}
if (e.target.goRange.maxSize)
Trinity::Containers::RandomResize(targets, e.target.goRange.maxSize);
break;
}
case SMART_TARGET_CREATURE_GUID:

View File

@@ -1240,6 +1240,7 @@ struct SmartTarget
uint32 creature;
uint32 minDist;
uint32 maxDist;
uint32 maxSize;
} unitRange;
struct
@@ -1252,6 +1253,7 @@ struct SmartTarget
{
uint32 creature;
uint32 dist;
uint32 maxSize;
} unitDistance;
struct
@@ -1275,6 +1277,7 @@ struct SmartTarget
uint32 entry;
uint32 minDist;
uint32 maxDist;
uint32 maxSize;
} goRange;
struct
@@ -1287,6 +1290,7 @@ struct SmartTarget
{
uint32 entry;
uint32 dist;
uint32 maxSize;
} goDistance;
struct