mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
[Talk] Disable ExtractAllItemIds for heavy regex
This commit is contained in:
@@ -1002,23 +1002,26 @@ void PlayerbotAI::HandleBotOutgoingPacket(WorldPacket const& packet)
|
||||
if (lang == LANG_ADDON)
|
||||
return;
|
||||
|
||||
if (message.starts_with(sPlayerbotAIConfig->toxicLinksPrefix)
|
||||
&& (GetChatHelper()->ExtractAllItemIds(message).size() > 0 || GetChatHelper()->ExtractAllQuestIds(message).size() > 0)
|
||||
&& sPlayerbotAIConfig->toxicLinksRepliesChance)
|
||||
{
|
||||
if (urand(0, 50) > 0 || urand(1, 100) > sPlayerbotAIConfig->toxicLinksRepliesChance)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if ((GetChatHelper()->ExtractAllItemIds(message).count(19019) && sPlayerbotAIConfig->thunderfuryRepliesChance))
|
||||
{
|
||||
if (urand(0, 60) > 0 || urand(1, 100) > sPlayerbotAIConfig->thunderfuryRepliesChance)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
// Disable since ExtractAllItemIds bad performance
|
||||
// if (message.starts_with(sPlayerbotAIConfig->toxicLinksPrefix) &&
|
||||
// (GetChatHelper()->ExtractAllItemIds(message).size() > 0 ||
|
||||
// GetChatHelper()->ExtractAllQuestIds(message).size() > 0) &&
|
||||
// sPlayerbotAIConfig->toxicLinksRepliesChance)
|
||||
// {
|
||||
// if (urand(0, 50) > 0 || urand(1, 100) > sPlayerbotAIConfig->toxicLinksRepliesChance)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// else if ((GetChatHelper()->ExtractAllItemIds(message).count(19019) &&
|
||||
// sPlayerbotAIConfig->thunderfuryRepliesChance))
|
||||
// {
|
||||
// if (urand(0, 60) > 0 || urand(1, 100) > sPlayerbotAIConfig->thunderfuryRepliesChance)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
{
|
||||
if (isFromFreeBot && urand(0, 20))
|
||||
return;
|
||||
@@ -2782,7 +2785,7 @@ bool PlayerbotAI::CanCastSpell(uint32 spellid, Unit* target, bool checkHasSpell,
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
if (target->IsImmunedToSpell(spellInfo))
|
||||
{
|
||||
if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster()))
|
||||
|
||||
Reference in New Issue
Block a user