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 "GuildCreateActions.h"
#include "ArenaTeam.h"
#include "BudgetValues.h"
#include "Event.h"
@@ -13,7 +15,7 @@
bool BuyPetitionAction::Execute(Event event)
{
GuidVector vendors = botAI->GetAiObjectContext()->GetValue<GuidVector >("nearest npcs")->Get();
GuidVector vendors = botAI->GetAiObjectContext()->GetValue<GuidVector>("nearest npcs")->Get();
bool vendored = false, result = false;
for (GuidVector::iterator i = vendors.begin(); i != vendors.end(); ++i)
{
@@ -48,7 +50,7 @@ bool BuyPetitionAction::Execute(Event event)
for (uint8 i = 0; i < 10; ++i)
data << std::string("");
data << uint32(0); // index
data << uint32(0); // index
data << uint32(0);
bot->GetSession()->HandlePetitionBuyOpcode(data);
@@ -59,10 +61,7 @@ bool BuyPetitionAction::Execute(Event event)
return false;
}
bool BuyPetitionAction::isUseful()
{
return canBuyPetition(bot);
};
bool BuyPetitionAction::isUseful() { return canBuyPetition(bot); };
bool BuyPetitionAction::canBuyPetition(Player* bot)
{
@@ -87,7 +86,7 @@ bool BuyPetitionAction::canBuyPetition(Player* bot)
if (!botAI->HasStrategy("guild", BOT_STATE_NON_COMBAT))
return false;
uint32 cost = 1000; //GUILD_CHARTER_COST;
uint32 cost = 1000; // GUILD_CHARTER_COST;
if (AI_VALUE2(uint32, "free money for", uint32(NeedMoneyFor::guild)) < cost)
return false;
@@ -97,10 +96,10 @@ bool BuyPetitionAction::canBuyPetition(Player* bot)
bool PetitionOfferAction::Execute(Event event)
{
uint32 petitionEntry = 5863; //GUILD_CHARTER
uint32 petitionEntry = 5863; // GUILD_CHARTER
std::vector<Item*> petitions = AI_VALUE2(std::vector<Item*>, "inventory items", chat->FormatQItem(5863));
if (petitions.empty())
if (petitions.empty())
return false;
ObjectGuid guid = event.getObject();
@@ -131,8 +130,9 @@ bool PetitionOfferAction::Execute(Event event)
data << petitions.front()->GetGUID();
data << guid;
QueryResult result = CharacterDatabase.Query("SELECT playerguid FROM petition_sign WHERE player_account = {} AND petitionguid = {}",
player->GetSession()->GetAccountId(), petitions.front()->GetGUID().GetCounter());
QueryResult result =
CharacterDatabase.Query("SELECT playerguid FROM petition_sign WHERE player_account = {} AND petitionguid = {}",
player->GetSession()->GetAccountId(), petitions.front()->GetGUID().GetCounter());
if (result)
{
return false;
@@ -140,7 +140,8 @@ bool PetitionOfferAction::Execute(Event event)
bot->GetSession()->HandleOfferPetitionOpcode(data);
result = CharacterDatabase.Query("SELECT playerguid FROM petition_sign WHERE petitionguid = {}", petitions.front()->GetGUID().GetCounter());
result = CharacterDatabase.Query("SELECT playerguid FROM petition_sign WHERE petitionguid = {}",
petitions.front()->GetGUID().GetCounter());
uint8 signs = result ? (uint8)result->GetRowCount() : 0;
context->GetValue<uint8>("petition signs")->Set(signs);
@@ -148,16 +149,13 @@ bool PetitionOfferAction::Execute(Event event)
return true;
}
bool PetitionOfferAction::isUseful()
{
return !bot->GetGuildId();
}
bool PetitionOfferAction::isUseful() { return !bot->GetGuildId(); }
bool PetitionOfferNearbyAction::Execute(Event event)
{
uint32 found = 0;
GuidVector nearGuids = botAI->GetAiObjectContext()->GetValue<GuidVector >("nearest friendly players")->Get();
GuidVector nearGuids = botAI->GetAiObjectContext()->GetValue<GuidVector>("nearest friendly players")->Get();
for (auto& i : nearGuids)
{
Player* player = ObjectAccessor::FindPlayer(i);
@@ -180,7 +178,7 @@ bool PetitionOfferNearbyAction::Execute(Event event)
continue;
*/
if (botAI->HasActivePlayerMaster()) //Do not invite alts of active players.
if (botAI->HasActivePlayerMaster()) // Do not invite alts of active players.
continue;
}
else
@@ -192,7 +190,7 @@ bool PetitionOfferNearbyAction::Execute(Event event)
if (sServerFacade->GetDistance2d(bot, player) > sPlayerbotAIConfig->sightDistance)
continue;
//Parse rpg target to quest action.
// Parse rpg target to quest action.
WorldPacket p(CMSG_QUESTGIVER_ACCEPT_QUEST);
p << i;
p.rpos(0);
@@ -206,12 +204,13 @@ bool PetitionOfferNearbyAction::Execute(Event event)
bool PetitionOfferNearbyAction::isUseful()
{
return !bot->GetGuildId() && AI_VALUE2(uint32, "item count", chat->FormatQItem(5863)) && AI_VALUE(uint8, "petition signs") < sWorld->getIntConfig(CONFIG_MIN_PETITION_SIGNS);
return !bot->GetGuildId() && AI_VALUE2(uint32, "item count", chat->FormatQItem(5863)) &&
AI_VALUE(uint8, "petition signs") < sWorld->getIntConfig(CONFIG_MIN_PETITION_SIGNS);
}
bool PetitionTurnInAction::Execute(Event event)
{
GuidVector vendors = botAI->GetAiObjectContext()->GetValue<GuidVector >("nearest npcs")->Get();
GuidVector vendors = botAI->GetAiObjectContext()->GetValue<GuidVector>("nearest npcs")->Get();
bool vendored = false, result = false;
std::vector<Item*> petitions = AI_VALUE2(std::vector<Item*>, "inventory items", chat->FormatQItem(5863));
@@ -250,7 +249,7 @@ bool PetitionTurnInAction::Execute(Event event)
guild->HandleSetEmblem(emblemInfo);
//LANG_GUILD_VETERAN -> can invite
// LANG_GUILD_VETERAN -> can invite
guild->HandleSetRankInfo(2, GR_RIGHT_GCHATLISTEN | GR_RIGHT_GCHATSPEAK | GR_RIGHT_INVITE);
}
@@ -259,10 +258,10 @@ bool PetitionTurnInAction::Execute(Event event)
TravelTarget* oldTarget = context->GetValue<TravelTarget*>("travel target")->Get();
//Select a new target to travel to.
// Select a new target to travel to.
TravelTarget newTarget = TravelTarget(botAI);
bool foundTarget = SetNpcFlagTarget(&newTarget, { UNIT_NPC_FLAG_PETITIONER });
bool foundTarget = SetNpcFlagTarget(&newTarget, {UNIT_NPC_FLAG_PETITIONER});
if (!foundTarget || !newTarget.isActive())
return false;
@@ -284,7 +283,8 @@ bool PetitionTurnInAction::isUseful()
}
return inCity && !bot->GetGuildId() && AI_VALUE2(uint32, "item count", chat->FormatQItem(5863)) &&
AI_VALUE(uint8, "petition signs") >= sWorld->getIntConfig(CONFIG_MIN_PETITION_SIGNS) && !context->GetValue<TravelTarget*>("travel target")->Get()->isTraveling();
AI_VALUE(uint8, "petition signs") >= sWorld->getIntConfig(CONFIG_MIN_PETITION_SIGNS) &&
!context->GetValue<TravelTarget*>("travel target")->Get()->isTraveling();
}
bool BuyTabardAction::Execute(Event event)
@@ -295,10 +295,10 @@ bool BuyTabardAction::Execute(Event event)
TravelTarget* oldTarget = context->GetValue<TravelTarget*>("travel target")->Get();
//Select a new target to travel to.
// Select a new target to travel to.
TravelTarget newTarget = TravelTarget(botAI);
bool foundTarget = SetNpcFlagTarget(&newTarget, { UNIT_NPC_FLAG_TABARDDESIGNER }, "Tabard Vendor", { 5976 });
bool foundTarget = SetNpcFlagTarget(&newTarget, {UNIT_NPC_FLAG_TABARDDESIGNER}, "Tabard Vendor", {5976});
if (!foundTarget || !newTarget.isActive())
return false;
@@ -320,5 +320,6 @@ bool BuyTabardAction::isUseful()
}
return inCity && bot->GetGuildId() && !AI_VALUE2(uint32, "item count", chat->FormatQItem(5976)) &&
AI_VALUE2(uint32, "free money for", uint32(NeedMoneyFor::guild)) >= 10000 && !context->GetValue<TravelTarget*>("travel target")->Get()->isTraveling();
AI_VALUE2(uint32, "free money for", uint32(NeedMoneyFor::guild)) >= 10000 &&
!context->GetValue<TravelTarget*>("travel target")->Get()->isTraveling();
}