Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swarm emote combo fix #511

Merged
merged 2 commits into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 = "june";
const SEASON = "december";

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 IdentityFormatter {
class DisabledFormatter {
format(chat, str, message = null) {
return str;
}
Expand Down Expand Up @@ -750,7 +750,7 @@ export {
EmoteFormatter,
GreenTextFormatter,
HtmlTextFormatter,
IdentityFormatter,
DisabledFormatter as IdentityFormatter,
MentionedUserFormatter,
RawEmoteFormatter,
SpoilerFormatter,
Expand Down
16 changes: 9 additions & 7 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,
IdentityFormatter,
DisabledFormatter,
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 IdentityFormatter());
formatters.set("emote", new DisabledFormatter());
if (!settings.get("formatter-green"))
formatters.set("green", new IdentityFormatter());
formatters.set("green", new DisabledFormatter());
}

function buildMessageTxt(chat, message) {
Expand Down Expand Up @@ -440,9 +440,11 @@ 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
message.emotecount <= 6 && !(formatters.get("emote") instanceof DisabledFormatter)
) {
message._text.attr("class", message.message.split(":")[0] + "Combo");

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

// for every combo attatch 1 emote
// for every combo attach 1 emote
for (let i = 0; i < message.emotecount; i++) {
html += temp;
}
Expand Down Expand Up @@ -494,8 +496,8 @@ class ChatEmoteMessage extends ChatMessage {
" ",
this._combo_txt
);

if (SWARM_EMOTES.includes(this.message.split(":")[0])) {
// 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)) {
this._text.attr("class", this.message.split(":")[0] + "Combo");
this._text.append(
`${formatters.get("emote").format(chat, this.message, this)}`
Expand Down
4 changes: 2 additions & 2 deletions assets/emotecreators.json
Original file line number Diff line number Diff line change
Expand Up @@ -673,8 +673,8 @@
},
"LOGGERS": {
"createdby": "",
"october": "bawrroccoli",
"december": ""
"october": "",
"december": "bawrroccoli"
}
}
}
Loading