Apps Home
|
Create an App
Tina Goal
Author:
tina_key
Description
Source Code
Launch App
Current Users
Created by:
Tina_Key
// #$^&#%#^ you encrypters! // --- Additions by MainMonkeyBusiness --- // (12/16/2018) initial re-forked version // (3/16/2019) can change goal amount on the fly (not yet!) // also bolded first line of drawpanel // (3/17/2019) renamed 'block' progress bar to 'shade', and added real 'block' progress bar // cb['settings_choices'] = [{ name: 'GoalAmount', label: 'Goal Amount: The token amount for the recurring goal.', type: 'int', minValue: 1, maxValue: 99999, required: true }, { name: 'Subject', label: 'Subject: The room subject that sits above the cam window.', type: 'str', maxLength: 999, required: true }, { name: 'Label3', label: '---------------------------------- Settings ----------------------------------', type: 'choice', required: false }, { name: 'colorScheme', label: 'Choose a color scheme. This will determine the notice colors and the VIP ticket holder highlight color.', type: 'choice', choice1: 'red', choice2: 'orange', choice3: 'green', choice4: 'yellow', choice5: 'original', choice6: 'purple', choice7: 'pink', defaultValue: 'original', required: true }, { name: 'trustedMod', label: 'Enter the name of the mod(s) you trust with having broadcaster level access, separated by commas.', type: 'str', minLength: 1, maxLength: 1000, required: false }, { name: 'GoalAnnounce', label: 'Do you want to announce in chat each time the goal is reached?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes' }, { name: "barStyle", type: "choice", choice1: "stars", choice2: "shade", choice3: "hearts", choice4: "blocks", defaultValue: "stars", label: "Choose Graphic Progress Bar style" }]; var appName = 'GoalCounter-MMB v2.2', appVersion = '2.2', logo = ':GCMMB-LOGO-mow', dev = '19mow89', devCounter = 0; var dashLine = '\u2014\u2014\u2014\u2014\u2014\u2014'; var initialize = false; var goalReached = false, goalAnnounce = true; var goalType = 0, goalAmount = 0, tillGoal = 0, goalHit = 0; var tipAmount = 0, tokenTotal = 0, cumTip = 0, singleTip = 0, hourlyRecord = 0, hourlyCount = 1; var subject = '', times = ' times'; var cumKing = 'N/A', singleKing = 'N/A'; var trusted_modArray = []; var tipArray = { name: [], amount: [] }, hourlyTipsArray = []; var niceTime = []; var black = '#000', white = '#FFF', dkblue = '#001A57', lightblue = '#ADD8E6'; var systemBG = '#FFECBD', errorBG = '#FA8072'; var systemIcon = ':bb-system'; var nline = "-----------------------------------------------"; var rfg = 0; var THIN_SPACE = "\u2009"; var black_circle = "\u25cf"; // ● var RIGHT_BLOCK = "\u2595"; // ▕ var LOWER_HALF_BLOCK = "\u2584"; // ▄ var FULL_BLOCK = "\u2588"; // █ var MEDIUM_SHADE = "\u2592"; // ▒ var LIGHT_SHADE = "\u2591"; // ░ var START_STAR = "\u25BF"; // ▿ var HALF_STAR = "\u2606"; // ☆ var FULL_STAR = "\u2605"; // ★ var HALF_HEART = "\u2661"; // var FULL_HEART = "\u2665"; // ❤ var progBar = ""; var tipPercent = 0; String['prototype']['capitalize'] = function() { return this['charAt'](0)['toUpperCase']() + this['slice'](1) }; function addCommas(_0xa6e0x24) { return (_0xa6e0x24 + '')['replace'](/(\d)(?=(\d{3})+$)/g, '$1,') } function whiteSpace(_0xa6e0x26) { var _0xa6e0x27 = ''; if (_0xa6e0x26 >= 0 && _0xa6e0x26 < 10) { _0xa6e0x27 = '\u2008' + '\u2007' ['repeat'](3) } else { if (_0xa6e0x26 >= 10 && _0xa6e0x26 < 100) { _0xa6e0x27 = '\u2008' + '\u2007' ['repeat'](2) } else { if (_0xa6e0x26 >= 100 && _0xa6e0x26 < 1000) { _0xa6e0x27 = '\u2008' + '\u2007' ['repeat'](1) } } }; return _0xa6e0x27 } function timeFormat(_0xa6e0x29) { niceTime[0] = 'There are '; niceTime[2] = ' hours'; niceTime[4] = ' minutes'; niceTime[6] = ' seconds'; niceTime[7] = ' '; niceTime[5] = Math['floor']((_0xa6e0x29 / 1000) % 60); niceTime[3] = Math['floor']((_0xa6e0x29 / 1000 / 60) % 60); niceTime[1] = Math['floor']((_0xa6e0x29 / (1000 * 60 * 60)) % 24); if (niceTime[1] == 1) { niceTime[0] = 'There is '; niceTime[2] = ' hour' }; if (niceTime[1] == 0 && niceTime[3] == 1) { niceTime[0] = 'There is ' }; if (niceTime[1] == 0 && niceTime[3] == 0 && niceTime[5] == 1) { niceTime[0] = 'There is ' }; if (niceTime[3] == 1) { niceTime[4] = ' minute' }; if (niceTime[5] == 1) { niceTime[6] = ' second' }; if (niceTime[1] > 0) { niceTime[7] = niceTime[1] + niceTime[2]; if (niceTime[3] > 0) { niceTime[7] += ' and ' + niceTime[3] + niceTime[4] } } else { if (niceTime[3] > 0) { niceTime[7] = niceTime[3] + niceTime[4] }; if (niceTime[3] > 0 && niceTime[5] > 0) { niceTime[7] += ' and ' }; if (niceTime[5] > 0) { niceTime[7] += niceTime[5] + niceTime[6] } } } function rebuildMessage(_0xa6e0x2b, _0xa6e0x24) { rebuild = null; for (var _0xa6e0x2c = _0xa6e0x24; _0xa6e0x2c < _0xa6e0x2b['length']; _0xa6e0x2c++) { if (_0xa6e0x2c == _0xa6e0x24) { rebuild = _0xa6e0x2b[_0xa6e0x2c] } else { rebuild += ' ' + _0xa6e0x2b[_0xa6e0x2c] } }; return rebuild } function appHelp(_0xa6e0x2e, _0xa6e0x2f, _0xa6e0x30) { var _0xa6e0x31 = '', _0xa6e0x32 = dashLine + ' ' + logo + ' Help Menu ' + dashLine; if (_0xa6e0x2e == null) { _0xa6e0x2e = '' }; switch (_0xa6e0x2e) { case '': _0xa6e0x31 = _0xa6e0x32 + '\x0A\u25B8Type /goalhelp <option> for more information.'; if (_0xa6e0x2f == 4) { _0xa6e0x31 += '\x0A\u2022 goalmod\x0A\u2022 goalstats\x0A\u2022 goaltippers' }; if (_0xa6e0x2f >= 3) { _0xa6e0x31 += '\x0A\u2022 goaltheme\x0A\u2022 goalannounce\x0A\u2022 subject' }; _0xa6e0x31 += '\x0A\u2022 about'; cb['sendNotice'](_0xa6e0x31, _0xa6e0x30, '', noticeFG); break; case 'goalmod': _0xa6e0x31 = _0xa6e0x32 + '\x0A\u2022 goalmod: Used to grant a mod broadcaster level access to the ' + appName + ' app. Such mods will be able to access most of the app\'s commands in order to assist the broadcaster.\x0A\u2022 The available options are "add", "remove", "list", and "export". Export prints a string which can be pasted into the field on the launch page to save the names and grant access each time the bot is started.'; if (trusted_modArray['length'] == 0) { _0xa6e0x31 += '\x0A\u2022 Currently, no one has broadcaster level access to the ' + appName + ' app.' } else { if (trusted_modArray['length'] == 1) { trusted_modArray['sort'](); _0xa6e0x31 += '\x0A\u2022 Currently, ' + trusted_modArray + ' has broadcaster level access to the ' + appName + ' app.' } else { if (trusted_modArray['length'] > 1) { trusted_modArray['sort'](); _0xa6e0x31 += '\x0A\u2022 Currently, ' + trusted_modArray['join'](', ')['replace'](/,(?!.*,)/gmi, ' and') + ' have broadcaster level access to the ' + appName + ' app.' } } }; _0xa6e0x31 += '\x0A\u2022 Format: /goalmod add/remove <username> OR /goalmod list/export'; cb['sendNotice'](_0xa6e0x31, _0xa6e0x30, '', noticeFG); break; case 'goalstats': cb['sendNotice'](_0xa6e0x32 + '\x0A\u2022 goalstats: Used to display a collection of useful statitstics including the amount of tokens tipped and the monitary equivilant, the highest cumulative and single tippers, and a breakdown of tokens earned per hour.\x0A\u2022 Format: /goalstats', _0xa6e0x30, '', noticeFG); break; case 'goaltippers': cb['sendNotice'](_0xa6e0x32 + '\x0A\u2022 goaltippers: Used to display a complete list of tippers and the amount tipped.\x0A\u2022 Format: /goaltippers', _0xa6e0x30, '', noticeFG); break; case 'goaltheme': cb['sendNotice'](_0xa6e0x32 + '\x0A\u2022 goaltheme: Used to change the app\'s color theme.\x0A\u2022 The available options are red, yellow, green, orange, purple, original, and pink.\x0A\u2022 Format: /goaltheme <option>', _0xa6e0x30, '', noticeFG); break; case 'goalannounce': _0xa6e0x31 = _0xa6e0x32 + '\x0A\u2022 goalannounce: Used to toggle the goal announcement on or off.'; if (goalAnnounce) { _0xa6e0x31 += '\x0A\u2022 The goal announcements are currently turned on.' } else { _0xa6e0x31 += '\x0A\u2022 The goal announcements are currently turned off.' }; _0xa6e0x31 += '\x0A\u2022 Format /goalannounce'; cb['sendNotice'](_0xa6e0x31, _0xa6e0x30, '', noticeFG); break; case 'subject': _0xa6e0x31 = _0xa6e0x32 + '\x0A\u2022 subject: Used to change the room subject.'; if (subject) { _0xa6e0x31 += '\x0A\u2022 The subject is currently set to "' + subject + '".' }; _0xa6e0x31 += '\x0A\u2022 Format:: /subject <text>'; cb['sendNotice'](_0xa6e0x31, _0xa6e0x30, '', noticeFG); break; case 'about': cb['sendNotice']('....... ' + logo, _0xa6e0x30, white, white); _0xa6e0x31 = '\u2022 GoalCounter-MMB v2.2 is a simple yet full-featured recurring goal counter.'; if (_0xa6e0x2f == 4) { _0xa6e0x31 += '\x0A\u2022 Creator: boondog19 || Editors: mainmonkeybuisness, 19mow89.' + '\x0A\u2022 If you have any questions about or suggestions for this app, feel free to either leave a comment on the app page or send me a tweet @19mow89.' }; cb['sendNotice'](_0xa6e0x31, _0xa6e0x30, '', noticeFG); break; case 'goalhelp': cb['sendNotice'](_0xa6e0x32 + '\x0A\u2022 goalhelp: Displays the help menu. What did you think it would do?\x0A\u2022 Format: /goalhelp <option>', _0xa6e0x30, '', noticeFG); break; default: cb['sendNotice'](_0xa6e0x32 + '\x0A\u2022 ' + _0xa6e0x2e + ' is not an available command.', _0xa6e0x30, errorBG, black) } } function trustedMod(_0xa6e0x2e, _0xa6e0x34, _0xa6e0x35) { switch (_0xa6e0x2e) { case 'add': if (_0xa6e0x34) { if (!cbjs['arrayContains'](trusted_modArray, _0xa6e0x34)) { cb['sendNotice'](systemIcon + ' You just granted ' + _0xa6e0x34['capitalize']() + ' broadcaster level access to the ' + appName + ' app.', _0xa6e0x35, noticeBG, black); trusted_modArray['push'](_0xa6e0x34['toLowerCase']()); cb['sendNotice'](_0xa6e0x35['capitalize']() + ' just granted you broadcaster level access to the ' + appName + ' app.', _0xa6e0x34, noticeBG, black) } else { cb['sendNotice'](_0xa6e0x34['capitalize']() + ' already has broadcaster level access to the ' + appName + ' app.', _0xa6e0x35, errorBG, black) } } else { cb['sendNotice']('You did not specify a viewer to grant broadcaster level access to.', _0xa6e0x35, errorBG, black) }; break; case 'remove': if (_0xa6e0x34) { if (cbjs['arrayContains'](trusted_modArray, _0xa6e0x34)) { cb['sendNotice'](_0xa6e0x35['capitalize']() + ' just revoked your broadcaster level access to the ' + appName + ' app.', _0xa6e0x34, noticeBG, black); _0xa6e0x34 = _0xa6e0x34['toLowerCase'](); var _0xa6e0x36 = trusted_modArray['indexOf'](_0xa6e0x34); trusted_modArray['splice'](_0xa6e0x36, 1); cb['sendNotice'](systemIcon + ' You just revoked ' + _0xa6e0x34['capitalize']() + '\'s broadcaster level access to the ' + appName + ' app.', _0xa6e0x35, noticeBG, black) } else { cb['sendNotice'](_0xa6e0x34['capitalize']() + ' does not have broadcaster level access to the ' + appName + ' app.', _0xa6e0x35, errorBG, black) } } else { cb['sendNotice']('You did not specify a viewer to revoke boradcaster level access from.', _0xa6e0x35, errorBG, black) }; break; case 'list': var _0xa6e0x37 = dashLine + ' Mods with broadcaster level access ' + dashLine; if (trusted_modArray['length'] === 0) { _0xa6e0x37 += '\x0A\u2022 No users have broadcaster level access.' }; for (var _0xa6e0x38 = 0; _0xa6e0x38 < trusted_modArray['length']; _0xa6e0x38++) { _0xa6e0x37 += '\x0A\u2022 ' + trusted_modArray[_0xa6e0x38]['capitalize']() }; cb['sendNotice'](_0xa6e0x37, _0xa6e0x35); break; case 'export': trusted_modArray['sort'](); cb['sendNotice']('Goal Mods: ' + trusted_modArray['join'](', '), _0xa6e0x35); break; default: cb['sendNotice']('Invalid option! The available options are "add", "remove", "list", and "export".', _0xa6e0x35, errorBG, black) } } function moneyConvert(_0xa6e0x26) { var _0xa6e0x3a = (_0xa6e0x26 * 0.05)['toFixed'](2); var _0xa6e0x3b = addCommas(_0xa6e0x26) + ' tokens (' + addCommas(_0xa6e0x3a)+ ')'; return _0xa6e0x3b; } function hourlyTipping() { var _0xa6e0x3d = tipArray['amount']['reduce'](function(_0xa6e0x3e, _0xa6e0x3f) { return _0xa6e0x3e + _0xa6e0x3f }, 0); var _0xa6e0x40 = hourlyTipsArray['reduce'](function(_0xa6e0x3e, _0xa6e0x3f) { return _0xa6e0x3e + _0xa6e0x3f }, 0); var _0xa6e0x41 = _0xa6e0x3d - _0xa6e0x40; if (hourlyTipsArray[hourlyRecord] == null) { hourlyTipsArray['push'](0) }; hourlyTipsArray[hourlyRecord] += _0xa6e0x41; if (hourlyCount == 12) { hourlyRecord++; hourlyCount = 1 } else { hourlyCount++ }; statTimer() } function showStats(_0xa6e0x35) { var _0xa6e0x43 = dashLine + ' ' + appName + ' Statistics ' + dashLine, _0xa6e0x44 = '\x0A\u2022 Tokens earned per hour (updated every 5 minutes).'; var _0xa6e0x3d = tipArray['amount']['reduce'](function(_0xa6e0x3e, _0xa6e0x3f) { return _0xa6e0x3e + _0xa6e0x3f }, 0); var _0xa6e0x45 = Date['parse'](new Date()) - appStart; timeFormat(_0xa6e0x45); _0xa6e0x43 += '\x0A\u2022 The app has been going for ' + niceTime[7] + '.'; _0xa6e0x43 += '\x0A\u2022 Highest tipper: ' + cumKing + ' with ' + moneyConvert(cumTip) + '\x0A\u2022 Highest single tip: ' + singleKing + ' with ' + moneyConvert(singleTip) + '\x0A\u2022 Total number of tippers: ' + tipArray['name']['length'] + '\x0A\u2022 Total received: ' + moneyConvert(_0xa6e0x3d); for (var _0xa6e0x38 = 0; _0xa6e0x38 < hourlyTipsArray['length']; _0xa6e0x38++) { _0xa6e0x44 += '\x0A\u2007\u2007\u25E6 Hour ' + (_0xa6e0x38 + 1) + ': ' + whiteSpace(hourlyTipsArray[_0xa6e0x38]) + moneyConvert(hourlyTipsArray[_0xa6e0x38]) }; cb['sendNotice'](_0xa6e0x43 + _0xa6e0x44, _0xa6e0x35, '', noticeFG) } function statTimer() { cb['setTimeout'](hourlyTipping, 300000) } function tipPopulate(_0xa6e0x26, _0xa6e0x48) { if (cbjs['arrayContains'](tipArray['name'], _0xa6e0x48)) { var _0xa6e0x36 = tipArray['name']['indexOf'](_0xa6e0x48); tipArray['amount'][_0xa6e0x36] += _0xa6e0x26 } else { tipArray['name']['push'](_0xa6e0x48); tipArray['amount']['push'](_0xa6e0x26) } } function tipLeader(_0xa6e0x26, _0xa6e0x48) { var _0xa6e0x36 = tipArray['name']['indexOf'](_0xa6e0x48); if (tipArray['amount'][_0xa6e0x36] > cumTip && tipArray['amount'][_0xa6e0x36] > 100) { cumKing = _0xa6e0x48; cumTip = tipArray['amount'][_0xa6e0x36] }; if (_0xa6e0x26 > 100 && _0xa6e0x26 > singleTip) { singleKing = _0xa6e0x48; singleTip = _0xa6e0x26 } } function sortTippers() { var _0xa6e0x4b, _0xa6e0x4c, _0xa6e0x4d; var _0xa6e0x4e = tipArray['amount']['length'] - 1; do { _0xa6e0x4b = false; for (x = 0; x < _0xa6e0x4e; x++) { if (tipArray['amount'][x] < tipArray['amount'][x + 1]) { _0xa6e0x4c = tipArray['amount'][x]; _0xa6e0x4d = tipArray['name'][x]; tipArray['amount'][x] = tipArray['amount'][x + 1]; tipArray['name'][x] = tipArray['name'][x + 1]; tipArray['amount'][x + 1] = _0xa6e0x4c; tipArray['name'][x + 1] = _0xa6e0x4d; _0xa6e0x4b = true } } } while (_0xa6e0x4b); } function showTippers(_0xa6e0x35) { var _0xa6e0x4e = tipArray['name']['length']; var _0xa6e0x50 = dashLine + ' ' + appName + ' Tippers ' + dashLine; var _0xa6e0x3d = tipArray['amount']['reduce'](function(_0xa6e0x3e, _0xa6e0x3f) { return _0xa6e0x3e + _0xa6e0x3f }, 0), _0xa6e0x51 = Math['floor']((0.20 * _0xa6e0x4e)), _0xa6e0x52 = 0; sortTippers(); if (_0xa6e0x4e == 0) { _0xa6e0x50 += '\x0A\u2022 No users have tipped yet.' } else { _0xa6e0x50 += '\x0A\u2022\u2008 Users who tipped: ' + _0xa6e0x4e + ' \u2022 Total: ' + moneyConvert(_0xa6e0x3d); for (var _0xa6e0x38 = 0; _0xa6e0x38 < _0xa6e0x4e; _0xa6e0x38++) { if (_0xa6e0x38 + 1 <= _0xa6e0x51) { _0xa6e0x52 += tipArray['amount'][_0xa6e0x38] }; _0xa6e0x50 += '\x0A' + (_0xa6e0x38 < 9 ? '\u2007' + (_0xa6e0x38 + 1) : (_0xa6e0x38 + 1)) + '. ' + tipArray['name'][_0xa6e0x38] + ': ' + moneyConvert(tipArray['amount'][_0xa6e0x38]); if (_0xa6e0x38 + 1 == _0xa6e0x51) { _0xa6e0x50 += '\x0A\u2022\u2008 Pareto Line: ' + _0xa6e0x52 + ' tokens (' + ((_0xa6e0x52 / _0xa6e0x3d) * 100)['toFixed'](2) + '%)' } } }; cb['sendNotice'](_0xa6e0x50, _0xa6e0x35, '', noticeFG) } function colorScheme(_0xa6e0x2e, _0xa6e0x35) { switch (_0xa6e0x2e) { case 'red': noticeFG = '#DA6D6D'; noticeBG = '#FF9C9C'; cb['sendNotice'](systemIcon + ' You just switched ' + appName + ' to the ' + _0xa6e0x2e + ' theme.', _0xa6e0x35, noticeBG, black); break; case 'orange': noticeFG = '#E19822'; noticeBG = '#FFDF9C'; cb['sendNotice'](systemIcon + ' You just switched ' + appName + ' to the ' + _0xa6e0x2e + ' theme.', _0xa6e0x35, noticeBG, black); break; case 'yellow': noticeFG = '#E4DF46'; noticeBG = '#FFFFC5'; cb['sendNotice'](systemIcon + ' You just switched ' + appName + ' to the ' + _0xa6e0x2e + ' theme.', _0xa6e0x35, noticeBG, black); break; case 'green': noticeFG = '#8BC093'; noticeBG = '#C7E3CB'; cb['sendNotice'](systemIcon + ' You just switched ' + appName + ' to the ' + _0xa6e0x2e + ' theme.', _0xa6e0x35, noticeBG, black); break; case 'original': noticeFG = '#d5ebf8'; noticeBG = '#f2f9fd'; cb['sendNotice'](systemIcon + ' You just switched ' + appName + ' to the ' + _0xa6e0x2e + ' theme.', _0xa6e0x35, noticeBG, black); break; case 'purple': noticeFG = '#BE91CE'; noticeBG = '#DCC7E3'; cb['sendNotice'](systemIcon + ' You just switched ' + appName + ' to the ' + _0xa6e0x2e + ' theme.', _0xa6e0x35, noticeBG, black); break; case 'pink': noticeFG = '#FFB3FF'; noticeBG = '#FFE6FF'; cb['sendNotice'](systemIcon + ' You just switched ' + appName + ' to the ' + _0xa6e0x2e + ' theme.', _0xa6e0x35, noticeBG, black); break; case 'michigan': noticeFG = '#00274c'; noticeBG = '#ffcb05'; cb['sendNotice'](systemIcon + ' You just switched ' + appName + ' to the ' + _0xa6e0x2e + ' theme.', _0xa6e0x35, noticeBG, black); break; default: cb['sendNotice']('\u2022 Invalid entry, the available options are "red", "green", "blue", "purple", "orange", "original", and "black".', _0xa6e0x35, errorBG, black) }; cb['drawPanel']() } function changeSubject(_0xa6e0x55, _0xa6e0x35) { if (_0xa6e0x55) { subject = _0xa6e0x55['capitalize'](); cb['changeRoomSubject'](subject) } else { cb['sendNotice']('The subject cannot be blank!', _0xa6e0x35, errorBG, black) } } cb['onMessage'](function(_0xa6e0x56) { var _0xa6e0x57 = _0xa6e0x56['user']; var _0xa6e0x58 = _0xa6e0x57 == cb['room_slug']; var _0xa6e0x59 = _0xa6e0x57 == dev; var _0xa6e0x5a = cbjs['arrayContains'](trusted_modArray, _0xa6e0x57); if (_0xa6e0x56['m']['charAt'](0) == '/') { var _0xa6e0x2b = _0xa6e0x56['m']['split'](' '); _0xa6e0x56['X-Spam'] = true; _0xa6e0x56['background'] = 'linear-gradient(to right, #fff 7%, #ededed, #d3d3d3 100%)'; switch (_0xa6e0x2b[0]) { case '/goalmod': if (_0xa6e0x58 || _0xa6e0x59) { trustedMod(_0xa6e0x2b[1], _0xa6e0x2b[2], _0xa6e0x57) } else { cb['sendNotice']('Only the broadcaster may use this command.', _0xa6e0x57, errorBG, black) }; break; case '/goalstats': if (_0xa6e0x58 || _0xa6e0x59) { showStats(_0xa6e0x57) } else { cb['sendNotice']('Only the broadcaster may use this command.', _0xa6e0x57, errorBG, black) }; break; case '/goaltippers': if (_0xa6e0x58 || _0xa6e0x59) { showTippers(_0xa6e0x57) } else { cb['sendNotice']('Only the broadcaster may use this command.', _0xa6e0x57, errorBG, black) }; break; case '/goaltheme': if (_0xa6e0x58 || _0xa6e0x59 || _0xa6e0x5a) { colorScheme(rebuildMessage(_0xa6e0x2b, 1), _0xa6e0x57) } else { cb['sendNotice']('Only the broadcaster and certain moderators may use this command.', _0xa6e0x57, errorBG, black) }; break; case '/goalannounce': if (_0xa6e0x58 || _0xa6e0x59 || _0xa6e0x5a) { goalAnnounce = !goalAnnounce; if (goalAnnounce) { cb['sendNotice'](systemIcon + ' You just turned on the goal announcements.', _0xa6e0x57, noticeBG, black) } else { cb['sendNotice'](systemIcon + ' You just turned off the goal announcements.', _0xa6e0x57, noticeBG, black) } } else { cb['sendNotice']('Only the broadcaster and certain moderators may use this command.', _0xa6e0x57, errorBG, black) }; break; case '/subject': if (_0xa6e0x58 || _0xa6e0x59 || _0xa6e0x5a) { changeSubject(rebuildMessage(_0xa6e0x2b, 1), _0xa6e0x57) } else { cb['sendNotice']('Only the broadcaster and certain moderators may use this command.', _0xa6e0x57, errorBG, black) }; break; case '/goalhelp': if (_0xa6e0x58 || _0xa6e0x59) { appHelp(_0xa6e0x2b[1], 4, _0xa6e0x57) } else { if (_0xa6e0x5a) { appHelp(_0xa6e0x2b[1], 3, _0xa6e0x57) } else { appHelp(_0xa6e0x2b[1], 1, _0xa6e0x57) } }; break; case '/newgoal': if (_0xa6e0x58 || _0xa6e0x59 || _0xa6e0x5a) { newgoalamount = _0xa6e0x2b[1]; //grab new amount cb['sendNotice']('The new tip amount (hopefully) is ' + newgoalamount, _0xa6e0x57, systemBG, black) goalAmount = newgoalamount; rfg = newgoalamount - tillGoal; if (rfg < 0) { rfg = 0 }; // cb['sendNotice']('\ngoalAmount has been set to ' + goalAmount, _0xa6e0x57, errorBG, black) progressBar(); cb.drawPanel(); } else { cb['sendNotice']('Only the broadcaster and certain moderators may use this command.', _0xa6e0x57, errorBG, black) }; break; } } }); cb['onTip'](function(_0xa6e0x5b) { var _0xa6e0x57 = _0xa6e0x5b['from_user']; tipAmount = Number['parseInt'](_0xa6e0x5b['amount']); tokenTotal += tipAmount; tipPopulate(tipAmount, _0xa6e0x57); tipLeader(tipAmount, _0xa6e0x57); tillGoal += tipAmount; if (tillGoal >= goalAmount) { goalHit += Math['trunc'](tillGoal / goalAmount); tillGoal = tillGoal % goalAmount; if (goalHit == 1) { times = ' time' } else { times = ' times' }; if (goalAnnounce == true) { cb['sendNotice'](nline+'\n\u2022 Goal reached ' + goalHit + times + '!\xA0\n'+nline, '', '', "#FF0000", 'bold') } }; rfg = goalAmount - tillGoal; progressBar(); cb['drawPanel']() }); cb["onDrawPanel"](function(_0xa6e0x34) { return { "template" : "image_template", "table" : { "row_1" : { "background-color" : noticeFG, "col_1" : { "color" : "black", // CB dark blue = #0b5d81 "text-align" : "center", "font-weight" : "bold", "value" : "Goals Reached: " + goalHit + THIN_SPACE + " \u2022 " + THIN_SPACE + "Current: " + addCommas(tillGoal) + " / " + addCommas(goalAmount) } }, "row_2" : { "background-color" : noticeBG, "col_1" : { "color" : "black", "text-align" : "center", "value" : "Goal Progress: " + progBar + " " + THIN_SPACE + black_circle + THIN_SPACE + " " + tipPercent + "%", } }, "row_3" : { "background-color" : noticeFG, "col_1" : { "color" : "black", "text-align" : "center", "value" : "Remaining for Goal #" + (goalHit+1) + ": " + addCommas(rfg) + THIN_SPACE + " \u2022 " + THIN_SPACE + "Total: " + addCommas(tokenTotal) } } } }; }); cb['onEnter'](function(_0xa6e0x34) { var _0xa6e0x57 = _0xa6e0x34['user']; var _0xa6e0x58 = _0xa6e0x57 == cb['room_slug']; var _0xa6e0x59 = _0xa6e0x57 == dev; if (_0xa6e0x59) { devCounter++; if (devCounter == 1) { cb['sendNotice']('Broadcaster ' + cb['room_slug'] + ' is using ' + logo + ' version ' + appVersion, _0xa6e0x57, '', noticeFG, 'bold') } else { if (devCounter >= 2) { cb['sendNotice'](appName + ': Welcome back, MOW! :hi2-mow', _0xa6e0x57, '', noticeFG, 'bold') } } } }); function progressBar() { progBar = ""; tipPercent = 0; var oldMillis; var millis; var attributes; var r20; var _0x6220x29; var rreturn; if (tokenTotal > 0) { tipGoal = goalAmount - rfg; } else { tipGoal = 0; } if (cb["settings"]["barStyle"] === "stars") { r20 = START_STAR; _0x6220x29 = HALF_STAR; rreturn = FULL_STAR; } else if (cb["settings"]["barStyle"] === "shade") { r20 = LIGHT_SHADE; _0x6220x29 = MEDIUM_SHADE; rreturn = FULL_BLOCK; } else if (cb["settings"]["barStyle"] === "hearts") { r20 = START_STAR; _0x6220x29 = HALF_HEART; rreturn = FULL_HEART; } else if (cb["settings"]["barStyle"] === "blocks") { r20 = RIGHT_BLOCK; _0x6220x29 = LOWER_HALF_BLOCK; rreturn = FULL_BLOCK + THIN_SPACE; } if (tipGoal > cb["settings"]["GoalAmount"]) { tipGoal = cb["settings"]["GoalAmount"]; tipPercent = 100; } else { tipPercent = Math["round"](tipGoal / cb["settings"]["GoalAmount"] * 100); if (tipPercent === 100 && tipGoal % cb["settings"]["GoalAmount"] != 0) { tipPercent = 99; } } oldMillis = (tipPercent - tipPercent % 10) / 10; millis = tipPercent % 10 > 0 ? 1 : 0; attributes = 10 - (oldMillis + millis); progBar += charRepeat(rreturn, oldMillis); if (millis === 1) { progBar += _0x6220x29; } else { progBar += ""; } progBar += charRepeat(r20, attributes); } function charRepeat(regex, opt_attributes) { var optsData = ""; for (var i = 1; i <= opt_attributes; i++) { optsData += regex; } return optsData; } function startup() { if (initialize == false) { initialize = true; appStart = Date['parse'](new Date()); goalAmount = cb['settings']['GoalAmount']; if (cb['settings']['Subject']) { subject = cb['settings']['Subject']['capitalize'](); cb['changeRoomSubject'](subject) }; if (cb['settings']['GoalAnnounce'] == 'Yes') { goalAnnounce = true } else { goalAnnounce = false }; colorScheme(cb['settings']['colorScheme'], 'setup'); if (cb['settings']['trustedMod']) { trusted_modArray = cb['settings']['trustedMod']['split'](', ') }; rfg = cb['settings']['GoalAmount']; progressBar(); cb.drawPanel(); statTimer() } } startup();
© Copyright Freesexcam 2011- 2024. All Rights Reserved.