Allow bot to talk in guild when they loot nice item, levelup, kill unique monsters

This commit is contained in:
Atidot3
2024-07-28 01:02:54 +02:00
parent 00844985eb
commit 1fbd312d58
4 changed files with 59 additions and 7 deletions

View File

@@ -6,6 +6,7 @@
#include "Event.h"
#include "PlayerbotAIConfig.h"
#include "Playerbots.h"
#include "GuildMgr.h"
bool XpGainAction::Execute(Event event)
{
@@ -32,6 +33,25 @@ bool XpGainAction::Execute(Event event)
p >> groupBonus; // 8 group bonus
}
if (sPlayerbotAIConfig->randomBotTalk && bot->GetGuildId() && urand(0, 10))
{
Creature* creature = botAI->GetCreature(guid);
if (creature && (creature->isElite() || creature->isWorldBoss() || creature->GetLevel() > 61 || creature->GetLevel() > bot->GetLevel() + 4))
{
Guild* guild = sGuildMgr->GetGuildById(bot->GetGuildId());
if (guild)
{
std::map<std::string, std::string> placeholders;
placeholders["%name"] = creature->GetName();
if (urand(0, 3))
guild->BroadcastToGuild(bot->GetSession(), false, BOT_TEXT2("Wow I just killed %name!", placeholders), LANG_UNIVERSAL);
else
guild->BroadcastToGuild(bot->GetSession(), false, BOT_TEXT2("Awesome that %name went down quickly!", placeholders), LANG_UNIVERSAL);
}
}
}
Unit* victim = nullptr;
if (guid)
victim = botAI->GetUnit(guid);