hardcoded list of BTTV's christmas emotes
This commit is contained in:
@@ -103,6 +103,10 @@ enum class MessageElementFlag {
|
|||||||
LowercaseLink = (1 << 29),
|
LowercaseLink = (1 << 29),
|
||||||
OriginalLink = (1 << 30),
|
OriginalLink = (1 << 30),
|
||||||
|
|
||||||
|
// ZeroWidthEmotes are emotes that are supposed to overlay over any pre-existing emotes
|
||||||
|
// e.g. BTTV's SoSnowy during christmas season
|
||||||
|
ZeroWidthEmote = (1 << 31),
|
||||||
|
|
||||||
Default = Timestamp | Badges | Username | BitsStatic | FfzEmoteImage |
|
Default = Timestamp | Badges | Username | BitsStatic | FfzEmoteImage |
|
||||||
BttvEmoteImage | TwitchEmoteImage | BitsAmount | Text |
|
BttvEmoteImage | TwitchEmoteImage | BitsAmount | Text |
|
||||||
AlwaysShow,
|
AlwaysShow,
|
||||||
|
|||||||
@@ -115,15 +115,27 @@ void MessageLayoutContainer::_addElement(MessageLayoutElement *element,
|
|||||||
// update line height
|
// update line height
|
||||||
this->lineHeight_ = std::max(this->lineHeight_, newLineHeight);
|
this->lineHeight_ = std::max(this->lineHeight_, newLineHeight);
|
||||||
|
|
||||||
|
auto xOffset = 0;
|
||||||
|
|
||||||
|
if (element->getCreator().getFlags().has(
|
||||||
|
MessageElementFlag::ZeroWidthEmote))
|
||||||
|
{
|
||||||
|
xOffset -= element->getRect().width() + this->spaceWidth_;
|
||||||
|
}
|
||||||
|
|
||||||
// set move element
|
// set move element
|
||||||
element->setPosition(
|
element->setPosition(QPoint(this->currentX_ + xOffset,
|
||||||
QPoint(this->currentX_, this->currentY_ - element->getRect().height()));
|
this->currentY_ - element->getRect().height()));
|
||||||
|
|
||||||
// add element
|
// add element
|
||||||
this->elements_.push_back(std::unique_ptr<MessageLayoutElement>(element));
|
this->elements_.push_back(std::unique_ptr<MessageLayoutElement>(element));
|
||||||
|
|
||||||
// set current x
|
// set current x
|
||||||
this->currentX_ += element->getRect().width();
|
if (!element->getCreator().getFlags().has(
|
||||||
|
MessageElementFlag::ZeroWidthEmote))
|
||||||
|
{
|
||||||
|
this->currentX_ += element->getRect().width();
|
||||||
|
}
|
||||||
|
|
||||||
if (element->hasTrailingSpace())
|
if (element->hasTrailingSpace())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -28,6 +28,10 @@
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
const QStringList zeroWidthEmotes{
|
||||||
|
"SoSnowy", "IceCold", "SantaHat", "TopHat", "ReinDeer", "CandyCane",
|
||||||
|
};
|
||||||
|
|
||||||
QColor getRandomColor(const QVariant &userId)
|
QColor getRandomColor(const QVariant &userId)
|
||||||
{
|
{
|
||||||
static const std::vector<QColor> twitchUsernameColors = {
|
static const std::vector<QColor> twitchUsernameColors = {
|
||||||
@@ -1162,6 +1166,11 @@ Outcome TwitchMessageBuilder::tryAppendEmote(const EmoteName &name)
|
|||||||
else if ((emote = globalBttvEmotes.emote(name)))
|
else if ((emote = globalBttvEmotes.emote(name)))
|
||||||
{
|
{
|
||||||
flags = MessageElementFlag::BttvEmote;
|
flags = MessageElementFlag::BttvEmote;
|
||||||
|
|
||||||
|
if (zeroWidthEmotes.contains(name.string))
|
||||||
|
{
|
||||||
|
flags.set(MessageElementFlag::ZeroWidthEmote);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (emote)
|
if (emote)
|
||||||
|
|||||||
Reference in New Issue
Block a user