Rework in progress crash chat botgroup

This commit is contained in:
antony
2024-07-31 17:25:07 +02:00
parent 274101c000
commit f96f909b6e
11 changed files with 2484 additions and 1009 deletions

View File

@@ -7,6 +7,8 @@
#include "Playerbots.h"
#include "SpellInfo.h"
#include <regex>
std::map<std::string, uint32> ChatHelper::consumableSubClasses;
std::map<std::string, uint32> ChatHelper::tradeSubClasses;
std::map<std::string, uint32> ChatHelper::itemQualities;
@@ -571,3 +573,35 @@ void ChatHelper::eraseAllSubStr(std::string& mainStr, std::string const toErase)
mainStr.erase(pos, toErase.length());
}
}
std::set<uint32> ChatHelper::ExtractAllQuestIds(const std::string& text)
{
std::set<uint32> ids;
std::regex rgx("Hquest:[0-9]+");
auto begin = std::sregex_iterator(text.begin(), text.end(), rgx);
auto end = std::sregex_iterator();
for (std::sregex_iterator i = begin; i != end; ++i)
{
std::smatch match = *i;
ids.insert(std::stoi(match.str().erase(0, 7)));
}
return ids;
}
std::set<uint32> ChatHelper::ExtractAllItemIds(const std::string& text)
{
std::set<uint32> ids;
std::regex rgx("Hitem:[0-9]+");
auto begin = std::sregex_iterator(text.begin(), text.end(), rgx);
auto end = std::sregex_iterator();
for (std::sregex_iterator i = begin; i != end; ++i)
{
std::smatch match = *i;
ids.insert(std::stoi(match.str().erase(0, 6)));
}
return ids;
}