Run clang-format

This commit is contained in:
Yunfan Li
2024-08-04 10:23:36 +08:00
parent 44da167492
commit 53611c9040
835 changed files with 35085 additions and 31861 deletions

View File

@@ -1,8 +1,10 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license, you may redistribute it and/or modify it under version 2 of the License, or (at your option), any later version.
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license, you may redistribute it
* and/or modify it under version 2 of the License, or (at your option), any later version.
*/
#include "LfgActions.h"
#include "AiFactory.h"
#include "ItemVisitors.h"
#include "LFGMgr.h"
@@ -10,10 +12,7 @@
using namespace lfg;
bool LfgJoinAction::Execute(Event event)
{
return JoinLFG();
}
bool LfgJoinAction::Execute(Event event) { return JoinLFG(); }
uint32 LfgJoinAction::GetRoles()
{
@@ -87,8 +86,11 @@ bool LfgJoinAction::JoinLFG()
ItemCountByQuality visitor;
IterateItems(&visitor, ITERATE_ITEMS_IN_EQUIP);
bool random = urand(0, 100) < 20;
bool heroic = urand(0, 100) < 50 && (visitor.count[ITEM_QUALITY_EPIC] >= 3 || visitor.count[ITEM_QUALITY_RARE] >= 10) && bot->GetLevel() >= 70;
bool rbotAId = !heroic && (urand(0, 100) < 50 && visitor.count[ITEM_QUALITY_EPIC] >= 5 && (bot->GetLevel() == 60 || bot->GetLevel() == 70 || bot->GetLevel() == 80));
bool heroic = urand(0, 100) < 50 &&
(visitor.count[ITEM_QUALITY_EPIC] >= 3 || visitor.count[ITEM_QUALITY_RARE] >= 10) &&
bot->GetLevel() >= 70;
bool rbotAId = !heroic && (urand(0, 100) < 50 && visitor.count[ITEM_QUALITY_EPIC] >= 5 &&
(bot->GetLevel() == 60 || bot->GetLevel() == 70 || bot->GetLevel() == 80));
LfgDungeonSet list;
std::vector<uint32> selected;
@@ -100,16 +102,15 @@ bool LfgJoinAction::JoinLFG()
for (std::vector<uint32>::iterator i = dungeons.begin(); i != dungeons.end(); ++i)
{
LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(*i);
if (!dungeon || (dungeon->TypeID != LFG_TYPE_RANDOM && dungeon->TypeID != LFG_TYPE_DUNGEON && dungeon->TypeID != LFG_TYPE_HEROIC && dungeon->TypeID != LFG_TYPE_RAID))
if (!dungeon || (dungeon->TypeID != LFG_TYPE_RANDOM && dungeon->TypeID != LFG_TYPE_DUNGEON &&
dungeon->TypeID != LFG_TYPE_HEROIC && dungeon->TypeID != LFG_TYPE_RAID))
continue;
const auto& 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)
||
(botLevel > dungeon->MinLevel + 10 && dungeon->TypeID == LFG_TYPE_DUNGEON)
)
/*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) ||
(botLevel > dungeon->MinLevel + 10 && dungeon->TypeID == LFG_TYPE_DUNGEON))
continue;
selected.push_back(dungeon->ID);
@@ -137,9 +138,9 @@ bool LfgJoinAction::JoinLFG()
if (roleMask & PLAYER_ROLE_DAMAGE)
_roles = "DPS";
LOG_INFO("playerbots", "Bot {} {}:{} <{}>: queues LFG, Dungeon as {} ({})",
bot->GetGUID().ToString().c_str(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H",
bot->GetLevel(), bot->GetName().c_str(), _roles, many ? "several dungeons" : dungeon->Name[0]);
LOG_INFO("playerbots", "Bot {} {}:{} <{}>: queues LFG, Dungeon as {} ({})", bot->GetGUID().ToString().c_str(),
bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(), bot->GetName().c_str(), _roles,
many ? "several dungeons" : dungeon->Name[0]);
// Set RbotAId Browser comment
std::string const _gs = std::to_string(botAI->GetEquipGearScore(bot, false, false));
@@ -161,8 +162,8 @@ bool LfgRoleCheckAction::Execute(Event event)
sLFGMgr->UpdateRoleCheck(group->GetGUID(), bot->GetGUID(), newRoles);
LOG_INFO("playerbots", "Bot {} {}:{} <{}>: LFG roles checked",
bot->GetGUID().ToString().c_str(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(), bot->GetName().c_str());
LOG_INFO("playerbots", "Bot {} {}:{} <{}>: LFG roles checked", bot->GetGUID().ToString().c_str(),
bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(), bot->GetName().c_str());
return true;
}
@@ -179,19 +180,20 @@ bool LfgAcceptAction::Execute(Event event)
uint32 id = AI_VALUE(uint32, "lfg proposal");
if (id)
{
//if (urand(0, 1 + 10 / sPlayerbotAIConfig->randomChangeMultiplier))
// return false;
// if (urand(0, 1 + 10 / sPlayerbotAIConfig->randomChangeMultiplier))
// return false;
if (bot->IsInCombat() || bot->isDead())
{
LOG_INFO("playerbots", "Bot {} {}:{} <{}> is in combat and refuses LFG proposal {}",
bot->GetGUID().ToString().c_str(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(), bot->GetName().c_str(), id);
bot->GetGUID().ToString().c_str(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(),
bot->GetName().c_str(), id);
sLFGMgr->UpdateProposal(id, bot->GetGUID(), false);
return true;
}
LOG_INFO("playerbots", "Bot {} {}:{} <{}> accepts LFG proposal {}",
bot->GetGUID().ToString().c_str(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(), bot->GetName().c_str(), id);
LOG_INFO("playerbots", "Bot {} {}:{} <{}> accepts LFG proposal {}", bot->GetGUID().ToString().c_str(),
bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(), bot->GetName().c_str(), id);
botAI->GetAiObjectContext()->GetValue<uint32>("lfg proposal")->Set(0);
@@ -203,7 +205,7 @@ bool LfgAcceptAction::Execute(Event event)
{
sRandomPlayerbotMgr->Refresh(bot);
botAI->ResetStrategies();
//bot->TeleportToHomebind();
// bot->TeleportToHomebind();
}
botAI->Reset();
@@ -225,7 +227,7 @@ bool LfgAcceptAction::Execute(Event event)
bool LfgLeaveAction::Execute(Event event)
{
// Don't leave if lfg strategy enabled
//if (botAI->HasStrategy("lfg", BOT_STATE_NON_COMBAT))
// if (botAI->HasStrategy("lfg", BOT_STATE_NON_COMBAT))
// return false;
// Don't leave if already invited / in dungeon
@@ -236,10 +238,7 @@ bool LfgLeaveAction::Execute(Event event)
return true;
}
bool LfgLeaveAction::isUseful()
{
return true;
}
bool LfgLeaveAction::isUseful() { return true; }
bool LfgTeleportAction::Execute(Event event)
{
@@ -263,16 +262,17 @@ bool LfgJoinAction::isUseful()
{
if (!sPlayerbotAIConfig->randomBotJoinLfg)
{
//botAI->ChangeStrategy("-lfg", BOT_STATE_NON_COMBAT);
// botAI->ChangeStrategy("-lfg", BOT_STATE_NON_COMBAT);
return false;
}
if (bot->GetLevel() < 15)
return false;
if ((botAI->GetMaster() && !GET_PLAYERBOT_AI(botAI->GetMaster())) || bot->GetGroup() && bot->GetGroup()->GetLeaderGUID() != bot->GetGUID())
if ((botAI->GetMaster() && !GET_PLAYERBOT_AI(botAI->GetMaster())) ||
bot->GetGroup() && bot->GetGroup()->GetLeaderGUID() != bot->GetGUID())
{
//botAI->ChangeStrategy("-lfg", BOT_STATE_NON_COMBAT);
// botAI->ChangeStrategy("-lfg", BOT_STATE_NON_COMBAT);
return false;
}