mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-26 23:16:23 +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:
@@ -161,17 +161,21 @@ bool AttackAction::Attack(Unit* target, bool with_pet /*true*/)
|
||||
|
||||
bot->Attack(target, shouldMelee);
|
||||
/* prevent pet dead immediately in group */
|
||||
// if (bot->GetMap()->IsDungeon() && bot->GetGroup() && !target->IsInCombat()) {
|
||||
// if (bot->GetMap()->IsDungeon() && bot->GetGroup() && !target->IsInCombat())
|
||||
// {
|
||||
// with_pet = false;
|
||||
// }
|
||||
// if (Pet* pet = bot->GetPet())
|
||||
// {
|
||||
// if (with_pet) {
|
||||
// if (with_pet)
|
||||
// {
|
||||
// pet->SetReactState(REACT_DEFENSIVE);
|
||||
// pet->SetTarget(target->GetGUID());
|
||||
// pet->GetCharmInfo()->SetIsCommandAttack(true);
|
||||
// pet->AI()->AttackStart(target);
|
||||
// } else {
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// pet->SetReactState(REACT_PASSIVE);
|
||||
// pet->GetCharmInfo()->SetIsCommandFollow(true);
|
||||
// pet->GetCharmInfo()->IsReturning();
|
||||
|
||||
@@ -176,4 +176,3 @@ void AutoMaintenanceOnLevelupAction::AutoUpgradeEquip()
|
||||
factory.InitEquipment(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ bool BankAction::Execute(Event event)
|
||||
for (GuidVector::iterator i = npcs.begin(); i != npcs.end(); i++)
|
||||
{
|
||||
Unit* npc = botAI->GetUnit(*i);
|
||||
if (!npc || !npc->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_BANKER))
|
||||
if (!npc || !npc->HasNpcFlag(UNIT_NPC_FLAG_BANKER))
|
||||
continue;
|
||||
|
||||
return ExecuteBank(text, npc);
|
||||
|
||||
@@ -1894,13 +1894,13 @@ bool BGTactics::selectObjective(bool reset)
|
||||
bool isDefender = role < defendersProhab;
|
||||
bool isAdvanced = !isDefender && role > 8;
|
||||
|
||||
const auto& attackObjectives =
|
||||
auto const& attackObjectives =
|
||||
(team == TEAM_HORDE) ? AV_AttackObjectives_Horde : AV_AttackObjectives_Alliance;
|
||||
const auto& defendObjectives =
|
||||
auto const& defendObjectives =
|
||||
(team == TEAM_HORDE) ? AV_DefendObjectives_Horde : AV_DefendObjectives_Alliance;
|
||||
|
||||
uint32 destroyedNodes = 0;
|
||||
for (const auto& [nodeId, _] : defendObjectives)
|
||||
for (auto const& [nodeId, _] : defendObjectives)
|
||||
if (av->GetAVNodeInfo(nodeId).State == POINT_DESTROYED)
|
||||
destroyedNodes++;
|
||||
|
||||
@@ -2000,7 +2000,7 @@ bool BGTactics::selectObjective(bool reset)
|
||||
std::vector<GameObject*> contestedObjectives;
|
||||
std::vector<GameObject*> availableObjectives;
|
||||
|
||||
for (const auto& [nodeId, goId] : defendObjectives)
|
||||
for (auto const& [nodeId, goId] : defendObjectives)
|
||||
{
|
||||
const BG_AV_NodeInfo& node = av->GetAVNodeInfo(nodeId);
|
||||
if (node.State == POINT_DESTROYED)
|
||||
@@ -2026,7 +2026,7 @@ bool BGTactics::selectObjective(bool reset)
|
||||
if (!BgObjective)
|
||||
{
|
||||
uint32 towersDown = 0;
|
||||
for (const auto& [nodeId, _] : attackObjectives)
|
||||
for (auto const& [nodeId, _] : attackObjectives)
|
||||
if (av->GetAVNodeInfo(nodeId).State == POINT_DESTROYED)
|
||||
towersDown++;
|
||||
|
||||
@@ -2053,7 +2053,7 @@ bool BGTactics::selectObjective(bool reset)
|
||||
{
|
||||
std::vector<GameObject*> candidates;
|
||||
|
||||
for (const auto& [nodeId, goId] : attackObjectives)
|
||||
for (auto const& [nodeId, goId] : attackObjectives)
|
||||
{
|
||||
const BG_AV_NodeInfo& node = av->GetAVNodeInfo(nodeId);
|
||||
GameObject* go = bg->GetBGObject(goId);
|
||||
@@ -2105,13 +2105,13 @@ bool BGTactics::selectObjective(bool reset)
|
||||
Position objPos = BgObjective->GetPosition();
|
||||
|
||||
Optional<uint8> linkedNodeId;
|
||||
for (const auto& [nodeId, goId] : attackObjectives)
|
||||
for (auto const& [nodeId, goId] : attackObjectives)
|
||||
if (bg->GetBGObject(goId) == BgObjective)
|
||||
linkedNodeId = nodeId;
|
||||
|
||||
if (!linkedNodeId)
|
||||
{
|
||||
for (const auto& [nodeId, goId] : defendObjectives)
|
||||
for (auto const& [nodeId, goId] : defendObjectives)
|
||||
if (bg->GetBGObject(goId) == BgObjective)
|
||||
linkedNodeId = nodeId;
|
||||
}
|
||||
@@ -2543,7 +2543,7 @@ bool BGTactics::selectObjective(bool reset)
|
||||
float bestDist = FLT_MAX;
|
||||
uint32 bestTrigger = 0;
|
||||
|
||||
for (const auto& [nodeId, _, areaTrigger] : EY_AttackObjectives)
|
||||
for (auto const& [nodeId, _, areaTrigger] : EY_AttackObjectives)
|
||||
{
|
||||
if (!IsOwned(nodeId))
|
||||
continue;
|
||||
@@ -2610,7 +2610,7 @@ bool BGTactics::selectObjective(bool reset)
|
||||
// --- PRIORITY 2: Nearby unowned contested node ---
|
||||
if (!foundObjective)
|
||||
{
|
||||
for (const auto& [nodeId, _, __] : EY_AttackObjectives)
|
||||
for (auto const& [nodeId, _, __] : EY_AttackObjectives)
|
||||
{
|
||||
if (IsOwned(nodeId))
|
||||
continue;
|
||||
@@ -2711,7 +2711,7 @@ bool BGTactics::selectObjective(bool reset)
|
||||
if (!foundObjective && strategy == EY_STRATEGY_FLAG_FOCUS)
|
||||
{
|
||||
bool ownsAny = false;
|
||||
for (const auto& [nodeId, _, __] : EY_AttackObjectives)
|
||||
for (auto const& [nodeId, _, __] : EY_AttackObjectives)
|
||||
{
|
||||
if (IsOwned(nodeId))
|
||||
{
|
||||
@@ -2739,7 +2739,7 @@ bool BGTactics::selectObjective(bool reset)
|
||||
float bestDist = FLT_MAX;
|
||||
Optional<uint32> bestNode;
|
||||
|
||||
for (const auto& [nodeId, _, __] : EY_AttackObjectives)
|
||||
for (auto const& [nodeId, _, __] : EY_AttackObjectives)
|
||||
{
|
||||
if (IsOwned(nodeId))
|
||||
continue;
|
||||
@@ -2974,7 +2974,7 @@ bool BGTactics::selectObjective(bool reset)
|
||||
uint32 len = end(IC_AttackObjectives) - begin(IC_AttackObjectives);
|
||||
for (uint32 i = 0; i < len; i++)
|
||||
{
|
||||
const auto& objective =
|
||||
auto const& objective =
|
||||
IC_AttackObjectives[(i + role) %
|
||||
len]; // use role to determine which objective checked first
|
||||
if (isleOfConquestBG->GetICNodePoint(objective.first).nodeState != NODE_STATE_CONTROLLED_H)
|
||||
@@ -3126,7 +3126,7 @@ bool BGTactics::selectObjective(bool reset)
|
||||
uint32 len = end(IC_AttackObjectives) - begin(IC_AttackObjectives);
|
||||
for (uint32 i = 0; i < len; i++)
|
||||
{
|
||||
const auto& objective =
|
||||
auto const& objective =
|
||||
IC_AttackObjectives[(i + role) %
|
||||
len]; // use role to determine which objective checked first
|
||||
if (isleOfConquestBG->GetICNodePoint(objective.first).nodeState != NODE_STATE_CONTROLLED_H)
|
||||
|
||||
@@ -370,7 +370,7 @@ bool CheckMountStateAction::TryPreferredMount(Player* master) const
|
||||
|
||||
bool CheckMountStateAction::TryRandomMountFiltered(const std::map<int32, std::vector<uint32>>& spells, int32 masterSpeed) const
|
||||
{
|
||||
for (const auto& pair : spells)
|
||||
for (auto const& pair : spells)
|
||||
{
|
||||
int32 currentSpeed = pair.first;
|
||||
|
||||
@@ -378,7 +378,7 @@ bool CheckMountStateAction::TryRandomMountFiltered(const std::map<int32, std::ve
|
||||
continue;
|
||||
|
||||
// Pick a random mount from the candidate group.
|
||||
const auto& ids = pair.second;
|
||||
auto const& ids = pair.second;
|
||||
if (!ids.empty())
|
||||
{
|
||||
// Required here as otherwise bots won't mount in BG's due to them constant moving
|
||||
|
||||
@@ -120,7 +120,6 @@ void ChooseTravelTargetAction::getNewTarget(TravelTarget* newTarget, TravelTarge
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Continue current target. 90% chance
|
||||
if (!foundTarget && urand(1, 100) > 10)
|
||||
{
|
||||
@@ -673,7 +672,7 @@ bool ChooseTravelTargetAction::SetExploreTarget(TravelTarget* target)
|
||||
//271 south shore
|
||||
//35 booty bay
|
||||
//380 The Barrens The Crossroads
|
||||
if(((ExploreTravelDestination * )activeTarget)->getAreaId() == 380)
|
||||
if (((ExploreTravelDestination * )activeTarget)->getAreaId() == 380)
|
||||
{
|
||||
activePoints.push_back(activeTarget->getPoints(true)[0]);
|
||||
}
|
||||
|
||||
@@ -58,7 +58,6 @@ bool DropQuestAction::Execute(Event event)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool CleanQuestLogAction::Execute(Event event)
|
||||
{
|
||||
Player* requester = event.getOwner() ? event.getOwner() : GetMaster();
|
||||
@@ -165,7 +164,6 @@ bool CleanQuestLogAction::Execute(Event event)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void CleanQuestLogAction::DropQuestType(uint8& numQuest, uint8 wantNum, bool isGreen, bool hasProgress, bool isComplete)
|
||||
{
|
||||
std::vector<uint8> slots;
|
||||
|
||||
@@ -837,8 +837,8 @@ uint32 TalkAction::GetRandomEmote(Unit* unit, bool textEmote)
|
||||
types.push_back(TEXT_EMOTE_TALKEX);
|
||||
types.push_back(TEXT_EMOTE_TALKQ);
|
||||
|
||||
if (unit && (unit->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_TRAINER) ||
|
||||
unit->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER)))
|
||||
if (unit && (unit->HasNpcFlag(UNIT_NPC_FLAG_TRAINER) ||
|
||||
unit->HasNpcFlag(UNIT_NPC_FLAG_QUESTGIVER)))
|
||||
{
|
||||
types.push_back(TEXT_EMOTE_SALUTE);
|
||||
}
|
||||
@@ -864,8 +864,8 @@ uint32 TalkAction::GetRandomEmote(Unit* unit, bool textEmote)
|
||||
types.push_back(EMOTE_ONESHOT_EXCLAMATION);
|
||||
types.push_back(EMOTE_ONESHOT_QUESTION);
|
||||
|
||||
if (unit && (unit->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_TRAINER) ||
|
||||
unit->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER)))
|
||||
if (unit && (unit->HasNpcFlag(UNIT_NPC_FLAG_TRAINER) ||
|
||||
unit->HasNpcFlag(UNIT_NPC_FLAG_QUESTGIVER)))
|
||||
{
|
||||
types.push_back(EMOTE_ONESHOT_SALUTE);
|
||||
}
|
||||
|
||||
@@ -328,7 +328,6 @@ void EquipAction::EquipItem(Item* item)
|
||||
botAI->TellMaster(out);
|
||||
}
|
||||
|
||||
|
||||
bool EquipUpgradesAction::Execute(Event event)
|
||||
{
|
||||
if (!sPlayerbotAIConfig->autoEquipUpgradeLoot && !sRandomPlayerbotMgr->IsRandomBot(bot))
|
||||
@@ -357,9 +356,12 @@ bool EquipUpgradesAction::Execute(Event event)
|
||||
int32 randomProperty = item->GetItemRandomPropertyId();
|
||||
uint32 itemId = item->GetTemplate()->ItemId;
|
||||
std::string itemUsageParam;
|
||||
if (randomProperty != 0) {
|
||||
if (randomProperty != 0)
|
||||
{
|
||||
itemUsageParam = std::to_string(itemId) + "," + std::to_string(randomProperty);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
itemUsageParam = std::to_string(itemId);
|
||||
}
|
||||
ItemUsage usage = AI_VALUE2(ItemUsage, "item usage", itemUsageParam);
|
||||
@@ -388,9 +390,12 @@ bool EquipUpgradeAction::Execute(Event event)
|
||||
int32 randomProperty = item->GetItemRandomPropertyId();
|
||||
uint32 itemId = item->GetTemplate()->ItemId;
|
||||
std::string itemUsageParam;
|
||||
if (randomProperty != 0) {
|
||||
if (randomProperty != 0)
|
||||
{
|
||||
itemUsageParam = std::to_string(itemId) + "," + std::to_string(randomProperty);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
itemUsageParam = std::to_string(itemId);
|
||||
}
|
||||
ItemUsage usage = AI_VALUE2(ItemUsage, "item usage", itemUsageParam);
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace ai::buff
|
||||
return false;
|
||||
|
||||
if (SpellInfo const* info = sSpellMgr->GetSpellInfo(spellId))
|
||||
{
|
||||
{
|
||||
for (int i = 0; i < MAX_SPELL_REAGENTS; ++i)
|
||||
{
|
||||
if (info->Reagent[i] > 0)
|
||||
|
||||
@@ -29,7 +29,6 @@ namespace ai::buff
|
||||
// Returns false if the spellId is invalid.
|
||||
bool HasRequiredReagents(Player* bot, uint32 spellId);
|
||||
|
||||
|
||||
// Applies the "switch to group buff" policy if: the bot is in a group of size x+,
|
||||
// the group variant is known/useful, and reagents are available. Otherwise, returns baseName.
|
||||
// If announceOnMissing == true and reagents are missing, calls the 'announce' callback
|
||||
|
||||
@@ -190,8 +190,8 @@ CastEnchantItemAction::CastEnchantItemAction(PlayerbotAI* botAI, std::string con
|
||||
|
||||
bool CastEnchantItemAction::isPossible()
|
||||
{
|
||||
// if (!CastSpellAction::isPossible()) {
|
||||
|
||||
// if (!CastSpellAction::isPossible())
|
||||
// {
|
||||
// botAI->TellMasterNoFacing("Impossible: " + spell);
|
||||
// return false;
|
||||
// }
|
||||
@@ -364,7 +364,8 @@ bool UseTrinketAction::UseTrinket(Item* item)
|
||||
for (int i = 0; i < MAX_SPELL_EFFECTS; i++)
|
||||
{
|
||||
const SpellEffectInfo& effectInfo = spellInfo->Effects[i];
|
||||
if (effectInfo.Effect == SPELL_EFFECT_APPLY_AURA) {
|
||||
if (effectInfo.Effect == SPELL_EFFECT_APPLY_AURA)
|
||||
{
|
||||
applyAura = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -193,7 +193,7 @@ bool GuildManageNearbyAction::Execute(Event event)
|
||||
if (guild->GetMemberSize() > 1000)
|
||||
return false;
|
||||
|
||||
if ( (guild->GetRankRights(botMember->GetRankId()) & GR_RIGHT_INVITE) == 0)
|
||||
if ((guild->GetRankRights(botMember->GetRankId()) & GR_RIGHT_INVITE) == 0)
|
||||
continue;
|
||||
|
||||
if (player->GetGuildIdInvited())
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
using namespace lfg;
|
||||
|
||||
|
||||
bool LfgJoinAction::Execute(Event event) { return JoinLFG(); }
|
||||
|
||||
uint32 LfgJoinAction::GetRoles()
|
||||
@@ -113,7 +112,7 @@ bool LfgJoinAction::JoinLFG()
|
||||
dungeon->TypeID != LFG_TYPE_HEROIC && dungeon->TypeID != LFG_TYPE_RAID))
|
||||
continue;
|
||||
|
||||
const auto& botLevel = bot->GetLevel();
|
||||
auto const& botLevel = bot->GetLevel();
|
||||
|
||||
/*LFG_TYPE_RANDOM on classic is 15-58 so bot over level 25 will never queue*/
|
||||
if (dungeon->MinLevel && (botLevel < dungeon->MinLevel || botLevel > dungeon->MaxLevel) ||
|
||||
@@ -180,7 +179,6 @@ bool LfgRoleCheckAction::Execute(Event event)
|
||||
// if (currentRoles == newRoles)
|
||||
// return false;
|
||||
|
||||
|
||||
WorldPacket* packet = new WorldPacket(CMSG_LFG_SET_ROLES);
|
||||
*packet << (uint8)newRoles;
|
||||
bot->GetSession()->QueuePacket(packet);
|
||||
@@ -267,7 +265,6 @@ bool LfgAcceptAction::Execute(Event event)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool LfgLeaveAction::Execute(Event event)
|
||||
{
|
||||
// Don't leave if lfg strategy enabled
|
||||
|
||||
@@ -41,9 +41,12 @@ bool LootRollAction::Execute(Event event)
|
||||
continue;
|
||||
|
||||
std::string itemUsageParam;
|
||||
if (randomProperty != 0) {
|
||||
if (randomProperty != 0)
|
||||
{
|
||||
itemUsageParam = std::to_string(itemId) + "," + std::to_string(randomProperty);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
itemUsageParam = std::to_string(itemId);
|
||||
}
|
||||
ItemUsage usage = AI_VALUE2(ItemUsage, "item usage", itemUsageParam);
|
||||
@@ -120,7 +123,6 @@ bool LootRollAction::Execute(Event event)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
RollVote LootRollAction::CalculateRollVote(ItemTemplate const* proto)
|
||||
{
|
||||
std::ostringstream out;
|
||||
|
||||
@@ -248,7 +248,7 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
|
||||
// bot->CastStop();
|
||||
// botAI->InterruptSpell();
|
||||
// }
|
||||
|
||||
|
||||
MotionMaster& mm = *bot->GetMotionMaster();
|
||||
// No ground pathfinding if the bot/master are flying => allow true 3D (Z) movement
|
||||
auto isFlying = [](Unit* u){ return u && (u->HasUnitMovementFlag(MOVEMENTFLAG_FLYING) || u->IsInFlight()); };
|
||||
@@ -530,7 +530,8 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
|
||||
// {
|
||||
// AI_VALUE(LastMovement&, "last area trigger").lastAreaTrigger = entry;
|
||||
// }
|
||||
// else {
|
||||
// else
|
||||
// {
|
||||
// LOG_DEBUG("playerbots", "!entry");
|
||||
// return bot->TeleportTo(movePosition.getMapId(), movePosition.getX(), movePosition.getY(),
|
||||
// movePosition.getZ(), movePosition.getO(), 0);
|
||||
@@ -876,7 +877,8 @@ bool MovementAction::ReachCombatTo(Unit* target, float distance)
|
||||
deltaAngle -= 2.0f * M_PI; // -PI..PI
|
||||
// if target is moving forward and moving far away, predict the position
|
||||
bool behind = fabs(deltaAngle) > M_PI_2;
|
||||
if (target->HasUnitMovementFlag(MOVEMENTFLAG_FORWARD) && behind) {
|
||||
if (target->HasUnitMovementFlag(MOVEMENTFLAG_FORWARD) && behind)
|
||||
{
|
||||
float predictDis = std::min(3.0f, target->GetObjectSize() * 2);
|
||||
tx += cos(target->GetOrientation()) * predictDis;
|
||||
ty += sin(target->GetOrientation()) * predictDis;
|
||||
@@ -1009,7 +1011,8 @@ bool MovementAction::IsMovingAllowed()
|
||||
return false;
|
||||
}
|
||||
|
||||
// if (bot->HasUnitMovementFlag(MOVEMENTFLAG_FALLING)) {
|
||||
// if (bot->HasUnitMovementFlag(MOVEMENTFLAG_FALLING))
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
return bot->GetMotionMaster()->GetCurrentMovementGeneratorType() != FLIGHT_MOTION_TYPE;
|
||||
@@ -1094,9 +1097,12 @@ void MovementAction::UpdateMovementState()
|
||||
wasMovementRestricted = isCurrentlyRestricted;
|
||||
|
||||
// Temporary speed increase in group
|
||||
// if (botAI->HasRealPlayerMaster()) {
|
||||
// if (botAI->HasRealPlayerMaster())
|
||||
// {
|
||||
// bot->SetSpeedRate(MOVE_RUN, 1.1f);
|
||||
// } else {
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// bot->SetSpeedRate(MOVE_RUN, 1.0f);
|
||||
// }
|
||||
// check if target is not reachable (from Vmangos)
|
||||
@@ -1105,7 +1111,7 @@ void MovementAction::UpdateMovementState()
|
||||
// {
|
||||
// if (Unit* pTarget = sServerFacade->GetChaseTarget(bot))
|
||||
// {
|
||||
// if (!bot->IsWithinMeleeRange(pTarget) && pTarget->GetTypeId() == TYPEID_UNIT)
|
||||
// if (!bot->IsWithinMeleeRange(pTarget) && pTarget->IsCreature())
|
||||
// {
|
||||
// float angle = bot->GetAngle(pTarget);
|
||||
// float distance = 5.0f;
|
||||
@@ -1721,7 +1727,8 @@ bool MovementAction::MoveInside(uint32 mapId, float x, float y, float z, float d
|
||||
// float MovementAction::SearchBestGroundZForPath(float x, float y, float z, bool generatePath, float range, bool
|
||||
// normal_only, float step)
|
||||
// {
|
||||
// if (!generatePath) {
|
||||
// if (!generatePath)
|
||||
// {
|
||||
// return z;
|
||||
// }
|
||||
// float min_length = 100000.0f;
|
||||
@@ -1732,10 +1739,12 @@ bool MovementAction::MoveInside(uint32 mapId, float x, float y, float z, float d
|
||||
// modified_z = bot->GetMapWaterOrGroundLevel(x, y, z + delta);
|
||||
// PathGenerator gen(bot);
|
||||
// gen.CalculatePath(x, y, modified_z);
|
||||
// if (gen.GetPathType() == PATHFIND_NORMAL && gen.getPathLength() < min_length) {
|
||||
// if (gen.GetPathType() == PATHFIND_NORMAL && gen.getPathLength() < min_length)
|
||||
// {
|
||||
// min_length = gen.getPathLength();
|
||||
// current_z = modified_z;
|
||||
// if (abs(current_z - z) < 0.5f) {
|
||||
// if (abs(current_z - z) < 0.5f)
|
||||
// {
|
||||
// return current_z;
|
||||
// }
|
||||
// }
|
||||
@@ -1744,10 +1753,12 @@ bool MovementAction::MoveInside(uint32 mapId, float x, float y, float z, float d
|
||||
// modified_z = bot->GetMapWaterOrGroundLevel(x, y, z + delta);
|
||||
// PathGenerator gen(bot);
|
||||
// gen.CalculatePath(x, y, modified_z);
|
||||
// if (gen.GetPathType() == PATHFIND_NORMAL && gen.getPathLength() < min_length) {
|
||||
// if (gen.GetPathType() == PATHFIND_NORMAL && gen.getPathLength() < min_length)
|
||||
// {
|
||||
// min_length = gen.getPathLength();
|
||||
// current_z = modified_z;
|
||||
// if (abs(current_z - z) < 0.5f) {
|
||||
// if (abs(current_z - z) < 0.5f)
|
||||
// {
|
||||
// return current_z;
|
||||
// }
|
||||
// }
|
||||
@@ -1756,18 +1767,22 @@ bool MovementAction::MoveInside(uint32 mapId, float x, float y, float z, float d
|
||||
// modified_z = bot->GetMapWaterOrGroundLevel(x, y, z + delta);
|
||||
// PathGenerator gen(bot);
|
||||
// gen.CalculatePath(x, y, modified_z);
|
||||
// if (gen.GetPathType() == PATHFIND_NORMAL && gen.getPathLength() < min_length) {
|
||||
// if (gen.GetPathType() == PATHFIND_NORMAL && gen.getPathLength() < min_length)
|
||||
// {
|
||||
// min_length = gen.getPathLength();
|
||||
// current_z = modified_z;
|
||||
// if (abs(current_z - z) < 0.5f) {
|
||||
// if (abs(current_z - z) < 0.5f)
|
||||
// {
|
||||
// return current_z;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if (current_z == INVALID_HEIGHT && normal_only) {
|
||||
// if (current_z == INVALID_HEIGHT && normal_only)
|
||||
// {
|
||||
// return INVALID_HEIGHT;
|
||||
// }
|
||||
// if (current_z == INVALID_HEIGHT && !normal_only) {
|
||||
// if (current_z == INVALID_HEIGHT && !normal_only)
|
||||
// {
|
||||
// return z;
|
||||
// }
|
||||
// return current_z;
|
||||
@@ -2818,7 +2833,7 @@ bool MoveAwayFromCreatureAction::Execute(Event event)
|
||||
|
||||
// Find all creatures with the specified Id
|
||||
std::vector<Unit*> creatures;
|
||||
for (const auto& guid : targets)
|
||||
for (auto const& guid : targets)
|
||||
{
|
||||
Unit* unit = botAI->GetUnit(guid);
|
||||
if (unit && (alive && unit->IsAlive()) && unit->GetEntry() == creatureId)
|
||||
|
||||
@@ -119,7 +119,6 @@ protected:
|
||||
int moveInterval;
|
||||
};
|
||||
|
||||
|
||||
class CombatFormationMoveAction : public MovementAction
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -47,16 +47,16 @@ bool DrinkAction::Execute(Event event)
|
||||
return UseItemAction::Execute(event);
|
||||
}
|
||||
|
||||
bool DrinkAction::isUseful()
|
||||
{
|
||||
return UseItemAction::isUseful() &&
|
||||
bool DrinkAction::isUseful()
|
||||
{
|
||||
return UseItemAction::isUseful() &&
|
||||
AI_VALUE2(bool, "has mana", "self target") &&
|
||||
AI_VALUE2(uint8, "mana", "self target") < 100;
|
||||
}
|
||||
|
||||
bool DrinkAction::isPossible()
|
||||
{
|
||||
return !bot->IsInCombat() &&
|
||||
return !bot->IsInCombat() &&
|
||||
!bot->IsMounted() &&
|
||||
!botAI->HasAnyAuraOf(GetTarget(), "dire bear form", "bear form", "cat form", "travel form",
|
||||
"aquatic form","flight form", "swift flight form", nullptr) &&
|
||||
@@ -102,15 +102,15 @@ bool EatAction::Execute(Event event)
|
||||
return UseItemAction::Execute(event);
|
||||
}
|
||||
|
||||
bool EatAction::isUseful()
|
||||
{
|
||||
return UseItemAction::isUseful() &&
|
||||
bool EatAction::isUseful()
|
||||
{
|
||||
return UseItemAction::isUseful() &&
|
||||
AI_VALUE2(uint8, "health", "self target") < 100;
|
||||
}
|
||||
|
||||
bool EatAction::isPossible()
|
||||
{
|
||||
return !bot->IsInCombat() &&
|
||||
return !bot->IsInCombat() &&
|
||||
!bot->IsMounted() &&
|
||||
!botAI->HasAnyAuraOf(GetTarget(), "dire bear form", "bear form", "cat form", "travel form",
|
||||
"aquatic form","flight form", "swift flight form", nullptr) &&
|
||||
|
||||
@@ -48,7 +48,7 @@ bool QuestAction::Execute(Event event)
|
||||
|
||||
// Check the nearest NPCs
|
||||
GuidVector npcs = AI_VALUE(GuidVector, "nearest npcs");
|
||||
for (const auto& npc : npcs)
|
||||
for (auto const& npc : npcs)
|
||||
{
|
||||
Unit* unit = botAI->GetUnit(npc);
|
||||
if (unit && bot->GetDistance(unit) <= INTERACTION_DISTANCE)
|
||||
@@ -59,7 +59,7 @@ bool QuestAction::Execute(Event event)
|
||||
|
||||
// Checks the nearest game objects
|
||||
GuidVector gos = AI_VALUE(GuidVector, "nearest game objects");
|
||||
for (const auto& go : gos)
|
||||
for (auto const& go : gos)
|
||||
{
|
||||
GameObject* gameobj = botAI->GetGameObject(go);
|
||||
if (gameobj && bot->GetDistance(gameobj) <= INTERACTION_DISTANCE)
|
||||
@@ -359,7 +359,7 @@ bool QuestUpdateAddItemAction::Execute(Event event)
|
||||
uint32 availableItemsCount = botAI->GetInventoryItemsCountWithId(itemId);
|
||||
placeholders["%quest_obj_available"] = std::to_string(availableItemsCount);
|
||||
|
||||
for (const auto& pair : botAI->GetCurrentQuestsRequiringItemId(itemId))
|
||||
for (auto const& pair : botAI->GetCurrentQuestsRequiringItemId(itemId))
|
||||
{
|
||||
placeholders["%quest_link"] = chat->FormatQuest(pair.first);
|
||||
uint32 requiredItemsCount = pair.second;
|
||||
|
||||
@@ -49,7 +49,7 @@ class QuestUpdateAddItemAction : public Action
|
||||
{
|
||||
public:
|
||||
QuestUpdateAddItemAction(PlayerbotAI* ai) : Action(ai, "quest update add item") {}
|
||||
bool Execute(Event event) override;;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
class QuestUpdateFailedAction : public Action
|
||||
@@ -70,7 +70,7 @@ class QuestItemPushResultAction : public Action
|
||||
{
|
||||
public:
|
||||
QuestItemPushResultAction(PlayerbotAI* ai) : Action(ai, "quest item push result") {}
|
||||
bool Execute(Event event) override;;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -128,7 +128,7 @@ bool AutoReleaseSpiritAction::HandleBattlegroundSpiritHealer()
|
||||
GuidVector npcs = NearestNpcsValue(botAI, bgRange);
|
||||
Unit* spiritHealer = nullptr;
|
||||
|
||||
for (const auto& guid : npcs)
|
||||
for (auto const& guid : npcs)
|
||||
{
|
||||
Unit* unit = botAI->GetUnit(guid);
|
||||
if (unit && unit->IsFriendlyTo(bot) && unit->IsSpiritService())
|
||||
|
||||
@@ -12,24 +12,7 @@
|
||||
#include "GridNotifiersImpl.h"
|
||||
#include "Playerbots.h"
|
||||
#include "ServerFacade.h"
|
||||
|
||||
class AnyGameObjectInObjectRangeCheck
|
||||
{
|
||||
public:
|
||||
AnyGameObjectInObjectRangeCheck(WorldObject const* obj, float range) : i_obj(obj), i_range(range) {}
|
||||
WorldObject const& GetFocusObject() const { return *i_obj; }
|
||||
bool operator()(GameObject* go)
|
||||
{
|
||||
if (go && i_obj->IsWithinDistInMap(go, i_range) && go->isSpawned() && go->GetGOInfo())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
WorldObject const* i_obj;
|
||||
float i_range;
|
||||
};
|
||||
#include "NearestGameObjects.h"
|
||||
|
||||
bool RevealGatheringItemAction::Execute(Event event)
|
||||
{
|
||||
|
||||
@@ -314,7 +314,7 @@ bool SpiritHealerAction::Execute(Event event)
|
||||
for (GuidVector::iterator i = npcs.begin(); i != npcs.end(); i++)
|
||||
{
|
||||
Unit* unit = botAI->GetUnit(*i);
|
||||
if (unit && unit->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPIRITHEALER))
|
||||
if (unit && unit->HasNpcFlag(UNIT_NPC_FLAG_SPIRITHEALER))
|
||||
{
|
||||
LOG_DEBUG("playerbots", "Bot {} {}:{} <{}> revives at spirit healer", bot->GetGUID().ToString().c_str(),
|
||||
bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(), bot->GetName());
|
||||
|
||||
@@ -50,7 +50,6 @@ bool RpgAction::SetNextRpgAction()
|
||||
std::vector<uint32> relevances;
|
||||
std::vector<TriggerNode*> triggerNodes;
|
||||
|
||||
|
||||
for (auto& strategy : botAI->GetAiObjectContext()->GetSupportedStrategies())
|
||||
{
|
||||
if (strategy.find("rpg") == std::string::npos)
|
||||
|
||||
@@ -195,7 +195,7 @@ void ChatReplyAction::ChatReplyDo(Player* bot, uint32& type, uint32& guid1, uint
|
||||
}
|
||||
|
||||
ChatChannelSource chatChannelSource = GET_PLAYERBOT_AI(bot)->GetChatChannelSource(bot, type, chanName);
|
||||
if ( (msg.starts_with("LFG") || msg.starts_with("LFM")) && HandleLFGQuestsReply(bot, chatChannelSource, msg, name))
|
||||
if ((msg.starts_with("LFG") || msg.starts_with("LFM")) && HandleLFGQuestsReply(bot, chatChannelSource, msg, name))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ bool SetHomeAction::Execute(Event event)
|
||||
}
|
||||
|
||||
if (Unit* unit = botAI->GetUnit(selection))
|
||||
if (unit->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_INNKEEPER))
|
||||
if (unit->HasNpcFlag(UNIT_NPC_FLAG_INNKEEPER))
|
||||
{
|
||||
if (isRpgAction)
|
||||
{
|
||||
|
||||
@@ -120,7 +120,8 @@ void SuggestWhatToDoAction::grindMaterials()
|
||||
|
||||
for (std::map<std::string, double>::iterator i = categories.begin(); i != categories.end(); ++i)
|
||||
{
|
||||
if (urand(0, 10) < 3) {
|
||||
if (urand(0, 10) < 3)
|
||||
{
|
||||
std::string name = i->first;
|
||||
double multiplier = i->second;
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ bool TameAction::Execute(Event event)
|
||||
std::ostringstream oss;
|
||||
oss << "Available pet families: ";
|
||||
size_t count = 0;
|
||||
for (const auto& name : normalFamilies)
|
||||
for (auto const& name : normalFamilies)
|
||||
{
|
||||
if (count++ != 0)
|
||||
oss << ", ";
|
||||
@@ -93,7 +93,7 @@ bool TameAction::Execute(Event event)
|
||||
oss << " | ";
|
||||
oss << "Exotic: ";
|
||||
count = 0;
|
||||
for (const auto& name : exoticFamilies)
|
||||
for (auto const& name : exoticFamilies)
|
||||
{
|
||||
if (count++ != 0)
|
||||
oss << ", ";
|
||||
|
||||
@@ -18,4 +18,3 @@ public:
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ bool TradeAction::Execute(Event event)
|
||||
std::string const text = event.getParam();
|
||||
|
||||
// If text starts with any excluded prefix, don't process it further.
|
||||
for (const auto& prefix : sPlayerbotAIConfig->tradeActionExcludedPrefixes)
|
||||
for (auto const& prefix : sPlayerbotAIConfig->tradeActionExcludedPrefixes)
|
||||
{
|
||||
if (text.find(prefix) == 0)
|
||||
return false;
|
||||
|
||||
@@ -172,7 +172,7 @@ bool MaintenanceAction::Execute(Event event)
|
||||
PlayerbotFactory factory(bot, bot->GetLevel());
|
||||
|
||||
if (!botAI->IsAlt())
|
||||
{
|
||||
{
|
||||
factory.InitAttunementQuests();
|
||||
factory.InitBags(false);
|
||||
factory.InitAmmo();
|
||||
@@ -194,7 +194,7 @@ bool MaintenanceAction::Execute(Event event)
|
||||
if (bot->GetLevel() >= sPlayerbotAIConfig->minEnchantingBotLevel)
|
||||
factory.ApplyEnchantAndGemsNew();
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
if (sPlayerbotAIConfig->altMaintenanceAttunementQs)
|
||||
factory.InitAttunementQuests();
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "Event.h"
|
||||
#include "GridNotifiers.h"
|
||||
#include "GridNotifiersImpl.h"
|
||||
#include "NearestGameObjects.h"
|
||||
#include "PlayerbotAIConfig.h"
|
||||
#include "Playerbots.h"
|
||||
#include "PositionValue.h"
|
||||
@@ -54,24 +55,6 @@ bool UseMeetingStoneAction::Execute(Event event)
|
||||
return Teleport(master, bot);
|
||||
}
|
||||
|
||||
class AnyGameObjectInObjectRangeCheck
|
||||
{
|
||||
public:
|
||||
AnyGameObjectInObjectRangeCheck(WorldObject const* obj, float range) : i_obj(obj), i_range(range) {}
|
||||
WorldObject const& GetFocusObject() const { return *i_obj; }
|
||||
bool operator()(GameObject* go)
|
||||
{
|
||||
if (go && i_obj->IsWithinDistInMap(go, i_range) && go->isSpawned() && go->GetGOInfo())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
WorldObject const* i_obj;
|
||||
float i_range;
|
||||
};
|
||||
|
||||
bool SummonAction::Execute(Event event)
|
||||
{
|
||||
Player* master = GetMaster();
|
||||
@@ -134,7 +117,7 @@ bool SummonAction::SummonUsingNpcs(Player* summoner, Player* player)
|
||||
|
||||
for (Unit* unit : targets)
|
||||
{
|
||||
if (unit && unit->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_INNKEEPER))
|
||||
if (unit && unit->HasNpcFlag(UNIT_NPC_FLAG_INNKEEPER))
|
||||
{
|
||||
if (!player->HasItemCount(6948, 1, false))
|
||||
{
|
||||
@@ -242,7 +225,7 @@ bool SummonAction::Teleport(Player* summoner, Player* player)
|
||||
}
|
||||
}
|
||||
|
||||
if(summoner != player)
|
||||
if (summoner != player)
|
||||
botAI->TellError("Not enough place to summon");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -97,4 +97,3 @@ std::vector<uint32> WorldBuffAction::NeedWorldBuffs(Unit* unit)
|
||||
|
||||
return retVec;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ bool XpGainAction::Execute(Event event)
|
||||
{
|
||||
context->GetValue<uint32>("death count")->Set(0);
|
||||
|
||||
|
||||
WorldPacket p(event.getPacket()); // (8+4+1+4+8)
|
||||
ObjectGuid guid;
|
||||
// uint32 xpgain;
|
||||
|
||||
Reference in New Issue
Block a user