Fix crash:

PlayerbotAI::FindOilFor was making the server randomly crashing
ChooseTravelTargetAction::getNewTarget: when active bot groupping was making the server crash as looking for unexisting params

Several bug fixes and tweak to Quest and Group

New fucntionnality:
Bots will now share quests randomly to their party
Bots will try to accomplish group member quest before moving on to new target
Bots will try to sells items only after few levels ( 5 ) when in group
When dropping a quest bots will try to select a new one they are on instead of idling for few time
Bots will no longuer try to invite themselfs to group or if group is full
Bots are now allowed to leave party by themself
Bots in groupe if not leader are forbbiden to tag in bgs
Bots in bot-groups no have a more limited range to look for grind target

Polish logs
This commit is contained in:
antony
2024-07-31 12:26:48 +02:00
parent 2e63381d48
commit 274101c000
19 changed files with 214 additions and 52 deletions

View File

@@ -48,7 +48,7 @@ bool DropQuestAction::Execute(Event event)
{
const Quest* pQuest = sObjectMgr->GetQuestTemplate(entry);
const std::string text_quest = ChatHelper::FormatQuest(pQuest);
LOG_INFO("playerbots", "Quest [ {} ] removed", pQuest->GetTitle());
LOG_INFO("playerbots", "{} => Quest [ {} ] removed", bot->GetName(), pQuest->GetTitle());
bot->Say("Quest [ " + text_quest + " ] removed", LANG_UNIVERSAL);
}
@@ -103,7 +103,19 @@ bool CleanQuestLogAction::Execute(Event event)
void CleanQuestLogAction::DropQuestType(uint8& numQuest, uint8 wantNum, bool isGreen, bool hasProgress, bool isComplete)
{
std::vector<uint8> slots;
for (uint8 slot = 0; slot < MAX_QUEST_LOG_SIZE; ++slot)
slots.push_back(slot);
if (wantNum < 100)
{
std::random_device rd;
std::mt19937 g(rd());
std::shuffle(slots.begin(), slots.end(), g);
}
for (uint8 slot : slots)
{
uint32 questId = bot->GetQuestSlotQuestId(slot);
if (!questId)
@@ -153,6 +165,12 @@ void CleanQuestLogAction::DropQuestType(uint8& numQuest, uint8 wantNum, bool isG
numQuest--;
if (botAI->HasStrategy("debug quest", BotState::BOT_STATE_NON_COMBAT) || botAI->HasStrategy("debug rpg", BotState::BOT_STATE_COMBAT))
{
const std::string text_quest = ChatHelper::FormatQuest(quest);
LOG_INFO("playerbots", "{} => Quest [ {} ] removed", bot->GetName(), quest->GetTitle());
bot->Say("Quest [ " + text_quest + " ] removed", LANG_UNIVERSAL);
}
botAI->TellMaster("Quest removed" + chat->FormatQuest(quest));
}
}