mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-13 09:07:19 +00:00
Rework in progress crash chat botgroup
This commit is contained in:
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user