mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-13 17:09:08 +00:00
Merge pull request #508 from atidot3/extractregexfix
Optimised ExtractAllQuestIds ExtractAllItemIds
This commit is contained in:
@@ -1005,26 +1005,25 @@ void PlayerbotAI::HandleBotOutgoingPacket(WorldPacket const& packet)
|
||||
if (lang == LANG_ADDON)
|
||||
return;
|
||||
|
||||
// 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 (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;
|
||||
|
||||
Reference in New Issue
Block a user