Merge code line

This commit is contained in:
Atidot3
2024-08-04 12:04:06 +02:00
838 changed files with 34803 additions and 31551 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"
@@ -64,35 +66,40 @@ bool CleanQuestLogAction::Execute(Event event)
return false;
uint8 totalQuests = 0;
DropQuestType(totalQuests); //Count the total quests
// Count the total quests
DropQuestType(totalQuests);
if (MAX_QUEST_LOG_SIZE - totalQuests > 6)
{
DropQuestType(totalQuests, MAX_QUEST_LOG_SIZE, true, true); //Drop failed quests
// Drop failed quests
DropQuestType(totalQuests, MAX_QUEST_LOG_SIZE, true, true);
return true;
}
if (AI_VALUE(bool, "can fight equal")) //Only drop gray quests when able to fight proper lvl quests.
// Only drop gray quests when able to fight proper lvl quests.
if (AI_VALUE(bool, "can fight equal"))
{
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.
// Drop gray/red quests.
DropQuestType(totalQuests, MAX_QUEST_LOG_SIZE - 6);
// Drop gray/red quests with progress.
DropQuestType(totalQuests, MAX_QUEST_LOG_SIZE - 6, false, true);
// Drop gray/red completed quests.
DropQuestType(totalQuests, MAX_QUEST_LOG_SIZE - 6, false, true, true);
}
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;
@@ -132,13 +139,14 @@ void CleanQuestLogAction::DropQuestType(uint8& numQuest, uint8 wantNum, bool isG
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;
@@ -150,13 +158,14 @@ void CleanQuestLogAction::DropQuestType(uint8& numQuest, uint8 wantNum, bool isG
if (bot->GetQuestStatus(questId) == QUEST_STATUS_COMPLETE && !isComplete)
continue;
// Always drop failed quests
if (numQuest <= wantNum && bot->GetQuestStatus(questId) != QUEST_STATUS_FAILED)
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);
@@ -190,7 +199,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;
@@ -198,7 +207,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)