mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-25 06:26:24 +00:00
Codestyle fix (#1797)
Warning: Dont change this PR as draft to make it testable DONT REVIEW UNTIL Codestyle C++ workflow dont pass
This commit is contained in:
@@ -83,7 +83,7 @@ Unit* EnemyPlayerValue::Calculate()
|
||||
|
||||
GuidVector players = AI_VALUE(GuidVector, "nearest enemy players");
|
||||
float const maxAggroDistance = GetMaxAttackDistance();
|
||||
for (const auto& gTarget : players)
|
||||
for (auto const& gTarget : players)
|
||||
{
|
||||
Unit* pUnit = botAI->GetUnit(gTarget);
|
||||
if (!pUnit)
|
||||
|
||||
@@ -57,7 +57,8 @@ bool HasTotemValue::Calculate()
|
||||
// continue;
|
||||
// Creature* creature = dynamic_cast<Creature*>(unit);
|
||||
|
||||
// if (creature->GetOwner() != bot) {
|
||||
// if (creature->GetOwner() != bot)
|
||||
// {
|
||||
// continue;
|
||||
// }
|
||||
|
||||
|
||||
@@ -22,10 +22,13 @@ ItemUsage ItemUsageValue::Calculate()
|
||||
uint32 itemId = 0;
|
||||
uint32 randomPropertyId = 0;
|
||||
size_t pos = qualifier.find(",");
|
||||
if (pos != std::string::npos) {
|
||||
if (pos != std::string::npos)
|
||||
{
|
||||
itemId = atoi(qualifier.substr(0, pos).c_str());
|
||||
randomPropertyId = atoi(qualifier.substr(pos + 1).c_str());
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
itemId = atoi(qualifier.c_str());
|
||||
}
|
||||
|
||||
@@ -261,7 +264,7 @@ ItemUsage ItemUsageValue::QueryItemUsageForEquip(ItemTemplate const* itemProto,
|
||||
{
|
||||
needToCheckUnique = true;
|
||||
}
|
||||
else if (itemProto->Flags & ITEM_FLAG_UNIQUE_EQUIPPABLE)
|
||||
else if (itemProto->HasFlag(ITEM_FLAG_UNIQUE_EQUIPPABLE))
|
||||
{
|
||||
needToCheckUnique = true;
|
||||
}
|
||||
@@ -373,7 +376,6 @@ ItemUsage ItemUsageValue::QueryItemUsageForEquip(ItemTemplate const* itemProto,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (uint8 i = 0; i < possibleSlots; i++)
|
||||
{
|
||||
bool shouldEquipInSlot = shouldEquip;
|
||||
|
||||
@@ -54,18 +54,18 @@ void PossibleRpgTargetsValue::FindUnits(std::list<Unit*>& targets)
|
||||
|
||||
bool PossibleRpgTargetsValue::AcceptUnit(Unit* unit)
|
||||
{
|
||||
if (unit->IsHostileTo(bot) || unit->GetTypeId() == TYPEID_PLAYER)
|
||||
if (unit->IsHostileTo(bot) || unit->IsPlayer())
|
||||
return false;
|
||||
|
||||
if (sServerFacade->GetDistance2d(bot, unit) <= sPlayerbotAIConfig->tooCloseDistance)
|
||||
return false;
|
||||
|
||||
if (unit->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPIRITHEALER))
|
||||
if (unit->HasNpcFlag(UNIT_NPC_FLAG_SPIRITHEALER))
|
||||
return false;
|
||||
|
||||
for (uint32 npcFlag : allowedNpcFlags)
|
||||
{
|
||||
if (unit->HasFlag(UNIT_NPC_FLAGS, npcFlag))
|
||||
if (unit->HasNpcFlag(static_cast<NPCFlags>(npcFlag)))
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -82,7 +82,6 @@ bool PossibleRpgTargetsValue::AcceptUnit(Unit* unit)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
std::vector<uint32> PossibleNewRpgTargetsValue::allowedNpcFlags;
|
||||
|
||||
PossibleNewRpgTargetsValue::PossibleNewRpgTargetsValue(PlayerbotAI* botAI, float range)
|
||||
@@ -127,11 +126,11 @@ GuidVector PossibleNewRpgTargetsValue::Calculate()
|
||||
guidDistancePairs.push_back({unit->GetGUID(), bot->GetExactDist(unit)});
|
||||
}
|
||||
// Override to sort by distance
|
||||
std::sort(guidDistancePairs.begin(), guidDistancePairs.end(), [](const auto& a, const auto& b) {
|
||||
std::sort(guidDistancePairs.begin(), guidDistancePairs.end(), [](auto const& a, auto const& b) {
|
||||
return a.second < b.second;
|
||||
});
|
||||
|
||||
for (const auto& pair : guidDistancePairs) {
|
||||
for (auto const& pair : guidDistancePairs) {
|
||||
results.push_back(pair.first);
|
||||
}
|
||||
return results;
|
||||
@@ -146,15 +145,15 @@ void PossibleNewRpgTargetsValue::FindUnits(std::list<Unit*>& targets)
|
||||
|
||||
bool PossibleNewRpgTargetsValue::AcceptUnit(Unit* unit)
|
||||
{
|
||||
if (unit->IsHostileTo(bot) || unit->GetTypeId() == TYPEID_PLAYER)
|
||||
if (unit->IsHostileTo(bot) || unit->IsPlayer())
|
||||
return false;
|
||||
|
||||
if (unit->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPIRITHEALER))
|
||||
if (unit->HasNpcFlag(UNIT_NPC_FLAG_SPIRITHEALER))
|
||||
return false;
|
||||
|
||||
for (uint32 npcFlag : allowedNpcFlags)
|
||||
{
|
||||
if (unit->HasFlag(UNIT_NPC_FLAGS, npcFlag))
|
||||
if (unit->HasNpcFlag(static_cast<NPCFlags>(npcFlag)))
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -170,7 +169,6 @@ GuidVector PossibleNewRpgGameObjectsValue::Calculate()
|
||||
Acore::GameObjectListSearcher<AnyGameObjectInObjectRangeCheck> searcher(bot, targets, u_check);
|
||||
Cell::VisitObjects(bot, searcher, range);
|
||||
|
||||
|
||||
std::vector<std::pair<ObjectGuid, float>> guidDistancePairs;
|
||||
for (GameObject* go : targets)
|
||||
{
|
||||
@@ -194,11 +192,11 @@ GuidVector PossibleNewRpgGameObjectsValue::Calculate()
|
||||
GuidVector results;
|
||||
|
||||
// Sort by distance
|
||||
std::sort(guidDistancePairs.begin(), guidDistancePairs.end(), [](const auto& a, const auto& b) {
|
||||
std::sort(guidDistancePairs.begin(), guidDistancePairs.end(), [](auto const& a, auto const& b) {
|
||||
return a.second < b.second;
|
||||
});
|
||||
|
||||
for (const auto& pair : guidDistancePairs) {
|
||||
for (auto const& pair : guidDistancePairs) {
|
||||
results.push_back(pair.first);
|
||||
}
|
||||
return results;
|
||||
|
||||
Reference in New Issue
Block a user