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 "DropQuestAction.h"
#include "ChatHelper.h"
#include "Event.h"
#include "Playerbots.h"
@@ -56,32 +58,32 @@ bool CleanQuestLogAction::Execute(Event event)
uint8 totalQuests = 0;
DropQuestType(totalQuests); //Count the total quests
DropQuestType(totalQuests); // Count the total quests
if (MAX_QUEST_LOG_SIZE - totalQuests > 6)
return true;
if (AI_VALUE(bool, "can fight equal")) // Only drop gray quests when able to fight proper lvl quests.
if (AI_VALUE(bool, "can fight equal")) // Only drop gray quests when able to fight proper lvl quests.
{
DropQuestType(totalQuests, MAX_QUEST_LOG_SIZE - 6); // Drop gray/red quests.
DropQuestType(totalQuests, MAX_QUEST_LOG_SIZE - 6, false, true); // Drop gray/red quests with progress.
DropQuestType(totalQuests, MAX_QUEST_LOG_SIZE - 6, false, true, true); // Drop gray/red completed quests.
DropQuestType(totalQuests, MAX_QUEST_LOG_SIZE - 6); // Drop gray/red quests.
DropQuestType(totalQuests, MAX_QUEST_LOG_SIZE - 6, false, true); // Drop gray/red quests with progress.
DropQuestType(totalQuests, MAX_QUEST_LOG_SIZE - 6, false, true, true); // Drop gray/red completed quests.
}
if (MAX_QUEST_LOG_SIZE - totalQuests > 4)
return true;
DropQuestType(totalQuests, MAX_QUEST_LOG_SIZE - 4, true); //Drop quests without progress.
DropQuestType(totalQuests, MAX_QUEST_LOG_SIZE - 4, true); // Drop quests without progress.
if (MAX_QUEST_LOG_SIZE - totalQuests > 2)
return true;
DropQuestType(totalQuests, MAX_QUEST_LOG_SIZE - 2, true, true); //Drop quests with progress.
DropQuestType(totalQuests, MAX_QUEST_LOG_SIZE - 2, true, true); // Drop quests with progress.
if (MAX_QUEST_LOG_SIZE - totalQuests > 0)
return true;
DropQuestType(totalQuests, MAX_QUEST_LOG_SIZE - 1, true, true, true); //Drop completed quests.
DropQuestType(totalQuests, MAX_QUEST_LOG_SIZE - 1, true, true, true); // Drop completed quests.
if (MAX_QUEST_LOG_SIZE - totalQuests > 0)
return true;
@@ -101,23 +103,26 @@ void CleanQuestLogAction::DropQuestType(uint8& numQuest, uint8 wantNum, bool isG
if (!quest)
continue;
if (quest->GetRequiredClasses() && (quest->GetRewSpellCast() || quest->GetRewSpell())) //Do not drop class specific quests that learn spells.
if (quest->GetRequiredClasses() &&
(quest->GetRewSpellCast() || quest->GetRewSpell())) // Do not drop class specific quests that learn spells.
continue;
if (quest->GetRequiredClasses() && (quest->GetRewSpellCast() || quest->GetRewSpell())) // Do not drop class specific quests that learn spells.
if (quest->GetRequiredClasses() &&
(quest->GetRewSpellCast() || quest->GetRewSpell())) // Do not drop class specific quests that learn spells.
continue;
if (wantNum == 100)
numQuest++;
int32 lowLevelDiff = sWorld->getIntConfig(CONFIG_QUEST_LOW_LEVEL_HIDE_DIFF);
if (lowLevelDiff < 0 || bot->GetLevel() <= bot->GetQuestLevel(quest) + uint32(lowLevelDiff)) // Quest is not gray
if (lowLevelDiff < 0 ||
bot->GetLevel() <= bot->GetQuestLevel(quest) + uint32(lowLevelDiff)) // Quest is not gray
{
if (bot->GetLevel() + 5 > bot->GetQuestLevel(quest)) // Quest is not red
if (bot->GetLevel() + 5 > bot->GetQuestLevel(quest)) // Quest is not red
if (!isGreen)
continue;
}
else // Quest is gray
else // Quest is gray
{
if (isGreen)
continue;
@@ -129,13 +134,13 @@ void CleanQuestLogAction::DropQuestType(uint8& numQuest, uint8 wantNum, bool isG
if (bot->GetQuestStatus(questId) == QUEST_STATUS_COMPLETE && !isComplete)
continue;
if (numQuest <= wantNum && bot->GetQuestStatus(questId) != QUEST_STATUS_FAILED) // Always drop failed quests
if (numQuest <= wantNum && bot->GetQuestStatus(questId) != QUEST_STATUS_FAILED) // Always drop failed quests
continue;
//Drop quest.
// Drop quest.
bot->SetQuestSlot(slot, 0);
//We ignore unequippable quest items in this case, its' still be equipped
// We ignore unequippable quest items in this case, its' still be equipped
bot->TakeQuestSourceItem(questId, false);
bot->SetQuestStatus(questId, QUEST_STATUS_NONE);
@@ -163,7 +168,7 @@ bool CleanQuestLogAction::HasProgress(Player* bot, Quest const* quest)
if (quest->RequiredItemId[i])
{
int required = quest->RequiredItemCount[i];
int required = quest->RequiredItemCount[i];
int available = questStatus.ItemCount[i];
if (available > 0 && required > 0)
return true;
@@ -171,7 +176,7 @@ bool CleanQuestLogAction::HasProgress(Player* bot, Quest const* quest)
if (quest->RequiredNpcOrGo[i])
{
int required = quest->RequiredNpcOrGoCount[i];
int required = quest->RequiredNpcOrGoCount[i];
int available = questStatus.CreatureOrGOCount[i];
if (available > 0 && required > 0)