[Diawind] Plus sign markdown fix (#2727)

This commit is contained in:
Chris Miles 2023-01-12 10:39:59 -06:00 committed by GitHub
parent 6d13f46c40
commit db7ab7a3ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -69,12 +69,13 @@ void DialogueWindow::Render(Client *c, std::string markdown)
std::string animation = Strings::GetBetween(output, "+", "+");
if (!animation.empty()) {
LogDiaWind("Client [{}] Animation is not empty, contents are [{}]", c->GetCleanName(), animation);
Strings::FindReplace(output, fmt::format("+{}+", animation), "");
// we treat the animation field differently if it is a number
bool found_animation = false;
if (Strings::IsNumber(animation)) {
LogDiaWindDetail("Client [{}] Animation is a number, firing animation [{}]", c->GetCleanName(), animation);
target->DoAnim(std::stoi(animation));
found_animation = true;
}
else {
for (auto &a: animations) {
@ -86,9 +87,14 @@ void DialogueWindow::Render(Client *c, std::string markdown)
a.first
);
target->DoAnim(a.second);
found_animation = true;
}
}
}
if (found_animation) {
Strings::FindReplace(output, fmt::format("+{}+", animation), "");
}
}
if (animation.empty() && RuleB(Chat, DialogueWindowAnimatesNPCsIfNoneSet)) {