Refactoring bot chat and sayaction caused by group crash <NOT FINISHED>

This commit is contained in:
Atidot3
2024-07-31 22:39:59 +02:00
parent f96f909b6e
commit 79d0f3fd28
10 changed files with 482 additions and 208 deletions

View File

@@ -219,6 +219,26 @@ std::string const ChatHelper::formatMoney(uint32 copper)
return out.str();
}
std::string ChatHelper::parseValue(const std::string& type, const std::string& text)
{
std::string retString;
std::string pattern = "Hvalue:" + type + ":";
int pos = text.find(pattern, 0);
if (pos == -1)
return retString;
pos += pattern.size();
int endPos = text.find('|', pos);
if (endPos == -1)
return retString;
retString = text.substr(pos, endPos - pos);
return retString;
}
uint32 ChatHelper::parseMoney(std::string const text)
{
// if user specified money in ##g##s##c format
@@ -604,4 +624,4 @@ std::set<uint32> ChatHelper::ExtractAllItemIds(const std::string& text)
}
return ids;
}
}