Skip to content

Commit

Permalink
Revert "Swarm emote combo fix (#511)" (#513)
Browse files Browse the repository at this point in the history
This reverts commit e750020.
  • Loading branch information
slugalisk authored Nov 13, 2023
1 parent e750020 commit ec8f451
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion assets/chat/js/const.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ const TAGS = [
"weeb",
];

const SEASON = "december";
const SEASON = "june";

module.exports = {
KEYCODES,
Expand Down
4 changes: 2 additions & 2 deletions assets/chat/js/formatters.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ function moveModifierToFront(modifierList, modifierName) {
return modifierList;
}

class DisabledFormatter {
class IdentityFormatter {
format(chat, str, message = null) {
return str;
}
Expand Down Expand Up @@ -750,7 +750,7 @@ export {
EmoteFormatter,
GreenTextFormatter,
HtmlTextFormatter,
DisabledFormatter as IdentityFormatter,
IdentityFormatter,
MentionedUserFormatter,
RawEmoteFormatter,
SpoilerFormatter,
Expand Down
16 changes: 7 additions & 9 deletions assets/chat/js/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
HtmlTextFormatter,
MentionedUserFormatter,
UrlFormatter,
DisabledFormatter,
IdentityFormatter,
CodeFormatter,
SpoilerFormatter
} from "./formatters";
Expand Down Expand Up @@ -36,9 +36,9 @@ formatters.set("green", new GreenTextFormatter());

function setFormattersFromSettings(settings) {
if (!settings.get("formatter-emote"))
formatters.set("emote", new DisabledFormatter());
formatters.set("emote", new IdentityFormatter());
if (!settings.get("formatter-green"))
formatters.set("green", new DisabledFormatter());
formatters.set("green", new IdentityFormatter());
}

function buildMessageTxt(chat, message) {
Expand Down Expand Up @@ -440,11 +440,9 @@ function ChatEmoteMessageCount(message) {
if (!message._combo) console.error("no combo", message._combo);
message._combo.attr("class", "chat-combo" + stepClass);

// TODO: currently this does not get hit on "2x" combos, and requires a hack to get swarm emotes to work properly.
// consider finding the reason why it isn't going into this function on "2x" combos and swarm emote hack in the "afterRender" function in the ChatEmoteMessage class
if (
SWARM_EMOTES.includes(message.message.split(":")[0]) &&
message.emotecount <= 6 && !(formatters.get("emote") instanceof DisabledFormatter)
message.emotecount <= 6
) {
message._text.attr("class", message.message.split(":")[0] + "Combo");

Expand All @@ -454,7 +452,7 @@ function ChatEmoteMessageCount(message) {
"</span> </span> </span>";
let html = "";

// for every combo attach 1 emote
// for every combo attatch 1 emote
for (let i = 0; i < message.emotecount; i++) {
html += temp;
}
Expand Down Expand Up @@ -496,8 +494,8 @@ class ChatEmoteMessage extends ChatMessage {
" ",
this._combo_txt
);
// this fixes a bug when an emote hits "2x" it does not enter the ChatEmoteMessageCount function until 3x
if (SWARM_EMOTES.includes(this.message.split(":")[0]) && !(formatters.get("emote") instanceof DisabledFormatter)) {

if (SWARM_EMOTES.includes(this.message.split(":")[0])) {
this._text.attr("class", this.message.split(":")[0] + "Combo");
this._text.append(
`${formatters.get("emote").format(chat, this.message, this)}`
Expand Down

0 comments on commit ec8f451

Please sign in to comment.