Apps Home
|
Create an App
testroby
Author:
echoes01
Description
Source Code
Launch App
Current Users
Created by:
Echoes01
/***************************************************************************************** ******************************************************************************************/ var DEBUG = false; function debug(m) { if(DEBUG) { cb.sendNotice(m,'DEBUG','#ff0000','#000000','bold'); } } /* Contantes (no puedo usar const, ni idea de por que) */ var R_M_N = 'UNAUTHORIZED MODEL'; /* R_M_N */ var U_M_N = 'UNAUTHORIZED MODEL'; /* U_M_N */ var STBC = false; /* Stop The BroadCasting */ var NL = '\n'; var FLASH_IN_PROGRESS_TEXT1 = 'Don\'t miss this Flash! Tip '; var FLASH_IN_PROGRESS_TEXT2 = ' tks or more to enter now and receive the Ticket for the '; var SHOW_IN_PROGRESS_TEXT1 = 'Don\'t miss this '; var SHOW_IN_PROGRESS_TEXT2 = ' tks or more now and enjoy! <3'; /* COLOURS */ var BG_COLOR_INFO_PUBLIC = '#FCF947'; var FONT_COLOR_INFO_PUBLIC = '#000000'; var BG_COLOR_INFO_PUBLIC_1 = ''; var FONT_COLOR_INFO_PUBLIC_1 = '#F24BF2'; var BG_COLOR_INFO_PUBLIC_2 = '#0DFF01'; var FONT_COLOR_INFO_PUBLIC_2 = ''; var BG_COLOR_INFO_PVT = '#CCFF99'; var FONT_COLOR_INFO_PVT = '#000000'; var BG_COLOR_INFO_PVT_ALERT = '#F0F409'; var FONT_COLOR_INFO_PVT_ALERT = '#EB0B1A'; var BG_COLOR_INFO_TIPPER = '#FFFFFF'; var FONT_COLOR_INFO_TIPPER = '#2242E6'; var BG_COLOR_SOLD_TICKET = '#FFFFFF'; var FONT_COLOR_SOLD_TICKET = '#7304C1'; var BG_COLOR_MORE_INFO = '#FFFFFF'; var FONT_COLOR_MORE_INFO = '#FF00FF'; var FONT_COLOR_INFO_TOPIC = '#E45605'; /* Lista de comandos App */ var COMMAND_APP_STATUS = '/appstatus'; /* Ofrece informacion de la configuracion de la aplicacion */ /* *********************************************** COMANDOS CON PARaMETROS ****************************************************************** */ var COMMAND_TIP_FOR_FLASH = '/ftip'; /* Establece el valor del tip para el flash */ var COMMAND_TIP_FOR_SHOW = '/stip'; /* Establece el valor del tip para el show */ var COMMAND_TIME_FOR_FLASH = '/ftime'; /* Establece el tiempo de duracion del flash */ var COMMAND_TIME_FOR_SHOW = '/stime'; /* Establece el tiempo de duracion del show */ var COMMAND_EXTEND_TIME = '/extend'; /* Cuando esta activa la hidden cam extiende los minutos del flash o del show */ var COMMAND_START_HIDDEN_CAM = '/start'; /* Arranca la hidden cam con el numero de minutos indicado */ var COMMAND_ADD_USER_WHOLE_SHOW = '/addshow'; /* Anade a un usuario para ver todo el Show (flashes y show) */ var COMMAND_ADD_USER_TO_FLASH = '/add'; /* Anade a un usuario para ver SoLO un flash o el show */ var COMMAND_GOAL_TOPIC = '/goaltopic'; /* Cambia la descripcion del topico */ var COMMAND_SET_GOAL = '/setgoal'; /* Modifica la cantidad de flashes necesarios para llegar al goal */ var COMMAND_SET_FLASHES_REACHED = '/setflashes'; /* Modifica la cantidad de flashes alcanzados (Solo usado para pruebas o para cuando falla la app por problemas de CB) */ // TODO check this for caprice, it doesnt work var COMMAND_REMOVE_USER_FROM_FLASH = '/remove'; /* Cuando esta la hidden cam funcionando se puede eliminar un usuario del flash o del show */ var COMMAND_TIME_TO_START_HIDDEN_CAM = '/timetostart'; /* Configura los minutos antes de que empiece el show */ var COMMAND_TIME_TO_GO = '/timetogo'; /* Configura los minutos antes de marcharse. Por defecto arranca con 11 minutos. Se para el contador si alguien tipea */ var COMMAND_CHANGE_TYPE_OF_SHOW = '/change'; /* Cambia la configuracion de la aplicacion de modo show a modo flash (show - flash) */ var COMMAND_PAY_PENALTY = '/penalty'; /* Castiga con un penalty a aquellos usuarios que se hayan comportado inadecuadamente */ /* *********************************************** COMANDOS SIN PARaMETROS ****************************************************************** */ var COMMAND_HIDDEN_CAM_ON = '/hideon'; /* Activa la funcionalidad de hidden Cam */ var COMMAND_HIDDEN_CAM_OFF = '/hideoff'; /* Desactiva la funcionalidad de hidden Cam */ var COMMAND_HIDDEN_CAM_STOP = '/hidestop'; /* Realiza una parada de emergencia de la hidden Cam cuando esta esta en marcha */ var COMMAND_SHOW_TOPIC = '/t'; /* Muestra el topico a toda la sala */ var COMMAND_SHOW_GOAL_REACHED = '/r'; /* Muestra la cantidad de flashes que quedan para llegar al goal */ var COMMAND_SHOW_GOAL_SINGLE_TIP = '/ttg'; /* Muestra la cantidad de tokens que quedan para llegar al goal */ var COMMAND_SHOW_NET_INFO = '/net'; /* Muestra informacion de redes sociales y "follow me" */ var COMMAND_SHOW_INFORMATION = '/i'; /* Ofrece informacion adicional al topico sobre la correcta visualizacion del video en dispositivos moviles */ var COMMAND_SHOW_ALLOWED_FLASH_CAM_USERS = '/camflash'; /* Muestra un listado de los usuarios que tienen permiso para ver el flash */ var COMMAND_SHOW_ALLOWED_SHOW_CAM_USERS = '/camshow'; /* Muestra un listado de los usuarios que tienen permiso para ver el Show */ var COMMAND_SHOW_ALLOWED_NOW_CAM_USERS = '/camnow'; /* Muestra un listado de los usuarios que tienen permiso para ver el flash o show en ese mismo momento */ var COMMAND_SHOW_ALLOWED_MEMBERS = '/camall'; /* Muestra un listado de los usuarios que tienen permiso para ver el flash o show siempre (usuarios que han pagado minimum_tip_flash*times_to_free_flashes) */ var COMMAND_PERSONAL_MSG = '/pm'; /* Muestra a la sala un mensaje configurable */ var COMMAND_PERSONAL_MSG_1 = '/pm1'; /* Muestra a la sala un mensaje configurable 1 */ var COMMAND_PERSONAL_MSG_2 = '/pm2'; /* Muestra a la sala un mensaje configurable 2 */ var COMMAND_NOTICE_ON_OFF = '/notice'; /* Activa o desactiva el notifier rotativo con los mensajes de PM1 a PM5 */ var COMMAND_GLOBAL_TOKENS = '/total'; /* Muestra al modelo la cantidad de tokens ingresados en la sesion actual */ var COMMAND_SHOW_EXTRA_INFO = '!i'; /* Muestra mas informacion sobre el funcionamiento de la app al usuario "azul" que lo solicite */ /* Puede llevar parametro si un SM indica un nombre de usuario al que enviar la informacion*/ /* Variables */ var current_goal_tipped = 0; /* Numero de flashes alcanzados */ var current_goal_description = ''; /* Descripcion del topico */ var setting_number_flashes_to_goal = 0; /* Numero de flashes necesarios para alcanzar el goal */ var flashes_counter = 0; /* Contador de flashes que se llevan hasta el momento */ var times_goal_reached = 0; /* Numero de flashes alcanzados */ var flashes_to_goal = 0; /* Numero de flashes que quedan para el llegar al goal */ var total_tokens_tipped = 0; /* Numero total de tokens ingresados durante el show */ var minimum_tip_flash = 0; /* Tokens minimos para arrancar el flash */ var minimum_tip_show = 0; /* Tokens minimos para entrar en el show */ // RE: removed - var tokens_omb = 0; /* Tokens minimos para entrar en el show y ver todos los flashes en modo OhMiBod */ var tokens_to_see_all_flashes_omb = 0; /* RE: Tokens minimi per vedere i flashes nel modo OhMiBod (minimum_tip_flash * times_to_free_flashes) */ var tokens_to_see_show_omb = 0; /* RE: Tokens minimi per vedere lo show nel modo OhMiBod (minimum_tip_flash * times_to_free_show) */ var tipList = {}; /* Lista de tips que no sirven para el flash */ var superModList = []; /* Array de los usuarios a los que, aunque paguen, no esta permitido ver los flashes */ var notAllowedMembers = []; var roomTopic = ''; var showStringLong = ''; var pTime = false; var automaticShow = true; var goalShow = false; /* Sirve para comprobar que se ha llegado al Goal*/ /* Manejo del maximo tipeador. En este momento se denomina: Lieutenant */ //var maxTipperLabel ='Lieutenant'; //var maxTipper = '-----'; //var maxTip = 0; /* Lover actual 146, por eso se pone un token menos */ var loverTip = 145; /* Importe de la multa. Configurable desde el panel de la app */ var penaltyTip = 0; /* Yellow Wall Protection Level */ var yellowWallLevel = 0; /* ****** Manejo de la Hidden Cam ****** */ /* Tiempos de Hidden Cam*/ /* Mensajes */ //var hiddenCamShowTime = 0; var time_init_cam = 0; var actual_time = 0; var time_init_cam1 = 0; var actual_time1 = 0; var time_init_msg = 0; var lastCounterMessage = ''; /* Duracion de la Hidden Cam */ var flashTime = 0; var showTime = 0; var hiddenCamTime = 0; var originalFlashTime = 0; /* Flags de la Hidden Cam */ var flagCam = false; var hidden_cam = false; var executeCallbackFlag = true; var isShowMode = false; /* If true, then we are in a show, in a flash otherwise */ var showTypeString = ''; var toStartTime = 0; /* Compra de tiempo durante un flash */ var extendTimePay = 0; var extendTimeBuyed = 0; /* Array de usuarios que han tipeado durante el ultimo Flash */ // var usersWhoTippedForFlash = []; /* Para el flash */ // var usersWhoTippedForShow = []; /* Para el show al llegar al goal*/ var times_to_free_flashes = 1; var times_to_free_show = 1; /* -------------------------------------------- FUNCTIONS -------------------------------------------- */ /* Funciones para eliminar los espacios en blanco de un string */ function ltrim(str, filter) { filter || (filter = '\\s|\\ '); var pattern = new RegExp('^(' + filter + ')*', 'g'); return str.replace(pattern, ''); } function rtrim(str, filter) { filter || (filter = '\\s|\\ '); var pattern = new RegExp('(' + filter + ')*$', 'g'); return str.replace(pattern, ''); } function trim(str, filter) { filter || (filter = '\\s|\\ '); return ltrim(rtrim(str, filter), filter); } /** Si el tip es uno de los tips configurados como estandar */ function isStandardTip(lastTip) { return (lastTip in tipList); } /** Si el tip es uno de los tips configurados como un "no goal" */ function isGiftTip(tipMsg) { var msg = trim(tipMsg.toLowerCase()); if (msg === 'nogoal') { return true; } else { return false; } } /** Convert seconds to string */ function convertTime(seconds) { var hours = Math.floor(seconds / 3600); var minutes = Math.floor((seconds % 3600) / 60); var seconds = seconds % 60; // /* Redondeamos al medio minutos y al minuto en punto */ // if (Math.round(seconds) === 30) { // seconds = 30; // } else if (Math.round(seconds) === 60) { // seconds = 0; // minutes = minutes + 1; // } /* Redondeamos al medio minutos y al minuto en punto */ if (Math.ceil(seconds) === 30) { seconds = 30; } else if (Math.ceil(seconds) === 60) { seconds = 0; minutes = minutes + 1; } /* Anteponiendo un 0 a los minutos si son menos de 10 */ //minutes = minutes < 10 ? '0' + minutes : minutes; /* Anteponiendo un 0 a los segundos si son menos de 10 */ //seconds = seconds < 10 ? '0' + seconds : seconds; var result = ''; if (hours > 0) { result = hours + ' hour, '; } if (minutes > 1) { result += minutes + ' minutes '; } else if (minutes === 1) { result += minutes + ' minute '; } else if (minutes === 0) { result += ''; } seconds = Math.ceil(seconds); if (seconds > 0) { if (result === '') { result += seconds + ' seconds'; } else { result += 'and ' + seconds + ' seconds'; } } else if (seconds === 0) { result += ''; } return result; } /* RE: usata solo in un punto del codice :-( */ function setTipTitles(user, message) { var m = '[' + omb.total_tipped_by(user) + '] ' + message; //var m = '[' + tipperArray[findTipper(user)][1] + '] ' + message; return m; } /* -------------------------------------------- CMD /TIMETOGO -------------------------------------------- */ var toGoTime = 0; /* Control de tiempos para el mensaje de marcha */ var actual_time_go = 0; var actual_time1_go = 0; var time_init_msg_go = 0; function toGoTimeAdvice() { /* Coger la hora a la que inicia la cuenta atras */ var d = new Date(); var t = d.getTime(); var secondsUntilNow = 0; var secondsLeft = 0; /* Si la hora de inicio del flash esta a 0 se iguala a la hora actual, asimismo la hora actual se coge como referencia para actual_time1_go */ if (time_init_msg_go === 0) { time_init_msg_go = t; actual_time_go = t; } else { /* La hora de inicio del flash contiene una hora valida, por lo que se cambia solo la hora actual y se calcula la diferencia de horas */ actual_time_go = t; /* Si la hora actual supero el limite establecido en la configuracion se comunica en la sala */ if ((Math.floor((actual_time_go - time_init_msg_go) / 60000)) >= toGoTime) { /* Se informa que el modelo se va */ cb.sendNotice('Take care guys. I love you so much!! :Pbye', '', '', FONT_COLOR_INFO_PUBLIC_1, 'bold'); return; } else { secondsUntilNow = ((actual_time_go - time_init_msg_go) / 1000); secondsLeft = (toGoTime * 60) - secondsUntilNow; var notice = 'Less than ' + convertTime(secondsLeft) + ' to go :mrun \n'; notice += 'Tip for a flash ('+ minimum_tip_flash +' tokens or more) to stop the counter :mwink2'; cb.sendNotice(notice,'','', FONT_COLOR_INFO_PUBLIC_1, 'bold'); } } /* Se muestra el aviso cada minuto */ if (toGoTime > 0) { cb.setTimeout(toGoTimeAdvice, (1 * 60000)); } } /* -------------------------------------------- USER FLASH COUNTER -------------------------------------------- */ // TODO BUG_SECOND_SHOW make this work and create a similar counter for the SHOW // var userFlashCounter = { // name: [], // amount: [], // /** Add the user to the list to see all Flashes, if he has tipped enough */ // make: function (username, amount) { // if (cbjs.arrayContains(this.name, username)) { // for (var i = 0; i < this.name.length; i++) { // if (this.name[i] === username) { // this.amount[i] += amount; // if (this.amount[i] >= (minimum_tip_flash*times_to_free_flashes) && !isInAllowedMembers(username)) { // /*Se anade al array de miembros que tienen permitido ver todo el Show*/ // allowedMembers.push(username); // /* Notificar al usuario de que ya puede ver los flashes gratis?... */ // /* Se borran los elementos del array correspondientes */ // delete this.name[i]; // delete this.amount[i]; // } // } // } // } else { // if (amount >= (minimum_tip_flash*times_to_free_flashes) && !isInAllowedMembers(username)) { // /*Se anade al array de miemrbros que tienen permitido ver todo el Show*/ // allowedMembers.push(username); // } else { // /* Es la primera vez que tipea para un Flash*/ // this.name.push(username); // this.amount.push(amount); // } // } // }, // reset_counter: function() { // this.name = []; // this.amount = []; // } // }; /* -------------------------------------------- OHMIBOD -------------------------------------------- */ var omb = { tipperArray: [], numTippers: 0, ohmibodMode: false, tipperArrayPopulate: function (user) { this.tipperArray[this.numTippers] = []; this.tipperArray[this.numTippers][0] = user; // username this.tipperArray[this.numTippers][1] = 0; // TOTAL amount tipped this.tipperArray[this.numTippers][2] = 0; // current show amount tipped this.numTippers++; }, /** Returns the position in the array, if the user is not in the array, it will add him */ findTipper: function (user) { //find the index of the user var i = 0; for(i = 0; i < this.tipperArray.length; i+=1) { if(this.tipperArray[i][0] == user) { break; } } //the user is not in the array. add him and call findTipper if(i === this.tipperArray.length) { this.tipperArrayPopulate(user); this.findTipper(user); // FIXME: This should be redundant } return i; }, /** Returns the tipped amount for the user: omb.total_tipped_by(u) */ total_tipped_by: function(username) { return this.tipperArray[this.findTipper(username)][1]; }, /** Returns the tipped amount for the user: omb.total_tipped_by(u) */ current_show_tipped_by: function(username) { return this.tipperArray[this.findTipper(username)][2]; }, /** Add the amount to the user */ add_tip: function (username, amount) { /*tipperArray[findTipper(strTipper)][1] += parseInt(tip['amount']);*/ var i = this.findTipper(username); this.tipperArray[i][1] += amount; this.tipperArray[i][2] += amount; }, /** Reset current show tips */ reset_show: function () { for(i=0; i<this.tipperArray.length; i+=1) { this.tipperArray[i][2] = 0; } }, /** Resets the array */ clear_tippers: function () { while(this.tipperArray.length > 0) { this.tipperArray.pop(); } this.numTippers = 0; } }; /** This keep track of all the tips of every user */ /* var tipperArray = []; var numTippers = 0; var ohmibodMode = false; function tipperArrayPopulate(user) { tipperArray[numTippers] = new Array; tipperArray[numTippers][0] = user; tipperArray[numTippers][1] = 0; numTippers++; } function findTipper(user) { //find the index of the user for(var i = 0; i < tipperArray.length; i++) { if (tipperArray[i][0] == user) { break; } } //the user is not in the array. add him and call findTipper if (i === tipperArray.length) { tipperArrayPopulate(user); findTipper(user); } return i; } */ /* -------------------------------------------- SPY HIDDEN CAM -------------------------------------------- */ /* Para las funciones de espiar durante el show */ var spyHiddenCamTime = 0; /* Tiempo permitido para espiar durante la hidden cam */ var spyHiddenCamTip = 0; /* Tip para espiar durante la hidden cam */ var usersWhoTippedForSpy = []; /* Usuarios que espian durante la hidden cam */ var spy_time_init_cam = []; var spy_actual_time = []; var flagSpyCam = []; function spyCamFunction(position) { if (!executeCallbackFlag) { return; } var notice = ''; ///* Coger la hora a la que conecta la camara */ var d = new Date(); var t = d.getTime(); if (position === undefined) { for (var i = 0; i < usersWhoTippedForSpy.length; i++) { if (usersWhoTippedForSpy[i] !== undefined) { position = i; break; } } } //cb.sendNotice('flagSpyCam['+ position+ ']: ' + flagSpyCam[position], '', BG_COLOR_INFO_TIPPER, FONT_COLOR_INFO_TIPPER, 'bold'); /* Si esta el flag === true se activa la hidden cam para el flash */ if (flagSpyCam[position]) { /* Se incluye al usuario en la hidden cam por el tiempo definido */ if (cb.limitCam_isRunning()) { var addUser = []; addUser.push(usersWhoTippedForSpy[position]); /* Anadir con un array!! */ cb.limitCam_addUsers(addUser); flagSpyCam[position] = false; /* Se le avisa al usuario */ notice = 'Thanks for join to spy my Show. You have now ' + spyHiddenCamTime + ' minute to see it!'; cb.sendNotice(notice, addUser, BG_COLOR_INFO_TIPPER, FONT_COLOR_INFO_TIPPER, 'bold'); /* Se avisa al broadcaster */ notice = 'User [' + addUser + '] has been added to Spy Hidden Cam mode for ' + spyHiddenCamTime + ' minute/s'; cb.sendNotice(notice, cb.room_slug, BG_COLOR_INFO_PVT, FONT_COLOR_INFO_PVT, 'bold'); /* Se avisa al SM */ notice = 'User has been added to Spy Hidden Cam mode for ' + spyHiddenCamTime + ' minute/s'; sendNoticeToSM(notice, addUser); } } //cb.sendNotice('(spy_time_init_cam[' + position + '] === 0): ' + (spy_time_init_cam[position] === 0), usersWhoTippedForSpy[position], BG_COLOR_INFO_TIPPER, FONT_COLOR_INFO_TIPPER, 'bold'); /* Si la hora de inicio del flash esta null se iguala a la hora actual, asimismo la hora actual se coge como referencia para actual_time */ if (spy_time_init_cam[position] === 0) { spy_time_init_cam[position] = t; spy_actual_time[position] = t; sendNoticeToSM('Si ha pasado por aqui mal asunto... (spy_time_init_cam[' + position + '] === 0). Con el usuario', usersWhoTippedForSpy[position]); } else { /* La hora de inicio del flash contiene una hora valida, por lo que se cambia solo la hora actual y se calcula la diferencia de horas */ spy_actual_time[position] = t; /* Si la hora actual supero el limite establecido en la configuracion, hay que parar la hidden cam */ if ((Math.floor((spy_actual_time[position] - spy_time_init_cam[position]) / 60000)) >= spyHiddenCamTime) { var removeUser = []; var strUser = usersWhoTippedForSpy[position]; removeUser.push(strUser); /* Eliminar con un array!! */ cb.limitCam_removeUsers(removeUser); /* El usuario se elimina del array de usuarios que tipearon para espiar por si hubiera varios */ removeUserToSpy(strUser); /* Se le avisa al usuario */ notice = 'Your spy time is over!. '; notice += 'If you want to enjoy whole ' + showStringLong + ' tip now ' + minimum_tip_show + ' tokens or more to join.'; cb.sendNotice(notice, strUser, BG_COLOR_INFO_TIPPER, FONT_COLOR_INFO_TIPPER, 'bold'); /* Se avisa al SM */ notice = 'User has been removed from Spy Hidden Cam'; sendNoticeToSM(notice, strUser); } } } function addUserToSpyHiddenCam(user) { /* Coger la hora a la que conecta la camara */ var d = new Date(); var t = d.getTime(); /* Se anade el usuario al array de espias */ usersWhoTippedForSpy.push(user); /* Se recupera la posicion en la que se he guardado dentro del array */ var pos = usersWhoTippedForSpy.indexOf(user); /* Y en la misma posicion de los arrays de tiempos se guardan los tiempos iniciales */ spy_actual_time[pos] = t; spy_time_init_cam[pos] = t; return pos; } function removeUserToSpy(user) { /* Se busca la posicion en el array */ var pos = usersWhoTippedForSpy.indexOf(user); //cb.sendNotice('Se elimina el usuario: ' + user + ' - De la posicion ' + pos, '', BG_COLOR_INFO_TIPPER, FONT_COLOR_INFO_TIPPER, 'bold'); /* Se borra el usuario */ delete usersWhoTippedForSpy[pos]; /* Y se borran sus tiempos asociados*/ delete spy_actual_time[pos]; delete spy_time_init_cam[pos]; /* y el flag de la camara */ delete flagSpyCam[pos]; } /* -------------------------------------------- CHAT NOTICE -------------------------------------------- */ var iCount = 1; var notice_time = 0; function chatNotice() { var msg; //while (cb.settings['PMessage' + iCount] === 0) { //skip empty messages while (cb.settings['PMessage' + iCount] === '') { //skip empty messages iCount++; if (iCount > 5) { //loop back to first message iCount=1; } } msg = cb.settings['PMessage' + iCount]; iCount++; if (iCount > 5) { //loop back to first message iCount=1; } cb.sendNotice(msg,'',BG_COLOR_INFO_PUBLIC, FONT_COLOR_INFO_PUBLIC,'bold'); if (notice_time > 0) { //cb.sendNotice('Entra a if (notice_time > 0) de dentro de la funcion','',BG_COLOR_INFO_PUBLIC, FONT_COLOR_INFO_PUBLIC,'bold'); cb.setTimeout(chatNotice, (notice_time * 60000)); } } cb.setTimeout(chatNotice, (notice_time * 60000)); /* -------------------------------------------- PENALTY -------------------------------------------- */ var penaltyList = []; function isInPenalty(username) { return cbjs.arrayContains(penaltyList, username); } function makePenalty(username) { penaltyList.push(username); } function removePenalty(username) { cbjs.arrayRemove(penaltyList, username); } /* -------------------------------------------- HIDDEN CAM -------------------------------------------- */ /* **** FLASH Users Array **** */ var usersWhoTippedForFlash = []; /* For the flash */ function clearFlashArray() { while(usersWhoTippedForFlash.length > 0) { usersWhoTippedForFlash.pop(); } } function isUserWhoTippedForFlash(username) { return cbjs.arrayContains(usersWhoTippedForFlash,username); } function addUserForFlash(username) { if(isUserWhoTippedForFlash(username)) return; usersWhoTippedForFlash.push(username); } /** /camflash Returns the allowed hidden cam users for FLASH */ function allowedFlashCam() { var ret = '**** Allowed Hidden Cam Users for FLASH ****'; if (!cb.limitCam_isRunning()) { if (usersWhoTippedForFlash.length === 0) { ret = 'Nobody for Flash Hidden Cam yet.'; return ret; } for (var i = 0; i < usersWhoTippedForFlash.length; i++) { ret += '\n (' + (i + 1) + ') ' + usersWhoTippedForFlash[i]; } } else { debug("CAM is running"); var userlist = cb.limitCam_allUsersWithAccess(); for (var i = 0; i < userlist.length; i++) { ret += '\n (' + (i + 1) + ') ' + userlist[i]; } } return ret; } /* **** ALL FLASHES Users **** */ var allowedMembers = []; /** List of tipper that can see all flashes */ function isInAllowedMembers(username) { return cbjs.arrayContains(allowedMembers,username); } function addAllowedMember(username) { if(isInAllowedMembers(username)) return; allowedMembers.push(username); } /** IMPORTANTE: Se vacia el array para que solo los miembros del club puedan ver el siguiente show */ /** Clean the list of allowed members for all Flashes, adding the allowedMembersList guys */ function recharge_allowedMembers() { /* Borra el array de los miembros que pueden ver el show para el siguiente show*/ while(allowedMembers.length > 0) { allowedMembers.pop(); } /* Recarga a los miembros que se le permite ver los flashes siempre */ if (cb.settings.allowedMembersList) { var allowedMemberSettings = cb.settings.allowedMembersList.split(','); for (var i = 0; i < allowedMemberSettings.length; i++) { addAllowedMember(allowedMemberSettings[i].toLowerCase().replace(/ /g,'')); //allowedMembers.push(allowedMemberSettings[i].toLowerCase().replace(/ /g,'')); } } } /** /camall Returns all member users with access to ALL FLASHES */ function allowedMembersHC() { var ret = '**** All Member user with access to ALL FLASHES ****'; for (var i = 0; i < allowedMembers.length; i++) { ret += '\n (' + (i+1) + ') ' + allowedMembers[i]; } return ret; } /* **** SHOW Users **** */ var usersWhoTippedForShow = []; /* Para el show al llegar al goal*/ function clearShowArray() { while(usersWhoTippedForShow.length > 0) { usersWhoTippedForShow.pop(); } /* Vamos a dejar la cantidad de tokens al lado del tipper aunque se reinicie el Show */ if (omb.ohmibodMode) { omb.reset_show(); } /* if (omb.ohmibodMode) { while(tipperArray.length > 0) { tipperArray.pop(); } numTippers = 0; }*/ } function isUsersWhoTippedForShow(username) { return cbjs.arrayContains(usersWhoTippedForShow,username); } function addUserForShow(username) { if(isUsersWhoTippedForShow(username)) return; usersWhoTippedForShow.push(username); } /** /camshow Returns the allowed hidden cam users for SHOW */ function allowedShowCam() { var ret = '**** Allowed Hidden Cam Users for SHOW ****'; if (usersWhoTippedForShow.length === 0) { ret = 'Nobody for Show Hidden Cam yet.'; return ret; } for (var i = 0; i < usersWhoTippedForShow.length; i++) { ret += '\n (' + (i + 1) + ') ' + usersWhoTippedForShow[i]; } return ret; } /** In case of emergency you can copy and paste the next line after restart the app */ function listAllowedShowCam() { var ret = '**** In case of emergency you can copy and paste the next line after restart the app **** \n'; ret += '/addshow '; for (var i = 0; i < usersWhoTippedForShow.length; i++) { ret += usersWhoTippedForShow[i]; if (i < usersWhoTippedForShow.length - 1) { ret += ','; } } return ret; } function clearVars() { /* Para evitar que se siga ejecutando el setTimeOut */ executeCallbackFlag = false; /* Reinicio las variables */ flagCam = false; time_init_cam = 0; actual_time = 0; time_init_cam1 = 0; actual_time1 = 0; //extendTimePay = 0; } /** Copy user show or flash show members into the array allowedMembers */ function copyAllowedMembers() { if (isShowMode) { // TODO does this make sense? user for ALL FLASHES have right to see the show? // TODO I dont think so for (var i = 0; i<allowedMembers.length; i++){ addUserForShow(allowedMembers[i]); //usersWhoTippedForShow.push(allowedMembers[i]); } } else { for (var i = 0; i < allowedMembers.length; i++) { addUserForFlash(allowedMembers[i]); //usersWhoTippedForFlash.push(allowedMembers[i]); } } } function isInNotAllowedMembers(username) { return cbjs.arrayContains(notAllowedMembers,username) } /** Stops the HC and sends notices */ function hc_stop_flash() { /* Reset global variables */ clearVars(); /* Se devuelve el valor del flash original */ flashTime = originalFlashTime; /* Se vacia el array de tipeadores del flash */ clearFlashArray(); if (isShowMode) { /* Se vuelve a poner el panel para los flashes */ flashes_counter = 0; flashes_to_goal = setting_number_flashes_to_goal - flashes_counter; /* Increase goal counter */ times_goal_reached = times_goal_reached + 1; /* Se cambia el modo a "FLASH" */ isShowMode = false; showTypeString = 'Flash'; /* y se vacia el array de los tippers que estuvieron en el Show. Todo vuelve a empezar de nuevo */ clearShowArray(); /* IMPORTANTE: Se vacia el array para que solo los miembros del club puedan ver el siguiente show */ recharge_allowedMembers(); } /* Actualizar el topico SIEMPRE */ update_subject(); /* Stops limitCam */ cb.limitCam_removeAllUsers(); cb.limitCam_stop(); } /** Starts cam with flagCam true, stops when time is over */ function camFunction() { if (!executeCallbackFlag) { return; } /* Coger la hora a la que conecta la camara */ var d = new Date(); var t = d.getTime(); var secondsUntilNow = 0; var secondsLeft = 0; var extendText = ''; /* Si esta el flag === true se activa la hidden cam para el flash */ if (flagCam) { /* START HIDDEN CAMERA */ sendStartNotification(); var camAdvertise = ''; /* Justo antes de arrancar el flash o el show se copian los miembros que tienen permitido ver a los arrays que se pasan a la camara */ copyAllowedMembers(); if (isShowMode) { /* Actualizar el topico */ update_subject(); var spyMode = ''; if (spyHiddenCamTime > 0) { spyMode = '\n You can Spy for ' + spyHiddenCamTime + ' min for exact ' + spyHiddenCamTip + ' tks!'; } camAdvertise = SHOW_IN_PROGRESS_TEXT1 + showStringLong + '! Tip ' + minimum_tip_show + SHOW_IN_PROGRESS_TEXT2 + spyMode; cb.limitCam_start(camAdvertise, usersWhoTippedForShow); } else { camAdvertise = FLASH_IN_PROGRESS_TEXT1 + minimum_tip_flash + FLASH_IN_PROGRESS_TEXT2 + showStringLong + '!'; cb.limitCam_start(camAdvertise, usersWhoTippedForFlash); } flagCam = false; cb.sendNotice('........ :cap01_lt ........', cb.room_slug, '#2BE915', '#2BE915', ''); sendHCStatusToSM(cb.limitCam_isRunning()); } /* Si la hora de inicio del flash esta null se iguala a la hora actual, asimismo la hora actual se coge como referencia para actual_time */ if (time_init_cam === 0) { time_init_cam = t; actual_time = t; } else { /* La hora de inicio del flash contiene una hora valida, por lo que se cambia solo la hora actual y se calcula la diferencia de horas */ actual_time = t; /* Si la hora actual supero el limite establecido en la configuracion, hay que parar la hidden cam y poner el flagCam = false */ if ((Math.floor((actual_time - time_init_cam) / 60000)) >= hiddenCamTime) { var notice = '** ' + showTypeString + ' finished!'; /* Si se utiliza el comando /extend finaliza por aqui */ cb.sendNotice(notice, '', BG_COLOR_INFO_PUBLIC, FONT_COLOR_INFO_PUBLIC, 'bold'); hc_stop_flash(); /* Send notice to the model */ cb.sendNotice('........ :cap03_lt ........', cb.room_slug, '#F00D2B', '#F00D2B', ''); sendHCStatusToSM(cb.limitCam_isRunning()); } else { /* NEW */ secondsUntilNow = ((actual_time - time_init_cam) / 1000); secondsLeft = (hiddenCamTime * 60) - secondsUntilNow; if (extendTimePay > 0) { extendText = NL + 'You can extend the ' + showTypeString + ' time in ' + extendTimeBuyed + ' minutes for ' + extendTimePay + ' tokens single tip.'; } /* Controlar que no sale el mismo mensaje dos veces cuando se extiende el tiempo (No se por que ocurre) */ var actualCounterMessage = convertTime(secondsLeft); if (lastCounterMessage !== actualCounterMessage) { /* Avisa al modelo 30 segundos antes de terminar el show */ if (secondsLeft <= 31) { cb.sendNotice('********* Less than 30 seconds to finish ' + showTypeString + '! *********', cb.room_slug, '#FA8723', FONT_COLOR_INFO_PUBLIC, 'bold'); } cb.sendNotice('** Less than ' + actualCounterMessage + ' to finish ' + showTypeString + '!' + extendText,'',BG_COLOR_INFO_PUBLIC, FONT_COLOR_INFO_PUBLIC, 'bold'); lastCounterMessage = actualCounterMessage; } } /* NEW */ } } /** Write the time left every 30 seconds, plus checks if the show is over */ function showTimeAdvice() { if (!executeCallbackFlag) { return; } /* Coger la hora a la que conecta la camara */ var d = new Date(); var t = d.getTime(); var secondsUntilNow = 0; var secondsLeft = 0; var extendText = ''; /* Si la hora de inicio del flash esta a 0 se iguala a la hora actual, asimismo la hora actual se coge como referencia para actual_time1 */ if (time_init_cam1 === 0) { time_init_cam1 = t; actual_time1 = t; } else { /* La hora de inicio del flash contiene una hora valida, por lo que se cambia solo la hora actual y se calcula la diferencia de horas */ actual_time1 = t; /* Si la hora actual supero el limite establecido en la configuracion se comunica en la sala */ if ((Math.floor((actual_time1 - time_init_cam1) / 60000)) >= hiddenCamTime) { var notice = '** ' + showTypeString + ' finished!'; /* Si se utiliza el comando /extend finaliza por aqui */ cb.sendNotice(notice, '', BG_COLOR_INFO_PUBLIC, FONT_COLOR_INFO_PUBLIC, 'bold'); hc_stop_flash(); // clearVars(); // flashTime = originalFlashTime; // clearFlashArray(); // if (isShowMode) { // flashes_counter = 0; // flashes_to_goal = setting_number_flashes_to_goal - flashes_counter; // times_goal_reached = times_goal_reached + 1; // isShowMode = false; // showTypeString = 'Flash'; // clearShowArray(); // recharge_allowedMembers(); // } // update_subject(); // cb.limitCam_removeAllUsers(); // cb.limitCam_stop(); cb.sendNotice('........ :cap03_lt ........', cb.room_slug, '#F00D2B', '#F00D2B', ''); return; } else { // secondsUntilNow = ((actual_time1 - time_init_cam1) / 1000); // secondsLeft = (hiddenCamTime * 60) - secondsUntilNow; // // /* Avisa al modelo 30 segundos antes de que va a terminar el show/flash */ // if (secondsLeft <= 31) { // cb.sendNotice('********* Less than 30 seconds to finish ' + showTypeString + '! *********', cb.room_slug, '#FA8723', FONT_COLOR_INFO_PUBLIC, 'bold'); // } // // cb.sendNotice('** Less than ' + convertTime(secondsLeft) + ' to finish ' + showTypeString + '!','',BG_COLOR_INFO_PUBLIC, FONT_COLOR_INFO_PUBLIC, 'bold'); secondsUntilNow = ((actual_time1 - time_init_cam1) / 1000); secondsLeft = (hiddenCamTime * 60) - secondsUntilNow; if (extendTimePay > 0) { extendText = NL + 'You can extend the ' + showTypeString + ' time in ' + extendTimeBuyed + ' minutes for ' + extendTimePay + ' tokens single tip.'; } /* Controlar que no salga el mismo mensaje dos veces cuando se extiende el tiempo (No se por que ocurre) */ var actualCounterMessage = convertTime(secondsLeft); if (lastCounterMessage !== actualCounterMessage) { /* Avisa al modelo 30 segundos antes de terminar el show */ if (secondsLeft <= 31) { cb.sendNotice('********* Less than 30 seconds to finish ' + showTypeString + '! *********', cb.room_slug, '#FA8723', FONT_COLOR_INFO_PUBLIC, 'bold'); } cb.sendNotice('** Less than ' + actualCounterMessage + ' to finish ' + showTypeString + '!' + extendText, '', BG_COLOR_INFO_PUBLIC, FONT_COLOR_INFO_PUBLIC, 'bold'); lastCounterMessage = actualCounterMessage; } } } /* Segun se acerca al final muestra el aviso cada menos tiempo. Si faltan mas de 5 minutos para terminar el show el aviso se muestra cada 3 minutos, si el tiempo es menor de 5 minutos se muestra cada 30 segudos */ if (hiddenCamTime >= 5) { if (((actual_time1 - time_init_cam1) / 60000) <= (hiddenCamTime-5)) { cb.setTimeout(showTimeAdvice, (3 * 60000)); } else { cb.setTimeout(showTimeAdvice, (0.5 * 60000)); } } else { cb.setTimeout(showTimeAdvice, (0.5 * 60000)); } } /** /camnow Returns all users with access to Hidden Cam NOW */ function allowedThisCam() { if (!cb.limitCam_isRunning()) { return 'Nobody for this Hidden Cam yet!!.'; } var userlist = cb.limitCam_allUsersWithAccess(); var ret = '**** All Users with access to Hidden Cam NOW ****'; for (var i = 0; i < userlist.length; i++) { ret += '\n (' + (i+1) + ') ' + userlist[i]; } return ret; } /* -------------------------------------------- CB SETTINGS -------------------------------------------- */ cb.settings_choices = [ {name: 'execColour', type: 'str', label: 'Coloured', required: true}, /* Sistema de proteccion de la aplicacion por password*/ {name: 'modelName', type: 'str', label: 'Model name', required: true}, /* Nombre real de la modelo */ { name: 'goal_description', type: 'str', minLength: 1, maxLength: 255}, /* Numero de flashes necesarios para llegar al goal y por lo tanto al Show */ { name: 'goals', label: 'Set flashes', type: 'int', minValue: 1, defaultValue: 100}, /* Tips que no cuentan para goal (lovers, etc.) */ { name: 'stdTipList', label: 'Standard Tips', type: 'str', minLength: 0, maxLength: 10240, required: false, defaultValue: ''}, /* Valor minimo con el que arrancar un flash */ { name: 'minimum_flash', label: 'Min. Flash', type: 'int', minValue: 1, defaultValue: 99}, /* Numero de veces que al pagar un flash te da derecho a ver el resto de flashes (el show se puede ver desde que se compre un ticket para un flash) */ { name: 'all_flashes', label: 'In all Flashes at', type: 'int', minValue: 1, defaultValue: 3}, { name: 'in_show', label: 'In Show at', type: 'int', minValue: 1, defaultValue: 4}, /* Valor del ticket una vez comenzado el Show */ { name: 'minimum_show', label: 'Min. Show', type: 'int', minValue: 1, defaultValue: 150}, { name: 'flash_time', type: 'choice', label: 'Flash Time', choice1: 1, choice2: 2, choice3: 3, choice4: 4, choice5: 5, choice6: 6, choice7: 7, choice8: 8, choice9: 9, choice10: 10, choice11: 15, choice12: 20, choice13: 25, choice14: 30, choice15: 45, choice16: 60, choice17: 75, choice18: 90, defaultValue: 3}, { name: 'show_time', type: 'choice', label: 'Show Time', choice1: 1, choice2: 2, choice3: 3, choice4: 4, choice5: 5, choice6: 6, choice7: 7, choice8: 8, choice9: 9, choice10: 10, choice11: 15, choice12: 20, choice13: 25, choice14: 30, choice15: 45, choice16: 60, choice17: 75, choice18: 90, defaultValue: 10}, { name: 'auto_show', type: 'choice', label: 'Automatic Start Show?', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes'}, { name: 'show_Type', type: 'choice', label: 'Type', choice1: 'Flash', choice2: 'Show', defaultValue: 'Flash'}, { name: 'show_Desc', type: 'choice', label: 'Show Description', choice1: 'Naked', choice2: 'Shower', choice3: 'Oil', choice4: 'Wet Shirt', choice5: 'Body Lotion', choice6: 'OhMiBod', choice7: 'Special Show', defaultValue: '------'}, { name: 'hidden', type: 'choice', label: 'Start Hidden Cam', choice1: 'Yes', choice2: 'No', defaultValue: 'No'}, { name: 'pTime', type: 'choice', label: 'PTime', choice1: 'Yes', choice2: 'No', defaultValue: 'No'}, { name: 'spy_tip', label: 'Spy Tip', type: 'int', minValue: 1, defaultValue: 50}, { name: 'spy_time', type: 'choice', label: 'Spy Time (minutes)', choice1: 0, choice2: 1, choice3: 2, choice4: 3, defaultValue: 1}, { name: 'allowedMembersList', label: 'Allowed', type: 'str', minLength: 0, maxLength: 10240, required: false, defaultValue: ''}, { name: 'notAllowedMembersList', label: 'NOT Allowed', type: 'str', minLength: 0, maxLength: 10240, required: false, defaultValue: ''}, { name: 'superModList', label: 'Super Mod', type: 'str', minLength: 0, maxLength: 10240, required: false, defaultValue: ''}, { name: 'PMessage1', label: 'Personal Msg*', type: 'str', minLength: 0, maxLength: 10240, required: false, defaultValue: ''}, { name: 'PMessage2', label: 'Personal Msg 1*', type: 'str', minLength: 0, maxLength: 10240, required: false, defaultValue: ''}, { name: 'PMessage3', label: 'Personal Msg 2*', type: 'str', minLength: 0, maxLength: 10240, required: false, defaultValue: ''}, { name: 'PMessage4', label: 'Personal Msg 3', type: 'str', minLength: 0, maxLength: 10240, required: false, defaultValue: ''}, { name: 'PMessage5', label: 'Personal Msg 4', type: 'str', minLength: 0, maxLength: 10240, required: false, defaultValue: ''}, { name: 'notice_time', type: 'choice', label: 'Ad Time', choice1: 0, choice2: 1, choice3: 4, choice4: 5, choice5: 6, choice6: 7, choice7: 8, choice8: 9, choice9: 10, defaultValue: 5}, { name: 'YellowWall', label: 'YW protection level', type: 'int', minValue: 0, defaultValue: 50}, { name: 'pFee', label: 'Penalty fee', type: 'int', minValue: 0, defaultValue: 0}, /* Tiempo a extender cuando se paga la extension (siguiente campo) */ {name: 'extendTimeMinutes', type: 'int', label: 'Extend time in minutes', minValue: 0, defaultValue: 2}, /* Tokens necesarios para extender el tiempo del Show */ {name: 'extendTimePay', type: 'int', label: 'Tokens to extend time in X minutes', minValue: 0, defaultValue: 100} ]; /* -------------------------------------------- CB HANDLERS -------------------------------------------- */ /** Handle messages from the chat */ cb.onMessage(function(msg) { /* De esta manera evitamos que otros modelos puedan utilizar la aplicacion */ /* Comprobacion de modelo autorizada con la variable global "STBC" (CMA) */ if (STBC) { msg.m = 'UNAUTHORIZED MODEL'; return msg; } var u = msg['user']; var isModel = (u === cb.room_slug); var isMod = msg['is_mod']; var blueUser = msg['has_tokens']; /* Tiene tokens? (light blue) */ var fanClubUser = msg['in_fanclub']; /* Es del club de fans? */ var darkBlueUser = msg['tipped_recently']; /* Ha tipeado recientemente? (dark blue) */ var noticeToUser = ''; // RE: start. // RE: split the command line var _cmd = msg.m.split(/\s/g); var cmd = []; for(var i=0; i<_cmd.length; i++) { if(_cmd[i]>'') cmd.push(_cmd[i]); } // while(cmd.length>0 && cmd[0]==='') { cmd.splice(0,1); } // Cleans empty elements at the beginning // for(var i=0; i<cmd.length; i++) { // debug("cmd: '"+cmd[i]+"'"); // } // RE: end. var isGrey = !(fanClubUser || isMod || blueUser || darkBlueUser || isModel); var notice = ''; /* Si es un usuario silenciado hasta que pague no se le deja hablar */ if (isInPenalty(u)) { msg['X-Spam'] = true; var noticeToUser = 'You have been silenced by ' + U_M_N + ' for your inappropriate behavior. \n'; noticeToUser += 'If you want to talk back again change your attitude and pay ' + penaltyTip + ' tokens as a penalty.'; cb.sendNotice(noticeToUser, u, BG_COLOR_INFO_PUBLIC, FONT_COLOR_INFO_PUBLIC, 'bold'); } /* Muestra informacion extra sobre el funcionamiento de la app a los usuarios (blue) que lo pidan */ if (cmd[0] == COMMAND_SHOW_EXTRA_INFO) { msg['X-Spam'] = true; if (blueUser) { /* Si el Super Mod esta enviando informacion a otro usuario */ if (isModel || isSuperMod(u)) { var noUser = msg.m.substring(3, msg.m.length); if (noUser !== '') { u = msg.m.substring(3, msg.m.length); /* !i */ } } cb.sendNotice('!i - More info sent to ' + u, '', BG_COLOR_MORE_INFO, FONT_COLOR_MORE_INFO, 'bold'); noticeToUser = ''; if (!isShowMode) { if (omb.ohmibodMode) { noticeToUser = '************** HOW DOES THIS WORK? ************** \n'; noticeToUser += 'Tip single ' + minimum_tip_flash + ' for a INSTANT Flash under hidden cam. \n'; noticeToUser += 'Show start when all Tickets are sold out.'; noticeToUser += 'When you join to a Flash when this already have started you can\'t choose. Whoever tip first and start the Flash is who can pick the current Flash.\n'; noticeToUser += 'If you tip for ' + times_to_free_flashes + ' Flashes or equivalent amount (' + (times_to_free_flashes * minimum_tip_flash) + ' tokens) you will watch all Flashes of this session for free! \n'; noticeToUser += 'If you tip for ' + times_to_free_show + ' Flashes or equivalent amount (' + (times_to_free_show * minimum_tip_flash) + ' tokens) you will watch all flashes and get ticket for final Show. \n'; noticeToUser += 'In all Flashes are my POC Motor Club Members, you can join to the Club to get all benefits as watch all Flashes and Shows for free :) \n'; noticeToUser += 'You can keep helping tipping for Flashes for reach goal faster and enjoy the ' + showStringLong + '! \n'; noticeToUser += 'Tips of Road Lover, special Shows or Raffles doesn\'t count for Flashes or Goals. \n'; noticeToUser += 'If you want to tip me and that no count for Flashes or Goals you just type nogoal in the tip note and it\'s done! \n'; noticeToUser += 'Read my bio to extend info about POC Motor Club memberships \n'; } else { /* Informacion acerca del funcionamiento de los flashes/show */ noticeToUser = '************** HOW DOES THIS WORK? ************** \n'; noticeToUser += 'Tip single ' + minimum_tip_flash + ' for a INSTANT Flash under hidden cam and get your Ticket for the Show. \n'; noticeToUser += 'Show start when all Tickets are sold out.'; noticeToUser += 'When you join to a Flash when this already have started you can\'t choose. Whoever tip first and start the Flash is who can pick the current Flash.\n'; noticeToUser += 'If you tip for ' + times_to_free_flashes + ' Flashes or equivalent amount (' + (times_to_free_flashes * minimum_tip_flash) + ' tokens) you will watch all Flashes of this session for free! \n'; noticeToUser += 'In all Flashes are my POC Motor Club Members, you can join to the Club to get all benefits as watch all Flashes and Shows for free :) \n'; noticeToUser += 'You can keep helping tipping for Flashes for reach goal faster and enjoy the ' + showStringLong + '! \n'; noticeToUser += 'Tips of Road Lover, special Shows or Raffles doesn\'t count for Flashes or Goals. \n'; noticeToUser += 'If you want to tip me and that no count for Flashes or Goals you just type nogoal in the tip note and it\'s done! \n'; noticeToUser += 'Read my bio to extend info about POC Motor Club memberships \n'; } } else { /* Informacion acerca del funcionamiento de los flashes/show */ noticeToUser = '************** HOW DOES THIS WORK? ************** \n'; noticeToUser += 'Only Tip single ' + minimum_tip_show + ' or more and enjoy the Show under hidden cam ;) \n'; } /* Informacion acerca del funcionamiento de la Hidden Cam en los dispositivos moviles */ noticeToUser += '******** TECHNICAL HIDDEN CAM INFORMATION ******** \n'; noticeToUser += 'If you are using a tablet or phone the hidden cam feature for \n'; noticeToUser += 'see the ' + showTypeString + ' WILL NOT WORK unless your browser is Flash compatible. \n'; noticeToUser += 'Either install the free Photon browser app on your device, \n'; noticeToUser += 'or purchase the Puffin browser app. (Apps avalaible for Android and iOS devices)'; //sendNoticeToSM('More info sent to', u); } else if (isGrey) { noticeToUser = 'You are a grey user. Buy tokens to see this info!'; } cb.sendNotice(noticeToUser, u, BG_COLOR_INFO_TIPPER, FONT_COLOR_INFO_TIPPER, 'bold'); } /* Puede usar estos comandos solo el modelo y el super mod */ if (isModel || isSuperMod(u)) { /* Activa la caracteristica de Hidden Cam */ if (cmd[0]==COMMAND_HIDDEN_CAM_ON) { msg['X-Spam'] = true; hidden_cam = true; notice = '>>>> Hidden Cam feature is ON \n'; notice += appStatus(); clearVars(); //clearFlashArray(); /* Poner o no poner? Es mas de concepto que de otra cosa */ update_subject(); /* Desativa la caracteristica de Hidden Cam */ } else if (cmd[0]==COMMAND_HIDDEN_CAM_OFF) { msg['X-Spam'] = true; hidden_cam = false; notice = '>>>> Hidden Cam feature is OFF \n'; notice += appStatus(); update_subject(); /* Realiza una parada de emergencia durante el flash, vuelve a broadcasting publico */ } else if (cmd[0]==COMMAND_HIDDEN_CAM_STOP) { msg['X-Spam'] = true; if (cb.limitCam_isRunning()) { var notice = '** ' + showTypeString + ' finished!'; cb.sendNotice(notice, '', BG_COLOR_INFO_PUBLIC, FONT_COLOR_INFO_PUBLIC, 'bold'); } hc_stop_flash(); // clearVars(); // /* Se devuelve el valor del flash original */ // flashTime = originalFlashTime; // /* Se vacia el array de tipeadores */ // clearFlashArray(); // if (isShowMode) { // /* Se vuelve a poner el panel para los flashes */ // flashes_counter = 0; // flashes_to_goal = setting_number_flashes_to_goal - flashes_counter; // /* Se cambia el modo a "FLASH" */ // isShowMode = false; // showTypeString = 'Flash'; // /* y se vacia el array de los tippers que estuvieron en el Show. Todo vuelve a empezar de nuevo */ // clearShowArray(); // /* IMPORTANTE: Se vacia el array para que solo los miembros del club puedan ver el siguiente show */ // // RE: here is missing the following line // // RE: this command is used also to stop the single flash, // // RE: so is better not to clean it? // recharge_allowedMembers(); // } // /* Se para la camara de emergencia */ // cb.limitCam_stop(); // cb.limitCam_removeAllUsers(); notice = 'Attention: Forced shutdown Hidden Cam feature!!'; /* Modifica la cantidad minima requerida para poder entrar a ver el Flash (/ftip 2)*/ } else if (cmd[0]==COMMAND_TIP_FOR_FLASH) { msg['X-Spam'] = true; var newTip = 0; newTip = parseInt(cmd[1]); if (isNaN(newTip)) { notice = 'Please, enter a valid number for new Flash tip'; } else { minimum_tip_flash = newTip; /* Actualiza el topico con el nuevo minimo para ver el flash */ notice = 'Set Flash tip to: ' + minimum_tip_flash + ' tokens'; update_subject(); } /* Modifica la cantidad minima requerida para poder entrar a ver el Show (/stip 4)*/ } else if (cmd[0]==COMMAND_TIP_FOR_SHOW) { msg['X-Spam'] = true; var newTip = 0; newTip = parseInt(cmd[1]); if (isNaN(newTip)) { notice = 'Please, enter a valid number for new Show tip'; } else { minimum_tip_show = newTip; /* Actualiza el topico con el nuevo minimo para ver el show */ notice = 'Set Show tip to: ' + minimum_tip_show + ' tokens'; update_subject(); } /* Modifica el tiempo configurado para el flash (minutos) (/ftime 2) */ } else if (cmd[0]==COMMAND_TIME_FOR_FLASH) { msg['X-Spam'] = true; var newFlashTime = 0; if (cb.limitCam_isRunning()) { notice = 'ATTENTION!: The hidden cam feature is running in this moment, you cannot set different time now!'; } else { newFlashTime = parseInt(cmd[1]); //newFlashTime = parseInt(msg.m.substring(7, msg.m.length)); if (isNaN(newFlashTime)) { notice = 'Please, enter a valid number for new flash time'; } else { flashTime = newFlashTime; originalFlashTime = flashTime; /* Se guarda el nuevo tiempo para volverlo a pasar si se extiende el tiempo original */ /* Actualiza el nuevo tiempo de duracion del flash */ notice = 'Set flash time to: ' + flashTime + (flashTime === 1 ? ' minute' : ' minutes'); } } /* Modifica el tiempo configurado para el show (minutos) (/stime 2) */ } else if (cmd[0]==COMMAND_TIME_FOR_SHOW) { msg['X-Spam'] = true; var newShowTime = 0; if (cb.limitCam_isRunning()) { notice = 'ATTENTION!: The hidden cam feature is running in this moment, you cannot set different time now!'; } else { newShowTime = parseInt(cmd[1]); //newShowTime = parseInt(msg.m.substring(7, msg.m.length)); if (isNaN(newShowTime)) { notice = 'Please, enter a valid number for new show time'; } else { showTime = newShowTime; originalFlashTime = flashTime; /* Se guarda el nuevo tiempo para volverlo a pasar si se extiende el tiempo original */ /* Actualiza el nuevo tiempo de duracion del flash */ if (showTime === 1) { notice = 'Set show time to: ' + showTime + ' minute'; } else { notice = 'Set show time to: ' + showTime + ' minutes'; } } } /* Modifica el tiempo configurado para la hidden cam (minutos) */ } else if (cmd[0]==COMMAND_EXTEND_TIME) { msg['X-Spam'] = true; var extendTime = 0; var changed = ''; if (!cb.limitCam_isRunning()) { notice = 'ATTENTION!: The hidden cam feature is NOT running in this moment, you cannot set extend time now!'; } else { extendTime = cmd.length>1 ? parseInt(cmd[1]) : 1; if (isNaN(extendTime)) { notice = 'Please, enter a valid number for the extend time'; } else { /* Actualiza el nuevo tiempo de duracion del flash */ hiddenCamTime = parseInt(hiddenCamTime) + parseInt(extendTime); if (extendTime === 1) { changed = R_M_N + ' has extended the ' + showTypeString + ' time in ' + extendTime + ' minute \n'; } else { changed = R_M_N + ' has extended the ' + showTypeString + ' time in ' + extendTime + ' minutes \n'; } changed += 'Total time now: ' + hiddenCamTime + ' minutes'; cb.sendNotice(changed, '', BG_COLOR_INFO_PUBLIC, FONT_COLOR_INFO_PUBLIC, 'bold'); } } /* Inicia hidden cam automaticamente, se le pasan los minutos que se quiera de flash o show */ } else if (cmd[0]==COMMAND_START_HIDDEN_CAM) { msg['X-Spam'] = true; var newTime = 0; if (cb.limitCam_isRunning()) { notice = 'ATTENTION!: The hidden cam feature is running in this moment!'; } else { newTime = parseInt(cmd[1]); if (isNaN(newTime)) { notice = 'Please, enter a valid number for time'; } else { /* Actualiza el nuevo tiempo de duracion del flash */ //flashTime = newTime; hiddenCamTime = newTime; notice = 'Starting hidden cam function for: ' + hiddenCamTime + ' minutes'; if (flagCam === false) { /* Se pasan los miembros permitidos al array de usuarios que han tipeado*/ //copyAllowedMembers(); flagCam = true; executeCallbackFlag = true; /* Es un semaforo que tiene en cuenta la parada de emergencia */ /* se pasa el flag automaticShow a true;*/ automaticShow = true; camFunction(); cb.setTimeout(camFunction, hiddenCamTime * 60000); /* Mensaje que informa cada x del tiempo que resta */ showTimeAdvice(); } } } /* Indica el tiempo hasta que empiece el show automaticamente */ } else if (cmd[0]==COMMAND_TIME_TO_START_HIDDEN_CAM) { msg['X-Spam'] = true; if (cb.limitCam_isRunning()) { notice = 'ATTENTION!: The hidden cam feature is running in this moment!'; } else { toStartTime = parseInt(cmd[1]); /* Se resetea la variable por si se quiere reiniciar el temprizador */ time_init_msg = 0; if (isNaN(toStartTime)) { notice = 'Please, enter a valid number for time'; } else { notice = 'The hidden cam function will start in: ' + toStartTime + ' minutes'; toStartShowTimeAdvice(); } } /* Indica el tiempo para marcharse. Se para cuando alguien tipea */ } else if (cmd[0]==COMMAND_TIME_TO_GO) { msg['X-Spam'] = true; if (isShowMode) { notice = 'ATTENTION!: You are in Show mode, this command is not avalaible now!'; } else { if (cb.limitCam_isRunning()) { notice = 'ATTENTION!: The hidden cam feature is running in this moment!'; } else { toGoTime = cmd.length<2 ? 11 : parseInt(cmd[1]); /* Se resetea la variable por si se quiere reiniciar el temprizador */ time_init_msg_go = 0; if (isNaN(toGoTime)) { notice = 'Please, enter a valid number for time'; } else { notice = 'I leave in: ' + toGoTime + ' minutes'; toGoTimeAdvice(); } } } /* Anade un usurio para que pueda ver todo el show */ } else if (cmd[0]==COMMAND_ADD_USER_WHOLE_SHOW) { msg['X-Spam'] = true; var usersList = cmd.splice(1); // RE Add all users // user.replace(/\s/g,''); // allowedMembers.push(user); if (cb.limitCam_isRunning()) { cb.limitCam_addUsers(usersList); notice = (usersList.map(function(_u){ return 'User ' + _u + ' has been added to the current show'; })).join("\n"); // RE-NEW: /addshow add user to the show list } else { // Cam is not running, add them for the final show notice = (usersList.map(function(_u){ if(!isInAllowedMembers(_u)) { addUserForShow(_u); } // if(!isUsersWhoTippedForShow(_u) && !isInAllowedMembers(_u)) { // usersWhoTippedForShow.push(_u); // } return 'User ' + _u + ' has been added to the current show'; })).join("\n"); } /* Add one user to the current flash */ } else if (cmd[0]==COMMAND_ADD_USER_TO_FLASH) { msg['X-Spam'] = true; if (cb.limitCam_isRunning()) { var user = ''; var tipper = []; user = cmd[1]; //user.replace(/\s/g, ''); tipper.push(user); /* Anadir con un array!! */ cb.limitCam_addUsers(tipper); notice = 'User ' + user + ' has been added to hidden cam show'; } else { notice += 'Hidden Cam feauture is NOT running - You are NOT in a flash time'; } /* Elimina un usuario solo durante el flash */ } else if (cmd[0]==COMMAND_REMOVE_USER_FROM_FLASH) { // RE TODO test this online msg['X-Spam'] = true; if (cb.limitCam_isRunning()) { var userX = ''; var removeUser = []; userX = cmd[1]; debug('userX=' + userX + '.'); removeUser.push(userX); //userX.replace(/\s/g, ''); // TODO maybe the bug is in this condition // 20170325: Start. var userslist = cb.limitCam_allUsersWithAccess(); // if(userslist.indexOf(userX) >= 0) { //if (cbjs.arrayContains(cb.limitCam_allUsersWithAccess(), userX)) { // 20170325: End. cb.limitCam_removeUsers(removeUser); notice = 'User ' + userX + ' has been removed from hidden cam show'; // } else { // notice = 'User ' + userX + ' is not in the hidden cam show'; // } //removeUser.push(userX); ///* Eliminar con un array!! */ //cb.limitCam_removeUsers(removeUser); //notice = 'User ' + userX + ' has been removed from hidden cam show'; } else { notice += 'Hidden Cam feature is NOT running - You are NOT in a flash time'; } /* Modifica el numero de flashes necesarios para llegar al goal */ } else if (cmd[0]==COMMAND_SET_GOAL) { msg['X-Spam'] = true; /* Comprobar que el nuevo numero sea mayor que el de flashes alcanzados */ var newSet = parseInt(cmd[1]); if (isNaN(newSet)) { notice = 'Please, enter a valid number for goal'; } else { if (newSet > flashes_counter) { setting_number_flashes_to_goal = newSet; // RE fixed this :-) See panel flashes_to_goal = setting_number_flashes_to_goal - flashes_counter; notice = 'Goal amount changed to: ' + setting_number_flashes_to_goal + ' flashes'; cb.drawPanel(); } else { notice = 'The amount entered must be greater than the number of flashes reached'; } } /* Modifica el numero de flashes alcanzados (Solo usado para pruebas) ****************** */ } else if (cmd[0]==COMMAND_SET_FLASHES_REACHED) { msg['X-Spam'] = true; var newSet = parseInt(cmd[1]); if (isNaN(newSet)) { notice = 'Please, enter a valid number for flashes'; } else { flashes_counter = newSet; flashes_to_goal = setting_number_flashes_to_goal - flashes_counter; notice = 'Flashes reached amount changed to: ' + flashes_counter + ' flashes'; cb.drawPanel(); } /* Modifica la descripcion del topico */ } else if (cmd[0]==COMMAND_NOTICE_ON_OFF) { msg['X-Spam'] = true; if (notice_time > 0) { notice_time = 0; notice = 'Notifier is OFF!'; } else if (notice_time === 0) { notice_time = cb.settings.notice_time; chatNotice(); notice = 'Notifier is ON! (every ' + notice_time + ' minutes)'; } /* Modifica la descripcion del topico */ } else if (cmd[0]==COMMAND_GOAL_TOPIC) { msg['X-Spam'] = true; current_goal_description = trim((''+msg.m).replace(COMMAND_GOAL_TOPIC+' ', '')); notice = 'Goal description changed to: ' + current_goal_description; update_subject(); /* Silencia temporalmente a un usuario hasta que paga la multa para poder hablar de nuevo */ } else if (cmd[0]==COMMAND_PAY_PENALTY) { msg['X-Spam'] = true; var penaltyUser = trim(cmd[1]); noticeToUser = 'You have been silenced by ' + U_M_N + ' for your inappropriate behavior. \n'; noticeToUser += 'If you want to talk back again change your attitude and pay ' + penaltyTip + ' tokens as a penalty.'; makePenalty(penaltyUser); notice = 'The user ' + penaltyUser + ' has been silenced until pay ' + penaltyTip + ' tokens as a penalty :redcard'; cb.sendNotice(noticeToUser, penaltyUser, BG_COLOR_INFO_PUBLIC, FONT_COLOR_INFO_PUBLIC, 'bold'); cb.sendNotice(notice, '', BG_COLOR_INFO_PUBLIC, FONT_COLOR_INFO_PUBLIC, 'bold'); /* Se vacia la variable para que no salga dos veces en el chat del modelo */ notice = ''; /* Ofrece informacion de la configuracion de la aplicacion */ } else if (cmd[0]==COMMAND_APP_STATUS) { msg['X-Spam'] = true; notice = appStatus(); /* Muestra los tokens recibidos hasta el momento */ } else if (cmd[0]==COMMAND_GLOBAL_TOKENS) { msg['X-Spam'] = true; //cb.drawPanel(); /* Fuerza el repintado*/ notice = 'Total ' + total_tokens_tipped + ' tokens in this session'; /* Muestra todos los usuarios que tienen permiso para ver la Hidden Cam este flash */ } else if (cmd[0]==COMMAND_SHOW_ALLOWED_FLASH_CAM_USERS) { msg['X-Spam'] = true; notice = allowedFlashCam(); /* Muestra todos los usuarios que tienen permiso para ver la Hidden Cam cuando llegue el show */ } else if (cmd[0]==COMMAND_SHOW_ALLOWED_SHOW_CAM_USERS) { msg['X-Spam'] = true; // camshow notice = allowedShowCam(); /* Muestra todos los usuarios que estan viendo la Hidden Cam en este momento */ } else if (cmd[0]==COMMAND_SHOW_ALLOWED_NOW_CAM_USERS) { // camnow msg['X-Spam'] = true; notice = allowedThisCam(); /* Muestra todos los usuarios que estan en el array de allowedMembers */ } else if (cmd[0]==COMMAND_SHOW_ALLOWED_MEMBERS) { msg['X-Spam'] = true; // camall notice = allowedMembersHC(); /* Modifica el tipo de show (FLASH o SHOW) */ } else if (cmd[0]==COMMAND_CHANGE_TYPE_OF_SHOW) { msg['X-Spam'] = true; var changedType = ''+cmd[1]; changedType = changedType.toLowerCase(); var mode = false; switch (changedType) { case '': notice = 'You need type \'show\' or \'flash\' word'; break; case 'show': if (isShowMode) { notice = 'You are already in Show mode'; } else { showTypeString = 'Show'; isShowMode = true; mode = true; } break; case 'flash': if (!isShowMode) { notice = 'You are already in Flash mode'; } else { showTypeString = 'Flash'; isShowMode = false; mode = true; } break; default: notice ='\'' + changedType + '\' is not a correct parameter. Type only show or flash'; break; } if (mode) { notice = 'Type of show changed to: ' + changedType; update_subject(); /* Repinta el panel del goal */ cb.drawPanel(); } } /* En el caso de haber tecleado un comando se notifica, pero solo al modelo y al super mod */ if (notice !== '') { if (isSuperMod(u)) { cb.sendNotice(notice, u, BG_COLOR_INFO_PVT, FONT_COLOR_INFO_PVT, 'bold'); } else { cb.sendNotice(notice, cb.room_slug, BG_COLOR_INFO_PVT, FONT_COLOR_INFO_PVT, 'bold'); } return msg; } } /* pueden usar esta consulta el modelo y los mods */ if (isMod || isModel || isSuperMod(u)) { /* Muestra el topico en la sala */ if (cmd[0]==COMMAND_SHOW_GOAL_SINGLE_TIP) { msg['X-Spam'] = true; showTopic(COMMAND_SHOW_GOAL_SINGLE_TIP); /* Muestra la cantidad de tokens que resta para el goal */ } else if (cmd[0]==COMMAND_SHOW_INFORMATION) { msg['X-Spam'] = true; showTopic(COMMAND_SHOW_INFORMATION); /* Muestra la cantidad de flashes que resta para el goal */ } else if (cmd[0]==COMMAND_SHOW_GOAL_REACHED) { msg['X-Spam'] = true; showTopic(COMMAND_SHOW_GOAL_REACHED); /* Muestra la cantidad de tokens que resta para el goal */ } else if (cmd[0]==COMMAND_SHOW_TOPIC) { msg['X-Spam'] = true; showTopic(COMMAND_SHOW_TOPIC); /* Muestra la informacion social del modelo */ } else if (cmd[0]==COMMAND_SHOW_NET_INFO) { msg['X-Spam'] = true; showTopic(COMMAND_SHOW_NET_INFO); /* Muestra el mensaje personalizado PM 2*/ } else if (cmd[0]==COMMAND_PERSONAL_MSG_2) { msg['X-Spam'] = true; showTopic(COMMAND_PERSONAL_MSG_2); /* Muestra el mensaje personalizado PM 1*/ } else if (cmd[0]==COMMAND_PERSONAL_MSG_1) { msg['X-Spam'] = true; showTopic(COMMAND_PERSONAL_MSG_1); /* Muestra el mensaje personalizado PM */ } else if (cmd[0]==COMMAND_PERSONAL_MSG) { msg['X-Spam'] = true; showTopic(COMMAND_PERSONAL_MSG); } } /* Set on the side of the tipper the tokens globally tipped by the user */ if (!isModel && omb.ohmibodMode) { /* Must have tipped*/ if (omb.total_tipped_by(u) > 0) { // tipperArray[findTipper(u)][1] > 0 msg['m'] = setTipTitles(u, msg['m']); } } return msg; }); /** Handle tips */ cb.onTip(function(tip) { /* De esta manera evitamos que otros modelos puedan utilizar la aplicacion */ /* Comprobacion de modelo autorizada con la variable global "STBC" (CMA) */ if (STBC) { return; } /* Se recupera la cantidad recien tipeada */ var amountTipped = parseInt(tip['amount']); var strAmountTipped = String(amountTipped); var tipper = []; var strTipper = ''; var camIsRunning = cb.limitCam_isRunning(); var minimum_tip = 0; var flashReseached = false; debug('amountTipped: '+amountTipped); tipper.push(tip['from_user']); strTipper = tip['from_user']; /* SIEMPRE se suman todos los tokens */ total_tokens_tipped += amountTipped; /* Si es un usuario al que no se le permite ver los flashes sus tips no hacen ningun efecto */ if (isInNotAllowedMembers(strTipper)) { return; } /* Exit */ /* ----------------------------------------------- PENALTY ------------------------------------------------------ */ /* Si es un usuario silenciado tiene que pagar la cantidad correcta de la sancion */ if (isInPenalty(strTipper)) { if (amountTipped < penaltyTip) { cb.sendNotice('The penalty fee are, at least, ' + penaltyTip + ' tokens.', strTipper, BG_COLOR_INFO_PUBLIC, FONT_COLOR_INFO_PUBLIC, 'bold'); return; } else if (amountTipped >= penaltyTip) { /* Como ha pagado la multa le dejamos que vuelva a hablar */ removePenalty(strTipper); cb.sendNotice('Now you can talk again in the chat room. Be polite or you will be penalized again.', strTipper, BG_COLOR_INFO_PUBLIC, FONT_COLOR_INFO_PUBLIC, 'bold'); return; } } /* ----------------------------------------------- OHMIBOD ------------------------------------------------------ */ /* Si esta en modo OhMiBod... RE: */ if (omb.ohmibodMode || cb.settings.show_Desc == 'OhMiBod') { /* Provisional porque creo que estoy repitiendo dos veces lo mismo */ omb.add_tip(strTipper, parseInt(tip['amount'])); //tipperArray[findTipper(strTipper)][1] += parseInt(tip['amount']); var _total_tipped_by_user = omb.current_show_tipped_by(strTipper); //tipperArray[findTipper(strTipper)][1]; debug('_total_tipped_by_user:' + _total_tipped_by_user + '.'); debug('tokens_to_see_all_flashes_omb:' + tokens_to_see_all_flashes_omb + '.'); debug('tokens_to_see_show_omb:' + tokens_to_see_show_omb + '.'); // TODO BUG_SECOND_SHOW modify the following to use the userFlashCounter object /* RE: E' il minimo tip flash per il numero di volte indicato */ /* RE: vecchio commento Es el minimo tip flash por el numero de veces que se indique (minimum_tip_flash * times_to_free_flashes) */ /* tokens_to_see_all_flashes_omb = minimum_tip_flash * times_to_free_flashes */ // TODO BUG_SECOND_SHOW test this if (_total_tipped_by_user >= tokens_to_see_all_flashes_omb) { debug("User "+strTipper+" can see ALL FLASHES now"); addAllowedMember(strTipper); } /* RE: tokens_to_see_show_omb = (minimum_tip_flash * times_to_free_show); */ debug("User "+strTipper+" has tipped "+_total_tipped_by_user); debug("times_goal_reached="+times_goal_reached); debug("tokens_to_see_show_omb="+tokens_to_see_show_omb); if (_total_tipped_by_user >= tokens_to_see_show_omb) { /* Se comprueba que no este ya en el array de usuarios que pueden ver el show */ debug("User "+strTipper+" can see SHOW now"); addUserForShow(strTipper); // if (!isUsersWhoTippedForShow(strTipper)) { // usersWhoTippedForShow.push(strTipper); // } } } /* ----------------------------------------------- EXTENSION DE TIEMPO --------------------------------------------------------- */ /* Compran extension de tiempo */ // TODO: this dont work, this thinks that a non flash user is in the flash so extend but dont see (ofc) // TODO: even with 1 tip they see the show they end up in the list the same if (camIsRunning && amountTipped === extendTimePay) { /* Comprobamos si el usuario ya esta en el array de tippers que han pagado para el show, para el flash o el usuario es un miemnbro POC */ if (isUsersWhoTippedForShow(strTipper) || isUserWhoTippedForFlash(strTipper) || isInAllowedMembers(strTipper)) { /* Actualiza el nuevo tiempo de duracion del Flash */ hiddenCamTime = parseInt(hiddenCamTime) + parseInt(extendTimeBuyed); var notice = strTipper + ' has extended the ' + showTypeString + ' time in ' + extendTimeBuyed + ' minutes.' + NL; notice += 'Total ' + showTypeString + ' time now: ' + hiddenCamTime + ' minutes.'; cb.sendNotice(notice, '', BG_COLOR_INFO_PUBLIC, FONT_COLOR_INFO_PUBLIC, 'bold'); return; /* Probemos con esta salida por ahora */ } } /* ----------------------------------------------- MAIN --------------------------------------------------------- */ debug("isShowMode: "+isShowMode); if (isShowMode) { minimum_tip = minimum_tip_show; } else { minimum_tip = minimum_tip_flash; } debug("minimum_tip: "+minimum_tip); /* Si el tip es uno de los tips configurados como estandar o un "no goal" no sirve para el flash. Se sale de la funcion */ if (isStandardTip(strAmountTipped) || isGiftTip(tip['message'])) { return; } /* Si la funcionalidad Hidden Cam no esta funcionando no hacemos nada */ if (!hidden_cam) { return; } /* Yellow Wall Protection */ if (amountTipped > yellowWallLevel && amountTipped < minimum_tip) { showTopic(COMMAND_SHOW_TOPIC); } /* Primero se comprueba que la cantidad tipeada sea mayor o igual al minimo requerido y se activa el flag flashReseached */ if (amountTipped >= minimum_tip) { flashReseached = true; } /* ----------------------------------------------- CONTADOR DE FLASHES ------------------------------------------ */ /* El contador de Flashes se incrementa antes de entrar en la siguiente comparacion (SI NO SE ESTa YA EN EL SHOW!) */ if (flashReseached) { /* Por si estuviera en marcha el anuncio de que se va, se pone a 0 el tiempo para pararlo */ if (toGoTime > 0) { toGoTime = 0; actual_time_go = 0; actual_time1_go = 0; time_init_msg_go = 0; } /** N. tickets bought with this tip (i.e. a tip of 198 means 2 tickets) */ var nTickets = Math.floor(amountTipped / minimum_tip); if (nTickets > 1) { //cb.sendNotice('(nTickets > 1)', '', BG_COLOR_SOLD_TICKET, FONT_COLOR_SOLD_TICKET, 'bold'); if (nTickets >= flashes_to_goal) { /* 1 - Si el numero de tickets comprados supera o es igual a los que faltan para el goal... */ if (!camIsRunning) { /* ...y no esta en hiddem cam...*/ flashes_counter = setting_number_flashes_to_goal; /* ...el contador de tickets que quedan por vender se iguala al maximo numero de tickets que habia para vernder */ } else { /* Si esta en hidden cam no se puede igualar al maximo numero de tickets que habia para vender... */ flashes_counter = setting_number_flashes_to_goal - 1; /* ...asi que se deja un ticket por debajo */ } } else { /* 2 - Si el numero de tickets comprados no supera a los que faltan para el goal... */ flashes_counter += nTickets; /* ...se suma el numero de tickets comprados. Da igual si esta en hiddem cam o no */ } } else if (nTickets === 1) { /* Si solo se compra un ticket... */ //cb.sendNotice('(nTickets === 1)', '', BG_COLOR_SOLD_TICKET, FONT_COLOR_SOLD_TICKET, 'bold'); if (!camIsRunning) { /* ... y la hidden cam no esta activa... */ flashes_counter += 1; /* ...se suma uno a los tickets vendidos */ } else { /* Si la hidden cam esta activa... */ if ((flashes_counter + 1) === setting_number_flashes_to_goal) { flashes_counter = setting_number_flashes_to_goal - 1; /* ...y siguen comprando tickets se deja el contador a falta de uno mientras este la hidden cam activa */ } else { flashes_counter += 1; /* o se suma uno a los tickets vendidos */ } } } /* COMPROBACIoN DEL GOAL */ /* Comprobar si se ha llegado al goal, es decir, al show */ if (flashes_counter < setting_number_flashes_to_goal) { goalShow = false; /* Actualizar contadores del panel */ flashes_to_goal = (setting_number_flashes_to_goal - flashes_counter); } else if (flashes_counter >= setting_number_flashes_to_goal) { goalShow = true; /* Se resetea el contador de Flashes */ flashes_counter = 0; /* Actualizar contadores y variables del panel */ flashes_to_goal = setting_number_flashes_to_goal; } /* RE: FIXME check if this works as expected, as strTipper is inserted in the arrays BEFORE here */ if (!isInAllowedMembers(strTipper) && !isUsersWhoTippedForShow(strTipper)) { /* Se anuncia en la sala quien a comprado un ticket para el Show */ cb.sendNotice('Ticket sold to '+ strTipper, '', BG_COLOR_SOLD_TICKET, FONT_COLOR_SOLD_TICKET, 'bold'); } } /* ----------------------------------------------- ACTIVACIoN DE LA HIDDEN CAM ---------------------------------- */ /* hidden_cam = true */ /* Si la cantidad tipeada es mayor o igual a la cantidad requerida para arrancar el flash (flashReseached) y no se han alcanzado el total de flashes para llegar al goal If the typed amount is greater than or equal to the amount required to start the flash and they have not reached the total of flashes to reach the goal */ if (automaticShow) { /* Si esta en modo automatico empezara el show al terminar de comprar el ultimo ticket */ if (flashReseached && !goalShow) { /* ...Y la hidden cam no esta corriendo en ese momento, se arranca el flash*/ if (!camIsRunning) { /* Se agrega el tipper que acaba de tipear para arrancar el flash */ // if (!isInAllowedMembers(strTipper)) { addUserForFlash(strTipper); //usersWhoTippedForFlash.push(strTipper); // /* Se anade al tipper a todos los flashes despues de que haya pagado una cantidad correspondiente al valor de 3 flashes o mas */ // debug("Increase the tip counter"); // userFlashCounter.make(strTipper, amountTipped); // } /* Se agrega el tipper al array de los que podran ver el Show al llegar al goal */ if (!isUserWhoTippedForFlash(strTipper) && !isInAllowedMembers(strTipper)) { debug("User is not in Flash list and not an allowed member"); var notice = 'You are currently in Hidden Cam Flash!'; if (!pTime) { notice += ' And you can choose the Flash!'; } // RE: notice += '\n This also give you a Ticket for ' + showStringLong + ' when all my Tickets are sold out. \n'; // RE: notice += 'You can keep helping tipping for Flashes for reach Goal faster and enjoy the Show! '; notice += '\n Thanks for your support.'; notice += '\n Type ' + COMMAND_SHOW_EXTRA_INFO + ' for more information.'; cb.sendNotice(notice, strTipper, BG_COLOR_INFO_TIPPER, FONT_COLOR_INFO_TIPPER, 'bold'); debug("NOTE: we are NOT in goalShow, so it is a FLASH and we add him to usersWhoTippedForFlash"); addUserForFlash(strTipper); //usersWhoTippedForFlash.push(strTipper); } /* Y se arranca la camara oculta */ if (flagCam === false) { flagCam = true; executeCallbackFlag = true; /* Es un semaforo que tiene en cuenta la parada de emergencia */ /* Se pasa el tiempo del flash al tiempo de la camara */ hiddenCamTime = flashTime; // Starts the cam camFunction(); // Sets the timeout for the end of the show cb.setTimeout(camFunction, hiddenCamTime * 60000); /* Mensaje que informa cada x tiempo */ showTimeAdvice(); /* Tells the model who started the flash */ cb.sendNotice('Tipper ['+ strTipper + ' | ' + amountTipped + '] started the Flash', cb.room_slug, BG_COLOR_INFO_PVT, FONT_COLOR_INFO_PVT, 'bold'); } } else { /* y si esta corriendo en ese momento se incorpora al flash*/ /* Se agrega el tipper que acaba de tipear y se comprueba si esta en los permitidos para ver todo los flashes y Show */ // if (!isInAllowedMembers(strTipper)) { // /* Se anade al tipper a todos los flashes despues de que haya pagado una cantidad correspondiente al valor de 3 flashes o mas */ // userFlashCounter.make(strTipper, amountTipped); // } /* Se agrega el tipper que acaba de tipear al array de tippers acumulados de los pasados flashes para que puedan ver el show cuando arranque */ // RE: if (!isUsersWhoTippedForShow(strTipper) && !isInAllowedMembers(strTipper)) { if (!isInAllowedMembers(strTipper)) { debug("Cam is running and user is not in allowed members"); var notice = 'You are currently in Hidden Cam Flash!\n'; // RE: if (!cb.limitCam_isRunning()) { // RE: notice += 'This also give you a Ticket for ' + showStringLong + ' when all my Tickets are sold out. \n' // RE: notice += 'You can keep helping tipping for Flashes for reach Goal faster and enjoy the Show! \n' // RE: } notice += 'Thanks for your support. \n'; notice += 'Type ' + COMMAND_SHOW_EXTRA_INFO + ' for more information.'; cb.sendNotice(notice, strTipper, BG_COLOR_INFO_TIPPER, FONT_COLOR_INFO_TIPPER, 'bold'); // RE: cb.sendNotice('TODO', '', BG_COLOR_INFO_PUBLIC, FONT_COLOR_INFO_PUBLIC, 'bold'); // RE: usersWhoTippedForShow.push(strTipper); debug("NOTE: we are NOT in goalShow, so it is a FLASH and we add him to usersWhoTippedForFlash"); debug("FIXME: is this correct?") //addUserForFlash(strTipper); //usersWhoTippedForFlash.push(strTipper); } /* Se incorporan los usuarios a la hidden cam en el momento */ debug("Adding "+tipper[0]+" to Hidden Cam"); cb.limitCam_addUsers(tipper); } } else if (flashReseached && goalShow) { /* Se ha llegado al goal */ if (!camIsRunning) { /* Se agrega el tipper que acaba de tipear al array de tippers acumulados en los pasados flashes */ debug("TODO: test this"); if (!isInAllowedMembers(strTipper)) { addUserForShow(strTipper); } // if (!isUsersWhoTippedForShow(strTipper) && !isInAllowedMembers(strTipper)) { // usersWhoTippedForShow.push(strTipper); // } /* Se cambia el modo a "SHOW" */ isShowMode = true; showTypeString = 'Show'; /* Y se arranca la camara oculta*/ if (flagCam === false) { flagCam = true; executeCallbackFlag = true; /* Es un semaforo que tiene en cuenta la parada de emergencia */ /* Se pasa el tiempo del show al tiempo de la camara */ hiddenCamTime = showTime; camFunction(); cb.setTimeout(camFunction, hiddenCamTime * 60000); /* Mensaje que informa cada x tiempo */ showTimeAdvice(); /* Listar todos los tippers que han pagado para el Show por si la aplicacion se cayera */ var noticeList = listAllowedShowCam(); cb.sendNotice(noticeList, cb.room_slug, BG_COLOR_INFO_PVT, FONT_COLOR_INFO_PVT, 'bold'); /* Informar del ultimo tipper y la cantidad de tokens que ha dado para arrancar el Show */ cb.sendNotice('Tipper ['+ strTipper + ' | ' + amountTipped + '] started the Show', cb.room_slug, BG_COLOR_INFO_PVT, FONT_COLOR_INFO_PVT, 'bold'); } } else { if (!isUsersWhoTippedForShow(strTipper)) { /* Se agrega el tipper que acaba de tipear al array de tippers acumulados en los pasados flashes */ debug("The user is added to the running show: "+strTipper); /* Se incorpora el usuario justo en el momento porque ya esta en marcha la hidden cam y es el show, por eso no se mete en el array de "isUsersWhoTippedForShow" */ cb.limitCam_addUsers(tipper); var notice = 'You are currently in Hidden Cam Show!\n'; notice += 'Tip if you enjoy the Show. \n'; notice += 'Thanks for your support.'; cb.sendNotice(notice, strTipper, BG_COLOR_INFO_TIPPER, FONT_COLOR_INFO_TIPPER, 'bold'); } } } } else { /* Si esta en modo manual solo se venden los tickets y se arrancara de manera manual (/start 99 o /timetostart 99)*/ /* Se agrega el tipper que acaba de tipear al array de tippers para que puedan ver el show cuando arranque */ // RE: if (!isUsersWhoTippedForShow(strTipper) && !isInAllowedMembers(strTipper) && (amountTipped >= minimum_tip) && (amountTipped !== spyHiddenCamTip)) { // RE: var notice = 'You bougth a Ticket for this Special Show. \n'; // RE: notice += 'Wait until it starts and enjoy it. \n' // RE: notice += 'Thanks for your support.' // RE: cb.sendNotice(notice, strTipper, BG_COLOR_INFO_TIPPER, FONT_COLOR_INFO_TIPPER, 'bold'); // RE: cb.sendNotice('TODO', '', BG_COLOR_INFO_PUBLIC, FONT_COLOR_INFO_PUBLIC, 'bold'); // RE: usersWhoTippedForShow.push(strTipper); // RE: } } /* Si se tipea la cantidad necesaria para espiar durante un flash... */ if ((spyHiddenCamTime > 0) && (amountTipped === spyHiddenCamTip) && camIsRunning && isShowMode) { var posUser = addUserToSpyHiddenCam(strTipper); flagSpyCam[posUser] = true; //cb.sendNotice('Entra a Espiar: ' + strTipper, '', BG_COLOR_INFO_TIPPER, FONT_COLOR_INFO_TIPPER, 'bold'); /* Let him spy */ spyCamFunction(posUser); /* Set the spy timeout */ cb.setTimeout(spyCamFunction, spyHiddenCamTime * 60000); } /* Repinta el panel del goal */ cb.drawPanel(); }); /** 3 rows panel */ cb.onDrawPanel(function(user) { /* Si esta en modo Show, la hidden cam activa y el show no empieza automaticamente */ if (isShowMode && hidden_cam && !automaticShow) { return { 'template': '3_rows_of_labels', 'row1_label': 'Total Received:', 'row1_value': '' + total_tokens_tipped, 'row2_label': 'Tickets sold:', 'row2_value': '' + (flashes_counter + allowedMembers.length), 'row3_label': 'Ticket price:', 'row3_value': '' + minimum_tip_show + ' tokens' }; } /* Si no esta activa la hidden cam */ if (!hidden_cam) { return { 'template': '3_rows_12_21_31', 'row1_label': 'Total Received:', 'row1_value': '' + total_tokens_tipped, 'row2_value': '--------------------------', 'row3_value': 'No show' }; } /* Si esta con el periodo y entro en el show */ if (isShowMode && pTime) { return { 'template': '3_rows_12_22_31', 'row1_label': 'Total Received:', 'row1_value': '' + total_tokens_tipped, 'row2_label': 'Ticket price:', 'row2_value': '' + minimum_tip_show + ' tokens', 'row3_value': 'Creamy boobs Show is On!' }; } /* Si no esta en modo Show aun y la hidden cam esta activada */ if (!isShowMode && hidden_cam) { return { 'template': '3_rows_of_labels', 'row1_label': 'Total Received:', 'row1_value': '' + total_tokens_tipped, 'row2_label': 'Show Start at:', 'row2_value': '' + flashes_to_goal + ' Tickets left', 'row3_label': 'Tickets sold:', 'row3_value': '' + flashes_counter }; } /* Si esta en modo Show y la hidden cam esta activada */ if (isShowMode && hidden_cam) { return { 'template': '3_rows_12_22_31', 'row1_label': 'Total Received:', 'row1_value': '' + total_tokens_tipped, 'row2_label': 'Ticket price:', 'row2_value': '' + minimum_tip_show + ' tokens', 'row3_value': '' + showStringLong + ' is On' }; } }); /* -------------------------------------------------------------------------------------------------------------- */ /** RE: Used only with the command /timetostart */ function toStartShowTimeAdvice() { /* Coger la hora a la que inicia la cuenta atras */ var d = new Date(); var t = d.getTime(); var secondsUntilNow = 0; var secondsLeft = 0; /* Si la hora de inicio del flash esta a 0 se iguala a la hora actual, asimismo la hora actual se coge como referencia para actual_time1 */ if (time_init_msg === 0) { time_init_msg = t; actual_time1 = t; } else { /* La hora de inicio del flash contiene una hora valida, por lo que se cambia solo la hora actual y se calcula la diferencia de horas */ actual_time1 = t; /* Si la hora actual supero el limite establecido en la configuracion se comunica en la sala */ if ((Math.floor((actual_time1 - time_init_msg) / 60000)) >= toStartTime) { /* Arranca el show */ if (flagCam === false) { /* Se pasan los miembros permitidos al array de usuarios que han tipeado*/ copyAllowedMembers(); flagCam = true; executeCallbackFlag = true; /* Es un semaforo que tiene en cuenta la parada de emergencia */ /* Se pasa el tiempo del Show al tiempo de la camara */ hiddenCamTime = showTime; /* se pasa el flag automaticShow a true;*/ automaticShow = true; /*Simulamos que hemos llegado al goal */ goalShow = true; camFunction(); cb.setTimeout(camFunction, hiddenCamTime * 60000); /* Mensaje que informa cada x del tiempo que resta */ showTimeAdvice(); } return; } else { secondsUntilNow = ((actual_time1 - time_init_msg) / 1000); secondsLeft = (toStartTime * 60) - secondsUntilNow; if (isShowMode) { minimum_tip = minimum_tip_show; } else { minimum_tip = minimum_tip_flash; } cb.sendNotice('** Less than ' + convertTime(secondsLeft) + ' remaining to buy a ticket by ' + minimum_tip + ' tokens before the Show starts!', '', '', '#FF0505', 'bold'); } } /* Segun se acerca al final muestra el aviso cada menos tiempo */ if (((actual_time1 - time_init_msg) / 60000) <= (toStartTime - 6)) { cb.setTimeout(toStartShowTimeAdvice, (3 * 60000)); /* Cada 3 minutos */ } else { cb.setTimeout(toStartShowTimeAdvice, (1 * 60000)); /* Cada minuto cuando quedan 6 para empezar el show */ } } /** /appstatus App Status info */ function appStatus() { var ret = ''; ret = '***** APP STATUS INFO: ***** \n'; if (hidden_cam) { ret += 'Model user name: '+ U_M_N +' \n' ret += 'Model real name: '+ R_M_N +' \n' ret += 'Hidden Cam feauture is ON! \n' ret += 'Show mode: ' + showTypeString + ' \n' if (isShowMode) { ret += 'Type Show: ' + showStringLong + ' \n' } else { ret += 'Type Show: ' + showStringLong + ' (at ' + setting_number_flashes_to_goal + ' Goals \n' } ret += 'Flash time is set to: ' + flashTime + ' minutes \n'; ret += 'Flash amount tip is set to: ' + minimum_tip_flash + ' tokens \n'; ret += 'Show time is set to: ' + showTime + ' minutes \n'; ret += 'Show amount tip is set to: ' + minimum_tip_show + ' tokens \n'; if (spyHiddenCamTime > 0) { ret += 'Spy time is set to: ' + spyHiddenCamTime + ' minute/s \n'; ret += 'Spy tip is set to: ' + spyHiddenCamTip + ' tokens (Exact amount) \n'; } ret += 'Penalty amount set to: ' + penaltyTip + ' tokens \n'; ret += 'Tipper can see all flashes after: ' + times_to_free_flashes + ' times tipped or ' + (minimum_tip_flash*times_to_free_flashes) + ' tokens \n'; } else { ret += 'Hidden Cam feauture is OFF \n'; } if (automaticShow) { ret += 'Automatically starts the Show after flashes: Yes \n'; } else { ret += 'Automatically starts the Show after flashes: No \n'; } if (cb.limitCam_isRunning()) { ret += 'Hidden Cam feauture IS running! - You are NOW in a flash time! \n'; } else { ret += 'Hidden Cam feauture is NOT running - You are NOT in a flash time \n'; } if (pTime) { ret += 'Period Time is ON!'; } else { ret += 'Period Time is OFF!'; } return ret; } function isSuperMod(username) { return cbjs.arrayContains(superModList,username); } function refresh() { cb.setTimeout(refresh, 20000); cb.drawPanel(); } function showTopic(command) { var backgroundColor = BG_COLOR_INFO_PUBLIC; var fontColor = FONT_COLOR_INFO_PUBLIC; var notice = ''; /* para ver el Topic = 'COMMAND_SHOW_TOPIC' - Research goal = 'COMMAND_SHOW_GOAL_REACHED' - Instagram and Twitter = 'COMMAND_SHOW_NET_INFO' */ if (command === COMMAND_SHOW_TOPIC) { backgroundColor = ''; fontColor = FONT_COLOR_INFO_TOPIC; notice = roomTopic; } else if (command === COMMAND_SHOW_GOAL_REACHED) { if (!isShowMode) { notice = 'Flashes / Tickets to reach ' + showStringLong + ' goal: ' + flashes_to_goal; } else { notice = ''; } } else if (command === COMMAND_SHOW_GOAL_SINGLE_TIP) { if (!isShowMode) { if (cb.limitCam_isRunning()) { notice = 'Tokens to reach '+ showStringLong + ' goal: ' + (flashes_to_goal*minimum_tip_flash) + ' tokens in single tip (Tipping out of the Hidden Cam Flash!)'; } else { notice = 'Tokens to reach '+ showStringLong + ' goal: ' + (flashes_to_goal*minimum_tip_flash) + ' tokens in single tip'; } } else { notice = ''; } /* Muestra mensaje personalizado */ } else if (command === COMMAND_PERSONAL_MSG) { notice = cb.settings.PMessage1; /* Muestra mensaje personalizado 1 */ } else if (command === COMMAND_PERSONAL_MSG_1) { notice = cb.settings.PMessage2; /* Muestra mensaje personalizado 2 */ } else if (command === COMMAND_PERSONAL_MSG_2) { notice = cb.settings.PMessage3; /* Informacion acerca de como tiene que hacer para entrar a ver el show */ } else if (command === COMMAND_SHOW_INFORMATION) { if (isShowMode) { minimum_tip = minimum_tip_show; } var minimum_tip = minimum_tip_flash; if (cb.limitCam_isRunning()) { notice = 'Tip ' + minimum_tip + ' or more to enter now to see the ' + showTypeString + ' \n'; if (!isShowMode) { notice += 'and get your Ticket for the ' + showStringLong + ' when all my Tickets are sold out! \n'; } notice += 'If you tip for ' + times_to_free_flashes + ' flashes or equivalent amount (' + (times_to_free_flashes*minimum_tip_flash) + ' tokens) you will watch all flashes of this session for free! \n'; notice += 'You can see a timer every few minutes indicating the time left to finish the ' + showTypeString + '. \n'; } else { notice += 'I do Flashes under Hidden Cam, you can pick your Flash for ' + minimum_tip_flash + ' tokens single tip or more! \n'; if (!isShowMode) { notice += 'When you pay for a Flash you receive a Ticket for the ' + showStringLong + ' when all my Tickets are sold out. \n'; } notice += 'If you tip for ' + times_to_free_flashes + ' flashes or equivalent amount (' + (times_to_free_flashes*minimum_tip_flash) + ' tokens) you will watch all flashes of this session for free! \n' } notice += '************ IMPORTANT INFORMATION ************ \n'; notice += 'If you are using a tablet or phone the hidden cam feature for \n'; notice += 'see the ' + showTypeString + ' WILL NOT WORK unless your browser is Flash compatible. \n'; notice += 'Either install the free Photon browser app on your device, \n'; notice += 'or purchase the Puffin browser app. (Apps avalaible for Android and iOS devices)'; } else if (command === COMMAND_SHOW_NET_INFO) { notice += 'You can follow to ' + R_M_N + ' on \n'; notice += 'HERE: :followme'; backgroundColor = BG_COLOR_INFO_PUBLIC_1; fontColor = FONT_COLOR_INFO_PUBLIC_1; } if (notice !== '') { cb.sendNotice(notice, '', backgroundColor, fontColor, 'bold'); } } function showCredits() { var credits = ''; credits = '******** HC Power App \n'; credits += '******** Developed for ' + U_M_N ;//+ ' \n'; // credits += '******** by nothingelsexx \n'; // credits += '******** (C) 2014-2016 nothingelsexx \n'; // credits += '******** by PervCreations'; cb.sendNotice(credits, '', BG_COLOR_INFO_PUBLIC, FONT_COLOR_INFO_PUBLIC, 'bold'); /* Duracion del flash/show */ flashTime = cb.settings.flash_time; showTime = cb.settings.show_time; originalFlashTime = flashTime; /* Variables de extension de tiempo */ extendTimePay = cb.settings.extendTimePay; extendTimeBuyed = cb.settings.extendTimeMinutes; /* Tipo de show (flash/show) */ if (cb.settings.show_Type === 'Show') { showTypeString = 'Show'; isShowMode = true; } if (cb.settings.show_Type === 'Flash') { showTypeString = 'Flash'; isShowMode = false; } /* Esta con el periodo? */ if (cb.settings.pTime === 'Yes') { pTime = true; } else { pTime = false; } /* Yellow Wall Protection*/ yellowWallLevel = cb.settings.YellowWall; /* Si en las opciones se configura que se pueda arrancar con la opcion hidden cam se configura aqui y se le informa al modelo, por defecto esta variable esta inicializada en false */ if (cb.settings.hidden === 'Yes') { hidden_cam = true; } /* Se informa al modelo de como esta configurada la app al arrancar */ appStatus(); } /** Change room subject */ function update_subject() { var tip_price = 0; if (isShowMode) { tip_price = minimum_tip_show; } else { tip_price = minimum_tip_flash; } if (!hidden_cam) { roomTopic = current_goal_description; cb.changeRoomSubject(roomTopic); return; } /* Se selecciona el tipo de Show que se va a hacer al goal */ switch (cb.settings.show_Desc) { case 'Naked': showStringLong = 'Strip and Dance Naked Show'; break; case 'Shower': showStringLong = 'Shower Show'; break; case 'Oil': showStringLong = 'Hot Oil Show'; break; case 'Wet Shirt': showStringLong = 'Wet Shirt Show'; break; case 'Body Lotion': showStringLong = 'Body Lotion Show'; break; case 'OhMiBod': showStringLong = '#ohmibod Naked OhMiBod Show'; omb.ohmibodMode = true; /* Se activa el modo OhMibod */ break; case 'Special Show': showStringLong = 'Today Special Show'; break; } if (pTime) { showStringLong = 'Creamy Boobs Show'; } if (isShowMode) { roomTopic = showStringLong + ' Single tip ' + tip_price + ' or more to buy your Ticket and join / ' + current_goal_description; } else { if (pTime) { roomTopic = 'Tip single ' + tip_price + ' or more to get INSTANT Boobs Flash under Hidden Cam, extra get Ticket for today\'s ' + showStringLong + ' / ' + current_goal_description; } else { if (omb.ohmibodMode) { roomTopic = 'Tip single ' + tip_price + ' or more to get INSTANT Flash under Hidden Cam\'s ' + showStringLong + '. Whoever tips first, picks the Flash. For more information type ' + COMMAND_SHOW_EXTRA_INFO + ' / ' + current_goal_description } else { /* RE: old message */ roomTopic = 'Tip single ' + tip_price + ' or more to get INSTANT Flash under Hidden Cam, extra get Ticket for today\'s ' + showStringLong + '. Whoever tips first, picks the Flash. For more information type ' + COMMAND_SHOW_EXTRA_INFO + ' / ' + current_goal_description; } } } cb.changeRoomSubject(roomTopic); } function sendStartNotification() { var notice = ''; var tip_minimum = 0; notice = 'The ' + showTypeString + ' under Hidden Cam begins now!! \n'; if (isShowMode) { tip_minimum = minimum_tip_show; } else { tip_minimum = minimum_tip_flash; } notice += 'If you want to see it, don\'t worry, tip now ' + tip_minimum + ' tokens or more and you can join'; if (!goalShow) { notice += '\n and get your Ticket for the ' + showStringLong + ' when all my Tickets are sold out! \n'; notice += 'If you tip for ' + times_to_free_flashes + ' flashes or equivalent amount (' + (times_to_free_flashes*minimum_tip_flash) + ' tokens) you will watch all flashes of this session for free!'; } cb.sendNotice(notice, '', BG_COLOR_INFO_PUBLIC, FONT_COLOR_INFO_PUBLIC, 'bold'); } /** notice to super mods */ function sendNoticeToSM(noticeSM, user) { noticeSM += ': [' + user + ']'; for (var i = 0; i < superModList.length; i++) { cb.sendNotice(noticeSM, superModList[i], BG_COLOR_INFO_PVT, FONT_COLOR_INFO_PVT, 'bold'); } } /** Tells the SuperMod whether the HiddemCam is started or stopped */ function sendHCStatusToSM(HCStarter) { var notice = ''; if (HCStarter) { notice = ':cap01_1 ... Hidden Cam starter'; } else { notice = ':cap04_1 ... Hidden Cam stopped'; } for (var i = 0; i < superModList.length; i++) { cb.sendNotice(notice, superModList[i], BG_COLOR_INFO_PVT, FONT_COLOR_INFO_PVT, 'bold'); } } function grabSettings() { /* Get Standard Tips*/ if (cb.settings.stdTipList) { var stdTipSettings = cb.settings.stdTipList.split(','); for (var ii = 0; ii < stdTipSettings.length; ii++) { var clean = stdTipSettings[ii].toLowerCase().replace(/ /g,''); tipList[clean] = {'u': 1}; } } /* Load the members that are NEVER allowed to see the hidden cam: this MUST be BEFORE the load of allowed members */ if (cb.settings.notAllowedMembersList) { var notAllowedMemberSettings = cb.settings.notAllowedMembersList.split(','); for (var i = 0; i < notAllowedMemberSettings.length; i++) { notAllowedMembers.push(notAllowedMemberSettings[i].toLowerCase().replace(/ /g,'')); } } /* Carga a los miembros que se le permite ver los flashes siempre */ if (cb.settings.allowedMembersList) { var allowedMemberSettings = cb.settings.allowedMembersList.split(','); for (var i = 0; i < allowedMemberSettings.length; i++) { addAllowedMember(allowedMemberSettings[i].toLowerCase().replace(/ /g,'')); //allowedMembers.push(allowedMemberSettings[i].toLowerCase().replace(/ /g,'')); } } /* Get super mod list */ if (cb.settings.superModList) { var smSettings = cb.settings.superModList.split(','); for (var ii = 0; ii < smSettings.length; ii++) { superModList.push(smSettings[ii].toLowerCase().replace(/ /g,'')); } } /* Hay que igualar esta variable antes de poner el topico */ current_goal_description = cb.settings.goal_description; minimum_tip_flash = cb.settings.minimum_flash; minimum_tip_show = cb.settings.minimum_show; setting_number_flashes_to_goal = cb.settings.goals; flashes_to_goal = cb.settings.goals; penaltyTip = cb.settings.pFee; spyHiddenCamTime = cb.settings.spy_time; spyHiddenCamTip = cb.settings.spy_tip; notice_time = cb.settings.notice_time; times_to_free_flashes = cb.settings.all_flashes; /* RE: new parameters - start. */ times_to_free_show = cb.settings.in_show; tokens_to_see_all_flashes_omb = (minimum_tip_flash * times_to_free_flashes); tokens_to_see_show_omb = (minimum_tip_flash * times_to_free_show); /* RE: new parameters - end. */ /* RE: old OMB parameter, now disabled - start.*/ // tokens_omb = (minimum_tip_flash * times_to_free_flashes); /* RE: old OMB parameter, now disabled - end.*/ if (cb.settings.auto_show === 'No') { automaticShow = false; } } grabSettings(); cb.onEnter(function(user) { /* Variables para facilitar el uso */ var actualUser = user['user']; var fanClubUser = user['in_fanclub']; /* Es del club de fans? */ var modUser = user['is_mod']; /* Es moderador? */ var blueUser = user['has_tokens']; /* Tiene tokens? (light blue) */ var isModel = (actualUser === cb.room_slug); var isGrey = !(fanClubUser || modUser || blueUser || isModel); /* Si es gris, modelo, miembro del club, moderador, miembro del club de fans no mostrarle ningun mensaje */ if (isGrey || isModel || isInAllowedMembers(actualUser) || modUser || fanClubUser) { return; } /* Si es un usuario que ha tipeado una vez para ver un flash, esta incluido en el array para ver el show */ if (isUsersWhoTippedForShow(actualUser)) { var notice = ''; if (isShowMode) { notice = 'Hi again ' + actualUser + '! \n'; notice += 'You bought a Ticket before for this ' + showStringLong + '! \n'; notice += 'Enjoy it and Tip if you like.'; } else { notice = 'Remember, you have a Ticket for the ' + showStringLong + ' when all my Tickets are sold out! \n'; if (!isInAllowedMembers(actualUser)) { notice += 'If you tip for ' + times_to_free_flashes + ' flashes or equivalent amount (' + (times_to_free_flashes*minimum_tip_flash) + ' tokens) you will watch all flashes of this session for free! \n'; } notice += 'You can keep helping tipping for Flashes for reach Goal faster and enjoy the Show!'; } cb.sendNotice(notice, actualUser, BG_COLOR_INFO_TIPPER, FONT_COLOR_INFO_TIPPER, 'bold'); return; } /* Si es un azul, se supone que tiene tokens y hay que informarle de las posibilidades que tiene al entrar a un flash */ if (blueUser) { var notice = 'Welcome to my room ' + actualUser + ' \n'; if (isShowMode) { notice += 'You can join to this ' + showStringLong + ' for only ' + minimum_tip_show + ' tokens single tip or more!\n'; notice += 'Don\'t miss the Show!'; } else { if (cb.limitCam_isRunning()) { if (omb.ohmibodMode) { /* RE: New message */ notice += 'You can join to this Flash for only ' + minimum_tip_flash + ' tokens single tip or more,\n'; notice += 'If you tip for ' + times_to_free_flashes + ' flashes or equivalent amount (' + (times_to_free_flashes * minimum_tip_flash) + ' tokens) you will watch all flashes of this session for free! \n'; notice += 'If you tip for ' + times_to_free_show + ' flashes or equivalent amount (' + (times_to_free_show * minimum_tip_flash) + ' tokens) you will watch all flashes and get ticket for final Show. \n' } else { /* RE: Old message */ notice += 'You can join to this Flash for only ' + minimum_tip_flash + ' tokens single tip or more,\n'; notice += 'also you get a Ticket for the ' + showStringLong + ' when my Goal is reached.\n'; notice += 'If you tip for ' + times_to_free_flashes + ' flashes or equivalent amount (' + (times_to_free_flashes*minimum_tip_flash) + ' tokens) you will watch all flashes of this session for free! \n' } notice += '\n You can see a timer every few seconds indicating the time left to finish the Flash. \n'; } else { if (omb.ohmibodMode) { /* RE: new message */ notice += 'I do Flashes under Hidden Cam, you can pick your Flash for ' + minimum_tip_flash + ' tokens single tip or more! \n'; notice += 'If you tip for ' + times_to_free_flashes + ' flashes or equivalent amount (' + (times_to_free_flashes * minimum_tip_flash) + ' tokens) you will watch all flashes of this session for free! \n'; notice += 'If you tip for ' + times_to_free_show + ' flashes or equivalent amount (' + (times_to_free_show * minimum_tip_flash) + ' tokens) you will watch all flashes and get ticket for final Show. \n' } else { /* RE: Old message */ notice += 'I do Flashes under Hidden Cam, you can pick your Flash for ' + minimum_tip_flash + ' tokens single tip or more! \n'; notice += 'When you pay for a Flash you receive a Ticket for the ' + showStringLong + ' when all my Tickets are sold out. \n'; notice += 'If you tip for ' + times_to_free_flashes + ' flashes or equivalent amount (' + (times_to_free_flashes*minimum_tip_flash) + ' tokens) you will watch all flashes of this session for free! \n' } } } notice += '\n Type ' + COMMAND_SHOW_EXTRA_INFO + ' for more information.'; cb.sendNotice(notice, actualUser, BG_COLOR_INFO_TIPPER, FONT_COLOR_INFO_TIPPER, 'bold'); return; } }); function CMA(Coloured_exec) { var userMessage = ''; var position = 0; var findIt = false; var tmp_realModelName = ''; var execCoulored = ''; /* Clave para el uso de la aplicacion: 0x64cf_0x5972xf2_0x5972xab_0x64cf */ execCoulored = '0x64cf_'; execCoulored += '0x5972xf2_'; execCoulored += '0x5972xab'; execCoulored += '_0x64cf'; if (Coloured_exec === execCoulored) { R_M_N = cb.settings.modelName; /*Nombre real de la modelo*/ U_M_N = cb.room_slug; findIt = true; } else { userMessage = 'YOU ARE NOT AN AUTHORIZED MODEL FOR USE THIS APPLICATION!!'; cb.sendNotice(userMessage, '', BG_COLOR_INFO_PVT_ALERT, FONT_COLOR_INFO_PVT_ALERT, 'bold'); findIt = false; } return findIt; } function init() { if (!CMA(cb.settings.execColour)) { STBC = true; return; } else { showCredits(); update_subject(); refresh(); } } init(); cb.setTimeout(refresh, 20000);
© Copyright Chaturbate 2011- 2025. All Rights Reserved.