1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-09-03 03:40:56 +00:00
**Note**: This update does not add proper support for the 'Message Effects' power-up. I still need to investigate how to best implement that, since Twitch's implementation uses a canvas and custom rendering logic.

* Added: Support for the "Gigantify an Emote" power-up.
* Added: Support for "Gigantifing" an emote using a community points reward. Just set up a custom reward that lets a user enter a message, and have the exact string `FFZ:GE` somewhere in the reward's title or description. Only appears as giant for users with FrankerFaceZ. This was added because the native power-up does not support emotes from add-ons.
* Added: Option to disable "Gigantifying" emotes.
* Fixed: Use the correct currency when displaying a community redemption that cost bits rather than points.
* Fixed: The emote menu not appearing correctly when choosing an emote for the "Gigantify an Emote" and "On-Screen Celebration" power-ups.
This commit is contained in:
SirStendec 2024-06-14 14:27:26 -04:00
parent 340551dc83
commit f79f1ba21d
22 changed files with 176 additions and 31 deletions

View file

@ -12,7 +12,7 @@ import { has } from 'utilities/object';
import { KEYS, RERENDER_SETTINGS, UPDATE_BADGE_SETTINGS, UPDATE_TOKEN_SETTINGS } from 'utilities/constants';
import { print_duration } from 'utilities/time';
import { getRewardTitle, getRewardCost } from './points';
import { getRewardTitle, getRewardCost, isGiantEmoteReward, doesRewardCostBits } from './points';
import awaitMD, {getMD} from 'utilities/markdown';
const SUB_TIERS = {
@ -203,13 +203,14 @@ export default class ChatLine extends Module {
// We need to get the message's tokens to see if it has a message or not.
const user = msg.user,
is_bits = doesRewardCostBits(msg.ffz_reward),
tokens = msg.ffz_tokens = msg.ffz_tokens || this.chat.tokenizeMessage(msg, current_user),
has_message = tokens.length > 0;
// Elements for the reward and cost with nice formatting.
const reward = e('span', {className: 'ffz--points-reward'}, getRewardTitle(msg.ffz_reward, this.i18n)),
cost = e('span', {className: 'ffz--points-cost'}, [
e('span', {className: 'ffz--points-icon'}),
e('span', {className: is_bits ? 'ffz-i-bits' : 'ffz--points-icon'}),
this.i18n.formatNumber(getRewardCost(msg.ffz_reward))
]);
@ -1065,6 +1066,8 @@ other {# messages were deleted by a moderator.}
: null;
const is_action = t.parent.message_types && t.parent.message_types.Action === msg.messageType,
is_giant_emote = this.props.isLastEmoteGigantified || isGiantEmoteReward(msg.ffz_reward),
action_style = is_action ? t.chat.context.get('chat.me-style') : 0,
action_italic = action_style >= 2,
action_color = action_style === 1 || action_style === 3;
@ -1072,7 +1075,8 @@ other {# messages were deleted by a moderator.}
const raw_color = t.overrides.getColor(user.id) || user.color,
color = t.parent.colors.process(raw_color);
const rich_content = show && FFZRichContent && t.chat.pluckRichContent(tokens, msg);
const rich_content = show && FFZRichContent && t.chat.pluckRichContent(tokens, msg),
giant_emote = is_giant_emote && t.chat.pluckLastEmote(tokens, msg);
// First, render the user block.
const username = t.chat.formatUser(user, e),
@ -1184,6 +1188,11 @@ other {# messages were deleted by a moderator.}
// Rich Content
rich_content
? e(FFZRichContent, rich_content)
: null,
// Giant Emote
giant_emote
? e('div', {className: 'chat-line__message--ffz-giant-emote'}, t.chat.renderGiantEmote(giant_emote, e))
: null
];
}