mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-02 02:23:49 +00:00
refactor(Core/Misc): acore to Acore (#6043)
This commit is contained in:
@@ -71,8 +71,8 @@ void TotemAI::UpdateAI(uint32 /*diff*/)
|
||||
me->IsFriendlyTo(victim) || !me->CanSeeOrDetect(victim))
|
||||
{
|
||||
victim = nullptr;
|
||||
acore::NearestAttackableUnitInObjectRangeCheck u_check(me, me, max_range);
|
||||
acore::UnitLastSearcher<acore::NearestAttackableUnitInObjectRangeCheck> checker(me, victim, u_check);
|
||||
Acore::NearestAttackableUnitInObjectRangeCheck u_check(me, me, max_range);
|
||||
Acore::UnitLastSearcher<Acore::NearestAttackableUnitInObjectRangeCheck> checker(me, victim, u_check);
|
||||
me->VisitNearbyObject(max_range, checker);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ enum SelectAggroTarget
|
||||
};
|
||||
|
||||
// default predicate function to select target based on distance, player and/or aura criteria
|
||||
struct DefaultTargetSelector : public acore::unary_function<Unit*, bool>
|
||||
struct DefaultTargetSelector : public Acore::unary_function<Unit*, bool>
|
||||
{
|
||||
const Unit* me;
|
||||
float m_dist;
|
||||
@@ -78,7 +78,7 @@ struct DefaultTargetSelector : public acore::unary_function<Unit*, bool>
|
||||
|
||||
// Target selector for spell casts checking range, auras and attributes
|
||||
// TODO: Add more checks from Spell::CheckCast
|
||||
struct SpellTargetSelector : public acore::unary_function<Unit*, bool>
|
||||
struct SpellTargetSelector : public Acore::unary_function<Unit*, bool>
|
||||
{
|
||||
public:
|
||||
SpellTargetSelector(Unit* caster, uint32 spellId);
|
||||
@@ -92,7 +92,7 @@ private:
|
||||
// Very simple target selector, will just skip main target
|
||||
// NOTE: When passing to UnitAI::SelectTarget remember to use 0 as position for random selection
|
||||
// because tank will not be in the temporary list
|
||||
struct NonTankTargetSelector : public acore::unary_function<Unit*, bool>
|
||||
struct NonTankTargetSelector : public Acore::unary_function<Unit*, bool>
|
||||
{
|
||||
public:
|
||||
NonTankTargetSelector(Creature* source, bool playerOnly = true) : _source(source), _playerOnly(playerOnly) { }
|
||||
@@ -104,7 +104,7 @@ private:
|
||||
};
|
||||
|
||||
// Simple selector for units using mana
|
||||
struct PowerUsersSelector : public acore::unary_function<Unit*, bool>
|
||||
struct PowerUsersSelector : public Acore::unary_function<Unit*, bool>
|
||||
{
|
||||
Unit const* _me;
|
||||
Powers const _power;
|
||||
@@ -134,7 +134,7 @@ struct PowerUsersSelector : public acore::unary_function<Unit*, bool>
|
||||
}
|
||||
};
|
||||
|
||||
struct FarthestTargetSelector : public acore::unary_function<Unit*, bool>
|
||||
struct FarthestTargetSelector : public Acore::unary_function<Unit*, bool>
|
||||
{
|
||||
FarthestTargetSelector(Unit const* unit, float dist, bool playerOnly, bool inLos) : _me(unit), _dist(dist), _playerOnly(playerOnly), _inLos(inLos) {}
|
||||
|
||||
@@ -190,7 +190,7 @@ public:
|
||||
|
||||
Unit* SelectTarget(SelectAggroTarget targetType, uint32 position = 0, float dist = 0.0f, bool playerOnly = false, int32 aura = 0);
|
||||
// Select the targets satifying the predicate.
|
||||
// predicate shall extend acore::unary_function<Unit*, bool>
|
||||
// predicate shall extend Acore::unary_function<Unit*, bool>
|
||||
template <class PREDICATE> Unit* SelectTarget(SelectAggroTarget targetType, uint32 position, PREDICATE const& predicate)
|
||||
{
|
||||
ThreatContainer::StorageType const& threatlist = me->getThreatManager().getThreatList();
|
||||
@@ -206,7 +206,7 @@ public:
|
||||
return nullptr;
|
||||
|
||||
if (targetType == SELECT_TARGET_NEAREST || targetType == SELECT_TARGET_FARTHEST)
|
||||
targetList.sort(acore::ObjectDistanceOrderPred(me));
|
||||
targetList.sort(Acore::ObjectDistanceOrderPred(me));
|
||||
|
||||
switch (targetType)
|
||||
{
|
||||
@@ -240,7 +240,7 @@ public:
|
||||
void SelectTargetList(std::list<Unit*>& targetList, uint32 num, SelectAggroTarget targetType, float dist = 0.0f, bool playerOnly = false, int32 aura = 0);
|
||||
|
||||
// Select the targets satifying the predicate.
|
||||
// predicate shall extend acore::unary_function<Unit*, bool>
|
||||
// predicate shall extend Acore::unary_function<Unit*, bool>
|
||||
template <class PREDICATE> void SelectTargetList(std::list<Unit*>& targetList, PREDICATE const& predicate, uint32 maxTargets, SelectAggroTarget targetType)
|
||||
{
|
||||
ThreatContainer::StorageType const& threatlist = me->getThreatManager().getThreatList();
|
||||
@@ -255,13 +255,13 @@ public:
|
||||
return;
|
||||
|
||||
if (targetType == SELECT_TARGET_NEAREST || targetType == SELECT_TARGET_FARTHEST)
|
||||
targetList.sort(acore::ObjectDistanceOrderPred(me));
|
||||
targetList.sort(Acore::ObjectDistanceOrderPred(me));
|
||||
|
||||
if (targetType == SELECT_TARGET_FARTHEST || targetType == SELECT_TARGET_BOTTOMAGGRO)
|
||||
targetList.reverse();
|
||||
|
||||
if (targetType == SELECT_TARGET_RANDOM)
|
||||
acore::Containers::RandomResize(targetList, maxTargets);
|
||||
Acore::Containers::RandomResize(targetList, maxTargets);
|
||||
else
|
||||
targetList.resize(maxTargets);
|
||||
}
|
||||
|
||||
@@ -379,8 +379,8 @@ void ScriptedAI::DoTeleportAll(float x, float y, float z, float o)
|
||||
Unit* ScriptedAI::DoSelectLowestHpFriendly(float range, uint32 minHPDiff)
|
||||
{
|
||||
Unit* unit = nullptr;
|
||||
acore::MostHPMissingInRange u_check(me, range, minHPDiff);
|
||||
acore::UnitLastSearcher<acore::MostHPMissingInRange> searcher(me, unit, u_check);
|
||||
Acore::MostHPMissingInRange u_check(me, range, minHPDiff);
|
||||
Acore::UnitLastSearcher<Acore::MostHPMissingInRange> searcher(me, unit, u_check);
|
||||
me->VisitNearbyObject(range, searcher);
|
||||
|
||||
return unit;
|
||||
@@ -389,8 +389,8 @@ Unit* ScriptedAI::DoSelectLowestHpFriendly(float range, uint32 minHPDiff)
|
||||
std::list<Creature*> ScriptedAI::DoFindFriendlyCC(float range)
|
||||
{
|
||||
std::list<Creature*> list;
|
||||
acore::FriendlyCCedInRange u_check(me, range);
|
||||
acore::CreatureListSearcher<acore::FriendlyCCedInRange> searcher(me, list, u_check);
|
||||
Acore::FriendlyCCedInRange u_check(me, range);
|
||||
Acore::CreatureListSearcher<Acore::FriendlyCCedInRange> searcher(me, list, u_check);
|
||||
me->VisitNearbyObject(range, searcher);
|
||||
return list;
|
||||
}
|
||||
@@ -398,8 +398,8 @@ std::list<Creature*> ScriptedAI::DoFindFriendlyCC(float range)
|
||||
std::list<Creature*> ScriptedAI::DoFindFriendlyMissingBuff(float range, uint32 uiSpellid)
|
||||
{
|
||||
std::list<Creature*> list;
|
||||
acore::FriendlyMissingBuffInRange u_check(me, range, uiSpellid);
|
||||
acore::CreatureListSearcher<acore::FriendlyMissingBuffInRange> searcher(me, list, u_check);
|
||||
Acore::FriendlyMissingBuffInRange u_check(me, range, uiSpellid);
|
||||
Acore::CreatureListSearcher<Acore::FriendlyMissingBuffInRange> searcher(me, list, u_check);
|
||||
me->VisitNearbyObject(range, searcher);
|
||||
return list;
|
||||
}
|
||||
@@ -408,13 +408,13 @@ Player* ScriptedAI::GetPlayerAtMinimumRange(float minimumRange)
|
||||
{
|
||||
Player* player = nullptr;
|
||||
|
||||
CellCoord pair(acore::ComputeCellCoord(me->GetPositionX(), me->GetPositionY()));
|
||||
CellCoord pair(Acore::ComputeCellCoord(me->GetPositionX(), me->GetPositionY()));
|
||||
Cell cell(pair);
|
||||
cell.SetNoCreate();
|
||||
|
||||
acore::PlayerAtMinimumRangeAway check(me, minimumRange);
|
||||
acore::PlayerSearcher<acore::PlayerAtMinimumRangeAway> searcher(me, player, check);
|
||||
TypeContainerVisitor<acore::PlayerSearcher<acore::PlayerAtMinimumRangeAway>, GridTypeMapContainer> visitor(searcher);
|
||||
Acore::PlayerAtMinimumRangeAway check(me, minimumRange);
|
||||
Acore::PlayerSearcher<Acore::PlayerAtMinimumRangeAway> searcher(me, player, check);
|
||||
TypeContainerVisitor<Acore::PlayerSearcher<Acore::PlayerAtMinimumRangeAway>, GridTypeMapContainer> visitor(searcher);
|
||||
|
||||
cell.Visit(pair, visitor, *me->GetMap(), *me, minimumRange);
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ public:
|
||||
|
||||
// We need to use a copy of SummonList here, otherwise original SummonList would be modified
|
||||
StorageType listCopy = storage_;
|
||||
acore::Containers::RandomResize<StorageType, Predicate>(listCopy, std::forward<Predicate>(predicate), max);
|
||||
Acore::Containers::RandomResize<StorageType, Predicate>(listCopy, std::forward<Predicate>(predicate), max);
|
||||
|
||||
for (auto const& guid : listCopy)
|
||||
{
|
||||
|
||||
@@ -734,7 +734,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
caster = unit->SummonTrigger(unit->GetPositionX(), unit->GetPositionY(), unit->GetPositionZ(), unit->GetOrientation(), 5000);
|
||||
|
||||
if (e.action.cast.targetsLimit > 0 && targets->size() > e.action.cast.targetsLimit)
|
||||
acore::Containers::RandomResize(*targets, e.action.cast.targetsLimit);
|
||||
Acore::Containers::RandomResize(*targets, e.action.cast.targetsLimit);
|
||||
|
||||
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
|
||||
{
|
||||
@@ -793,7 +793,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
break;
|
||||
|
||||
if (e.action.cast.targetsLimit > 0 && targets->size() > e.action.cast.targetsLimit)
|
||||
acore::Containers::RandomResize(*targets, e.action.cast.targetsLimit);
|
||||
Acore::Containers::RandomResize(*targets, e.action.cast.targetsLimit);
|
||||
|
||||
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
|
||||
{
|
||||
@@ -1527,7 +1527,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
break;
|
||||
|
||||
// xinef: attack random target
|
||||
if (Unit* target = acore::Containers::SelectRandomContainerElement(*targets)->ToUnit())
|
||||
if (Unit* target = Acore::Containers::SelectRandomContainerElement(*targets)->ToUnit())
|
||||
me->AI()->AttackStart(target);
|
||||
|
||||
delete targets;
|
||||
@@ -1944,7 +1944,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
if (ObjectList* targets = GetTargets(e, unit))
|
||||
{
|
||||
// xinef: we want to move to random element
|
||||
target = acore::Containers::SelectRandomContainerElement(*targets);
|
||||
target = Acore::Containers::SelectRandomContainerElement(*targets);
|
||||
delete targets;
|
||||
}
|
||||
}
|
||||
@@ -2515,7 +2515,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
// xinef: my implementation
|
||||
if (e.action.jump.selfJump)
|
||||
{
|
||||
if (WorldObject* target = acore::Containers::SelectRandomContainerElement(*targets))
|
||||
if (WorldObject* target = Acore::Containers::SelectRandomContainerElement(*targets))
|
||||
if (me)
|
||||
me->GetMotionMaster()->MoveJump(target->GetPositionX() + e.target.x, target->GetPositionY() + e.target.y, target->GetPositionZ() + e.target.z, (float)e.action.jump.speedxy, (float)e.action.jump.speedz);
|
||||
}
|
||||
@@ -3680,7 +3680,7 @@ ObjectList* SmartScript::GetTargets(SmartScriptHolder const& e, Unit* invoker /*
|
||||
l->push_back(*itr);
|
||||
|
||||
if (e.target.playerRange.maxCount > 0)
|
||||
acore::Containers::RandomResize(*l, e.target.playerRange.maxCount);
|
||||
Acore::Containers::RandomResize(*l, e.target.playerRange.maxCount);
|
||||
}
|
||||
|
||||
delete units;
|
||||
@@ -3800,7 +3800,7 @@ ObjectList* SmartScript::GetTargets(SmartScriptHolder const& e, Unit* invoker /*
|
||||
l->push_back(*itr);
|
||||
|
||||
if (e.target.o > 0)
|
||||
acore::Containers::RandomResize(*l, e.target.o);
|
||||
Acore::Containers::RandomResize(*l, e.target.o);
|
||||
|
||||
delete units;
|
||||
break;
|
||||
@@ -3842,7 +3842,7 @@ ObjectList* SmartScript::GetTargets(SmartScriptHolder const& e, Unit* invoker /*
|
||||
}
|
||||
|
||||
if (e.target.roleSelection.resize > 0)
|
||||
acore::Containers::RandomResize(*l, e.target.roleSelection.resize);
|
||||
Acore::Containers::RandomResize(*l, e.target.roleSelection.resize);
|
||||
|
||||
delete units;
|
||||
break;
|
||||
@@ -3879,8 +3879,8 @@ ObjectList* SmartScript::GetWorldObjectsInDist(float dist)
|
||||
WorldObject* obj = GetBaseObject();
|
||||
if (obj)
|
||||
{
|
||||
acore::AllWorldObjectsInRange u_check(obj, dist);
|
||||
acore::WorldObjectListSearcher<acore::AllWorldObjectsInRange> searcher(obj, *targets, u_check);
|
||||
Acore::AllWorldObjectsInRange u_check(obj, dist);
|
||||
Acore::WorldObjectListSearcher<Acore::AllWorldObjectsInRange> searcher(obj, *targets, u_check);
|
||||
obj->VisitNearbyObject(dist, searcher);
|
||||
}
|
||||
return targets;
|
||||
@@ -4010,7 +4010,7 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui
|
||||
RecalcTimer(e, 1000, 3000);
|
||||
return;
|
||||
}
|
||||
ProcessTimedAction(e, e.event.friendlyCC.repeatMin, e.event.friendlyCC.repeatMax, acore::Containers::SelectRandomContainerElement(pList));
|
||||
ProcessTimedAction(e, e.event.friendlyCC.repeatMin, e.event.friendlyCC.repeatMax, Acore::Containers::SelectRandomContainerElement(pList));
|
||||
break;
|
||||
}
|
||||
case SMART_EVENT_FRIENDLY_MISSING_BUFF:
|
||||
@@ -4021,7 +4021,7 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui
|
||||
if (pList.empty())
|
||||
return;
|
||||
|
||||
ProcessTimedAction(e, e.event.missingBuff.repeatMin, e.event.missingBuff.repeatMax, acore::Containers::SelectRandomContainerElement(pList));
|
||||
ProcessTimedAction(e, e.event.missingBuff.repeatMin, e.event.missingBuff.repeatMax, Acore::Containers::SelectRandomContainerElement(pList));
|
||||
break;
|
||||
}
|
||||
case SMART_EVENT_HAS_AURA:
|
||||
@@ -4862,8 +4862,8 @@ Unit* SmartScript::DoSelectLowestHpFriendly(float range, uint32 MinHPDiff)
|
||||
|
||||
Unit* unit = nullptr;
|
||||
|
||||
acore::MostHPMissingInRange u_check(me, range, MinHPDiff);
|
||||
acore::UnitLastSearcher<acore::MostHPMissingInRange> searcher(me, unit, u_check);
|
||||
Acore::MostHPMissingInRange u_check(me, range, MinHPDiff);
|
||||
Acore::UnitLastSearcher<Acore::MostHPMissingInRange> searcher(me, unit, u_check);
|
||||
me->VisitNearbyObject(range, searcher);
|
||||
return unit;
|
||||
}
|
||||
@@ -4873,8 +4873,8 @@ void SmartScript::DoFindFriendlyCC(std::list<Creature*>& _list, float range)
|
||||
if (!me)
|
||||
return;
|
||||
|
||||
acore::FriendlyCCedInRange u_check(me, range);
|
||||
acore::CreatureListSearcher<acore::FriendlyCCedInRange> searcher(me, _list, u_check);
|
||||
Acore::FriendlyCCedInRange u_check(me, range);
|
||||
Acore::CreatureListSearcher<Acore::FriendlyCCedInRange> searcher(me, _list, u_check);
|
||||
me->VisitNearbyObject(range, searcher);
|
||||
}
|
||||
|
||||
@@ -4883,8 +4883,8 @@ void SmartScript::DoFindFriendlyMissingBuff(std::list<Creature*>& list, float ra
|
||||
if (!me)
|
||||
return;
|
||||
|
||||
acore::FriendlyMissingBuffInRange u_check(me, range, spellid);
|
||||
acore::CreatureListSearcher<acore::FriendlyMissingBuffInRange> searcher(me, list, u_check);
|
||||
Acore::FriendlyMissingBuffInRange u_check(me, range, spellid);
|
||||
Acore::CreatureListSearcher<Acore::FriendlyMissingBuffInRange> searcher(me, list, u_check);
|
||||
me->VisitNearbyObject(range, searcher);
|
||||
}
|
||||
|
||||
@@ -4894,8 +4894,8 @@ Unit* SmartScript::DoFindClosestFriendlyInRange(float range, bool playerOnly)
|
||||
return nullptr;
|
||||
|
||||
Unit* unit = nullptr;
|
||||
acore::AnyFriendlyNotSelfUnitInObjectRangeCheck u_check(me, me, range, playerOnly);
|
||||
acore::UnitLastSearcher<acore::AnyFriendlyNotSelfUnitInObjectRangeCheck> searcher(me, unit, u_check);
|
||||
Acore::AnyFriendlyNotSelfUnitInObjectRangeCheck u_check(me, me, range, playerOnly);
|
||||
Acore::UnitLastSearcher<Acore::AnyFriendlyNotSelfUnitInObjectRangeCheck> searcher(me, unit, u_check);
|
||||
me->VisitNearbyObject(range, searcher);
|
||||
return unit;
|
||||
}
|
||||
|
||||
@@ -1120,7 +1120,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
|
||||
}
|
||||
case SMART_ACTION_LOAD_GRID:
|
||||
{
|
||||
if (!acore::IsValidMapCoord(e.target.x, e.target.y))
|
||||
if (!Acore::IsValidMapCoord(e.target.x, e.target.y))
|
||||
{
|
||||
LOG_ERROR("server", "SmartScript: SMART_ACTION_LOAD_GRID uses invalid map coords: %u, skipped.", e.entryOrGuid);
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user