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 "GenericActions.h"
#include "CreatureAI.h"
#include "Playerbots.h"
@@ -15,54 +17,59 @@ bool MeleeAction::isUseful()
return true;
}
bool TogglePetSpellAutoCastAction::Execute(Event event) {
bool TogglePetSpellAutoCastAction::Execute(Event event)
{
Pet* pet = bot->GetPet();
if (!pet) {
if (!pet)
{
return false;
}
bool toggled = false;
for (PetSpellMap::const_iterator itr = pet->m_spells.begin(); itr != pet->m_spells.end(); ++itr)
{
if(itr->second.state == PETSPELL_REMOVED)
if (itr->second.state == PETSPELL_REMOVED)
continue;
uint32 spellId = itr->first;
const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (spellInfo->IsPassive())
continue;
bool shouldApply = true;
// imp's spell, felhunte's intelligence, ghoul's leap, cat stealth
if (spellId == 4511 || spellId == 1742 ||
spellId == 54424 || spellId == 57564 || spellId == 57565 || spellId == 57566 || spellId == 57567 ||
spellId == 47482 || spellId == 24450) {
if (spellId == 4511 || spellId == 1742 || spellId == 54424 || spellId == 57564 || spellId == 57565 ||
spellId == 57566 || spellId == 57567 || spellId == 47482 || spellId == 24450)
{
shouldApply = false;
}
bool isAutoCast = false;
for (unsigned int &m_autospell : pet->m_autospells)
{
if (m_autospell == spellId)
{
isAutoCast = true;
break;
}
}
if (shouldApply != isAutoCast) {
for (unsigned int& m_autospell : pet->m_autospells)
{
if (m_autospell == spellId)
{
isAutoCast = true;
break;
}
}
if (shouldApply != isAutoCast)
{
pet->ToggleAutocast(spellInfo, shouldApply);
toggled = true;
}
}
return toggled;
return toggled;
}
bool PetAttackAction::Execute(Event event)
{
Guardian* pet = bot->GetGuardianPet();
if (!pet) {
if (!pet)
{
return false;
}
Unit* target = AI_VALUE(Unit*, "current target");
if (!target) {
if (!target)
{
return false;
}
// pet->SetReactState(REACT_DEFENSIVE);