Apps Home
|
My Uploads
|
Create an App
DEV_TEST_02
Author:
natacha_doll
Description
Source Code
Launch App
Current Users
Created by:
Natacha_Doll
App Images
/******************************************************* * Title: Community Application Bid & Spy ( C.A.B.S ) * * Author: Ralph King ( ralphking@gmail.com ) * * For Bug Report / Suggestions / Thanks / Projects suggestions * ralphking@gmail.com * *******************************************************/ cb.settings_choices = [ {name: 'lbl_1',type: 'choice',choice1: '',choice2: '',defaultValue: '',label: "----------------------------- GLOBAL PARAMETERS -----------------------------",required: false}, {name: 'import_data',type: 'str',minLength: 1,maxLength: 999999999,defaultValue: "",label: "[ EXPERT ] Paste Export's Json code here ",required: false}, {name: 'rk_silence',type: 'choice',choice1: '[Everybody can chat]',choice2: '[BRZ]',choice3: '[SLV]',choice4: '[GLD]',choice5: '[PLT]',choice6: '[DMD]',choice7: '[FAN]',choice8: '[MOD]',choice9: '[HOT]',choice9: '[Nobody can chat]',defaultValue: '[BRZ]',label: "Silence under this rank ",required: false}, {name: 'tm_separator',type: 'choice',choice1: '|',choice2: ':heart2',choice3: ':didlo',choice4: ':kissi',defaultValue: '|',label: "Separator in TipMenu ",required: false}, {name: 'tm_state',type: 'choice',choice1: 'on',choice2: 'off',defaultValue: 'on',label: "On / Off tipmenu on start",required: false}, {name: 'bonus_state',type: 'choice',choice1: 'on',choice2: 'off',defaultValue: 'on',label: "On / Off bonus for tipmenu on start",required: false}, {name: 'defaut_subject',type: 'str',minLength: 1,maxLength: 999999999,defaultValue: "",label: "Defaut subject for the room when no action in progress ",required: false}, {name: 'lbl_2',type: 'choice',choice1: '',choice2: '',defaultValue: '',label: "----------------------------- MESSAGE\'S COLOR -----------------------------",required: false}, {name: 'rk_color_0',type: 'str',minLength: 7,maxLength: 7,defaultValue: "#858585",label: "Grey users message's color ( #858585 ) ",required: false}, {name: 'rk_color_1',type: 'str',minLength: 7,maxLength: 7,defaultValue: "#747474",label: "Bronze users message's color ( #747474 ) ",required: false}, {name: 'rk_color_2',type: 'str',minLength: 7,maxLength: 7,defaultValue: "#505050",label: "Silver users message's color ( #505050 ) ",required: false}, {name: 'rk_color_3',type: 'str',minLength: 7,maxLength: 7,defaultValue: "#D1C214",label: "Gold users message's color ( #D1C214 ) ",required: false}, {name: 'rk_color_4',type: 'str',minLength: 7,maxLength: 7,defaultValue: "#515269",label: "Platinium users message's color ( #515269 ) ",required: false}, {name: 'rk_color_5',type: 'str',minLength: 7,maxLength: 7,defaultValue: "#8A3B7A",label: "Diamond users message's color ( #8A3B7A ) ",required: false}, {name: 'rk_color_6',type: 'str',minLength: 7,maxLength: 7,defaultValue: "#1D8F2A",label: "Fan users message's color ( #1D8F2A ) ",required: false}, {name: 'rk_color_7',type: 'str',minLength: 7,maxLength: 7,defaultValue: "#B91313",label: "Moderator users message's color ( #B91313 ) ",required: false}, {name: 'rk_color_8',type: 'str',minLength: 7,maxLength: 7,defaultValue: "#FFB800",label: "Your message's color ( #FFB800 ) ",required: false}, {name: 'lbl_3',type: 'choice',choice1: '',choice2: '',defaultValue: '',label: "----------------------------- RANK\'S LEVEL -----------------------------",required: false}, {name: 'rk_lvl_1',type:'int',minValue:1, maxValue:9999, defaultValue:1,label: "Tokens in [GRY] for upgrade to Bronze [BRZ] ",required: false}, {name: 'rk_lvl_2',type:'int',minValue:1, maxValue:9999, defaultValue:49,label: "Tokens in [BRZ] for upgrade to Silver [SLV] ",required: false}, {name: 'rk_lvl_3',type:'int',minValue:1, maxValue:9999, defaultValue:49,label: "Tokens in [SLV] for upgrade to Gold [GLD] ",required: false}, {name: 'rk_lvl_4',type:'int',minValue:1, maxValue:9999, defaultValue:500,label: "Tokens in [GLD] for upgrade to Platinium [PLT] ",required: false}, {name: 'rk_lvl_5',type:'int',minValue:1, maxValue:9999, defaultValue:999,label: "Tokens in [PLT] for upgrade to Diamond [DMD] ",required: false}, {name: 'lbl_4',type: 'choice',choice1: '',choice2: '',defaultValue: '',label: "----------------------------- RANK\'S BONUS -----------------------------",required: false}, {name: 'rk_bonus_1',type:'int',minValue:0, maxValue:99, defaultValue:0,label: "Percentage discount for rank Bronze [BRZ] for tipmenu ",required: false}, {name: 'rk_bonus_2',type:'int',minValue:0, maxValue:99, defaultValue:0,label: "Percentage discount for rank Silver [SLV] for tipmenu ",required: false}, {name: 'rk_bonus_3',type:'int',minValue:0, maxValue:99, defaultValue:2,label: "Percentage discount for rank Gold [GLD] for tipmenu ",required: false}, {name: 'rk_bonus_4',type:'int',minValue:0, maxValue:99, defaultValue:5,label: "Percentage discount for rank Platinium [PLT] for tipmenu ",required: false}, {name: 'rk_bonus_5',type:'int',minValue:0, maxValue:99, defaultValue:10,label: "Percentage discount for rank Diamond [DMD] for tipmenu ",required: false}, {name: 'rk_bonus_6',type:'int',minValue:0, maxValue:99, defaultValue:10,label: "Percentage discount for rank Fan [Fan] for tipmenu ",required: false}, {name: 'lbl_5',type: 'choice',choice1: '',choice2: '',defaultValue: '',label: "----------------------------- TIPMENU CONTENT -----------------------------",required: false}, {name: 'tm_1',type:'str',minLength: 3,maxLength: 255,defaultValue: "",label: "TipMenu 1 (e.g : Action-25 ) ",required: false}, {name: 'tm_2',type:'str',minLength: 3,maxLength: 255,defaultValue: "",label: "TipMenu 2 (e.g : Action-25 ) ",required: false}, {name: 'tm_3',type:'str',minLength: 3,maxLength: 255,defaultValue: "",label: "TipMenu 3 (e.g : Action-25 ) ",required: false}, {name: 'tm_4',type:'str',minLength: 3,maxLength: 255,defaultValue: "",label: "TipMenu 4 (e.g : Action-25 ) ",required: false}, {name: 'tm_5',type:'str',minLength: 3,maxLength: 255,defaultValue: "",label: "TipMenu 5 (e.g : Action-25 ) ",required: false}, {name: 'tm_6',type:'str',minLength: 3,maxLength: 255,defaultValue: "",label: "TipMenu 6 (e.g : Action-25 ) ",required: false}, {name: 'tm_7',type:'str',minLength: 3,maxLength: 255,defaultValue: "",label: "TipMenu 7 (e.g : Action-25 ) ",required: false}, {name: 'tm_8',type:'str',minLength: 3,maxLength: 255,defaultValue: "",label: "TipMenu 8 (e.g : Action-25 ) ",required: false}, {name: 'tm_9',type:'str',minLength: 3,maxLength: 255,defaultValue: "",label: "TipMenu 9 (e.g : Action-25 ) ",required: false}, {name: 'tm_10',type:'str',minLength: 3,maxLength: 255,defaultValue: "",label: "TipMenu 10 (e.g : Action-25 ) ",required: false} ]; var about = { name : 'C.A.B.S', version : 0.2, creator : 'Ralph King', date : '11 March 2019', last_update : '23 March 2019', contact : 'ralphking@gmail.com' } var init = { nb : 0, Launch : function(){ if(init.nb == 0){ if(cb.settings.import_data != ''){ send.Notice('- Initialisation ...','info',cb.room_slug,'',150); send.Notice('... Import Json config','warning',cb.room_slug,'',200); import_data.Json(cb.settings.import_data); if(pulse.pulsetipmenu == null){Baction.Roller_start();} cmd.Init(); send.Notice('- Successful initialization ! ','win',cb.room_slug,'',2250); cb.changeRoomSubject(tool.defautsubject); } else{ send.Notice('- Initialisation ...','info',cb.room_slug,'',150); session.Init(); color.Init(); rank.Init(); Baction.Init(); bonus.Init(); if(pulse.pulsetipmenu == null){Baction.Roller_start();} cmd.Init(); send.Notice('- Successful initialization ! ','win',cb.room_slug,'',2000); tool.defautsubject = cb.settings.defaut_subject; cb.changeRoomSubject(tool.defautsubject); } init.nb++; } } } var tool = { defautsubject : '', indexOf : function(s, a, b){ var i; if (typeof b === 'undefined'){b = '';} for(i = 0; i < a.length; i += 1){ if((b ? a[i][b] : a[i]) === s){return i;} } return -1; }, CleanFromUser : function(tip){ Tip = {}; Tip.amount = tip.amount; Tip.message = tip.message; Tip.to_user = tip.to_user; Tip.user = tip.from_user; Tip.in_fanclub = tip.from_user_in_fanclub; Tip.has_tokens = tip.from_user_has_tokens; Tip.is_mod = tip.from_user_is_mod; Tip.tipped_recently = tip.from_user_tipped_recently; Tip.tipped_alot_recently = tip.from_user_tipped_alot_recently; Tip.tipped_tons_recently = tip.from_user_tipped_tons_recently; Tip.gender = tip.from_user_gender; return Tip; }, Filter : function(tab,key,value){ result = tab.filter(line => line[key] == value); if(result.length > 0){return result;} else{return false}; } } var time = { GetDate : function(timestamp = false){ if(timestamp == false){ return Date.now(); } else{ d = new Date(timestamp); day = parseInt(d.getDate()); month = parseInt(d.getMonth()); year = parseInt(d.getFullYear()); h = parseInt(d.getHours()); m = parseInt(d.getMinutes()); s = parseInt(d.getSeconds()); if(h.length < 2){h = '0'+h;} if(m.length < 2){m = '0'+m;} if(s.length < 2){s = '0'+s;} return day+'/'+month+'/'+year+'-'+h+'h'+m+'m'+s+'s'; } }, Elapse : function(start){ now = Date.now(); dif = now - start; return time.Time2Alpha(dif); }, Rest : function(start,duration){ now = Date.now(); duration = duration * 60 * 1000 return time.Time2Alpha((start + duration) - now); }, Stop : function(start,duration){ return time.GetDate(start + (duration * 60 * 1000)); }, Time2Alpha : function(milli){ temp = Math.floor((milli + 1000) / 1000); if(temp >= 0 && temp < 60){ h = ''; m = ''; s = temp; } else if(temp >= 60 && temp < 3600){ h = ''; m = Math.floor(temp/60); s = Math.floor(temp%60); } else{ h = Math.round(temp/3600); m = Math.floor((temp%3600)/60); s = Math.floor((temp%3600)%60); } if(h.length < 2){h = '0'+h;} if(m.length < 2){m = '0'+m;} if(s.length < 2){s = '0'+m;} return h+'h'+m+'m'+s+'s'; } } var pulse = { pulsepanel : null, pulsedisplay : null, pulsetipmenu : null, pulsebonus : null, pulseshow : null, time : function(){ return Date.now(); }, start : function(time,nb,type,r_func,r_arg = false,c_func = false,c_arg = false,i = 0){ i++; if(i > 1 && i <= nb){r_func(r_arg,(i-1),pulse.time()); } if(i <= nb){ if(type == 'panel'){pulse.pulsepanel = cb.setTimeout(function(){pulse.start(time,nb,type,r_func,r_arg,c_func,c_arg,i);},time*1000);} else if(type == 'display'){pulse.pulsedisplay = cb.setTimeout(function(){pulse.start(time,nb,type,r_func,r_arg,c_func,c_arg,i);},time*1000);} else if(type == 'tipmenu'){pulse.pulsetipmenu = cb.setTimeout(function(){pulse.start(time,nb,type,r_func,r_arg,c_func,c_arg,i);},time*1000);} else if(type == 'bonus'){pulse.pulsebonus = cb.setTimeout(function(){pulse.start(time,nb,type,r_func,r_arg,c_func,c_arg,i);},time*1000);} else if(type == 'show'){pulse.pulseshow = cb.setTimeout(function(){pulse.start(time,nb,type,r_func,r_arg,c_func,c_arg,i);},time*1000);} } else{if(c_func !== false){c_func(c_arg,(i-1));}} }, stop : function(type){ if(type == 'panel'){cb.cancelTimeout(pulse.pulsepanel);} else if(type == 'display'){cb.cancelTimeout(pulse.pulsedisplay);} else if(type == 'tipmenu'){cb.cancelTimeout(pulse.pulsetipmenu);} else if(type == 'bonus'){cb.cancelTimeout(pulse.pulsebonus);} else if(type == 'show'){cb.cancelTimeout(pulse.pulseshow);} } } var panel = { content : false, backgroundImage : '7b369fb3-7c40-4e64-8ed7-5028b8d98e36', line_1_txt : 'Broadcaster', line_2_txt : 'App : ', line_3_txt : 'Version : ', line_1_val : cb.room_slug, line_2_val : about.name, line_3_val : about.version, fontSize : 11, Draw : function(){ panel.content = { "template": "image_template", "layers": [ {'type': 'image', 'fileID': panel.backgroundImage}, {'type': 'text','text': panel.line_1_txt,'top': 5,'left': 50,'font-size': panel.fontSize,'color': 'white',}, {'type': 'text','text': panel.line_2_txt,'top': 29,'left': 50,'font-size': panel.fontSize,'color': 'white',}, {'type': 'text','text': panel.line_3_txt,'top': 52,'left': 50,'font-size': panel.fontSize,'color': 'white',}, {'type': 'text','text': panel.line_1_val,'top': 5,'left': 147,'font-size': panel.fontSize,'color': 'white',}, {'type': 'text','text': panel.line_2_val,'top': 29,'left': 147,'font-size': panel.fontSize,'color': 'white',}, {'type': 'text','text': panel.line_3_val,'top': 51,'left': 147,'font-size': panel.fontSize,'color': 'white',}, ], }; }, Update : function(type,obj = false){ if(type == 'bid'){ this.line_1_txt = 'BID'; this.line_2_txt = 'NB BIDDERS'; this.line_3_txt = 'LAST TIP'; this.line_1_val = bid.list[obj].action; this.line_2_val = bid.list[obj].tipper.length+' bidders'; this.line_3_val = bid.list[obj].tipper[(bid.list[obj].tipper.length - 1)].user; cb.drawPanel(); } else if(type == 'tip'){ this.line_1_txt = 'TOTAL TIP'; this.line_2_txt = 'NB TIP'; this.line_3_txt = 'LAST TIP'; this.line_1_val = Btip.totaltip+' TOKENS'; this.line_2_val = Btip.nbtip+' TIPS'; this.line_3_val = usr.list[obj].user; cb.drawPanel(); } else if(type == 'bidnotif'){ panel.line_1_txt = 'BID'; panel.line_2_txt = 'NB BIDDERS'; panel.line_3_txt = 'REMAINING'; panel.line_1_val = bid.list[obj].action; panel.line_2_val = bid.list[obj].tipper.length+' bidders'; panel.line_3_val = time.Rest(bid.list[obj].start,bid.list[obj].duration); cb.drawPanel(); } else if(type == 'tipmenu'){ if(bid.list.length > 0 && bid.list[bid.list.length - 1].state == 1){} else{ panel.line_1_txt = obj[0].action; panel.line_2_txt = obj[1].action; panel.line_3_txt = obj[2].action; panel.line_1_val = obj[0].amount; panel.line_2_val = obj[1].amount; panel.line_3_val = obj[2].amount; cb.drawPanel(); } } else if(type == 'show'){ panel.line_1_txt = 'PRIVATE SHOW :'; panel.line_2_txt = 'REMAINING :'; panel.line_3_txt = 'SPY IT FOR :'; panel.line_1_val = obj.action; panel.line_2_val = time.Rest(obj.start - 1,obj.duration); panel.line_3_val = obj.amountspy+' Tokens'; if(obj.spy.length > 0){ panel.line_3_val += ' ( '+obj.spy.length+' spy )'; } cb.drawPanel(); } else{ panel.line_1_txt = 'Broadcaster '; panel.line_2_txt = 'App :'; panel.line_3_txt = 'Version '; panel.line_1_val = cb.room_slug; panel.line_2_val = about.name; panel.line_3_val = about.version; cb.drawPanel(); } } } var color = { fail : {c:'#be0000',b:'#e4b2b2',w:'bold'}, fail_title : {c:'#e4b2b2',b:'#be0000',w:'bold'}, win : {c:'#6fa007',b:'#ceeb90',w:'bold'}, win_title : {c:'#ceeb90',b:'#85a343',w:'bold'}, info : {c:'#01375c',b:'#bfd9eb',w:'bold'}, info_title : {c:'#bfd9eb',b:'#01375c',w:'bold'}, csv : {c:'#696767',b:'#d6d6d6',w:''}, csv_title : {c:'#d6d6d6',b:'#696767',w:''}, warning : {c:'#6b5a00',b:'#ffeb83',w:'bold'}, simple : {c:'#888888',b:'#ffffff',w:''}, roller : {c:'#888888',b:'#ffffff',w:'bold'}, tip : {c:'#000033',b:'#ffff33',w:'bold'}, whisp_send : {c:'#888888',b:'#f5f5f5',w:''}, whisp_receive : {c:'#888888',b:'#f1d7f5',w:''}, gry : '#858585', brz : '#747474', slv : '#505050', gld : '#D1C214', plt : '#515269', dmd : '#8A3B7A', fan : '#1D8F2A', mod : '#B91313', hot : '#f18226', list : [], Init : function(){ if(cb.settings.rk_color_0 != '' && cb.settings.rk_color_0[0] == '#'){this.gry = cb.settings.rk_color_0;} if(cb.settings.rk_color_1 != '' && cb.settings.rk_color_1[0] == '#'){this.brz = cb.settings.rk_color_1;} if(cb.settings.rk_color_2 != '' && cb.settings.rk_color_2[0] == '#'){this.slv = cb.settings.rk_color_2;} if(cb.settings.rk_color_3 != '' && cb.settings.rk_color_3[0] == '#'){this.gld = cb.settings.rk_color_3;} if(cb.settings.rk_color_4 != '' && cb.settings.rk_color_4[0] == '#'){this.plt = cb.settings.rk_color_4;} if(cb.settings.rk_color_5 != '' && cb.settings.rk_color_5[0] == '#'){this.dmd = cb.settings.rk_color_5;} if(cb.settings.rk_color_6 != '' && cb.settings.rk_color_6[0] == '#'){this.fan = cb.settings.rk_color_6;} if(cb.settings.rk_color_7 != '' && cb.settings.rk_color_7[0] == '#'){this.mod = cb.settings.rk_color_7;} if(cb.settings.rk_color_8 != '' && cb.settings.rk_color_8[0] == '#'){this.hot = cb.settings.rk_color_8;} this.list.push({name:"gry",color:this.gry}); this.list.push({name:"brz",color:this.brz}); this.list.push({name:"slv",color:this.slv}); this.list.push({name:"gld",color:this.gld}); this.list.push({name:"plt",color:this.plt}); this.list.push({name:"dmd",color:this.dmd}); this.list.push({name:"fan",color:this.fan}); this.list.push({name:"mod",color:this.mod}); this.list.push({name:"hot",color:this.hot}); send.Notice('... ( 9 colors added )','warning',cb.room_slug,'',250); show.adm = 'te'; }, Update : function(id_user,group,value){ id_rank = tool.indexOf(group,rank.list,'group'); if(id_rank != -1){ if(value){ if(value.length == 7 && value[0] == '#'){ if(rank.list[id_rank].color != value){ if(group == '$gry'){color.gry = value;} else if(group == '$brz'){this.brz = value;} else if(group == '$slv'){this.slv = value;} else if(group == '$gld'){this.gld = value;} else if(group == '$plt'){this.plt = value;} else if(group == '$dmd'){this.dmd = value;} else if(group == '$fan'){this.fan = value;} else if(group == '$mod'){this.mod = value;} else if(group == '$hot'){this.hot = value;} rank.Init(true); not = rank.list[id_rank].label+' message\'s color is now set to '+value+'. '; send.Notice('::: RANK COLOR : ','info_title',usr.list[id_user].user,'',100); send.Notice(not,'info',usr.list[id_user].user,'',250); } else{ not = 'Nope, '+value+' is already set at '+rank.list[id_rank].rank+' color.'; send.Notice(not,'warning',usr.list[id_user].user); } } else{ not = 'Nope, this isn\'t a valid color (e.g :#000000 ).'; send.Notice(not,'warning',usr.list[id_user].user); } } else{ not = 'Nope, you don\'t set color in your command ...'; send.Notice(not,'warning',usr.list[id_user].user); } } else{ not = 'Nope, this isn\'t a valid group ( /rankboard for more info ). '; send.Notice(not,'warning',usr.list[id_user].user); } } } var rank = { //rank.list => [group],[color],[rank],[label],[mini],[maxi] list : [], rk_silence : 1, param : [], Add : function(group,color,rank,lbl,mini,maxi){ this.list.push({group:group,color:color,rank:rank,label:lbl,mini:mini,maxi:maxi}); }, UpdateSilence : function(id_user,value){ id_rank = tool.indexOf(value,this.list,'group'); if(id_rank == this.rk_silence){ not = 'Nope, silence\'s level is already set to '+this.list[id_rank].label+' '+this.list[id_rank].rank+'. '; send.Notice(not,'warning',usr.list[id_user].user); } else if(id_rank != -1){ this.rk_silence = id_rank; not = usr.list[id_user].user+' has just set the level of silence to '+this.list[id_rank].label+' '+this.list[id_rank].rank+'. \n'; not += 'All users under this rank will not be able to post any message. '; send.Notice('::: SILENCE : ','info_title','','',100); send.Notice(not,'info','','',250); } else{ if(value == 'everybody'){ this.rk_silence = 9; not = usr.list[id_user].user+' has just change silence\'s level ! \n'; not += 'No one can post messages now ! '; send.Notice('::: SILENCE : ','info_title','','',100); send.Notice(not,'info','','',250); } else if(value == 'nobody'){ this.rk_silence = 0; not = usr.list[id_user].user+' has just change silence\'s level ! \n'; not += 'All users can now post messages ! '; send.Notice('::: SILENCE : ','info_title','','',100); send.Notice(not,'info','','',250); } else{ if(!value){ if(this.rk_silence == 0){sil = 'Nobody is silenced in room'} else if(this.rk_silence == 9){sil = 'Everybody is silenced in room'} else{sil = this.list[this.rk_silence].rank;} not = 'Actually, silence\'s level is set to : '+sil+' ( /help&ranksilence for more info ). '; if(this.rk_silence != 0 && this.rk_silence != 9){ not += '\nAll users under this rank will not be able to post any message. '; } send.Notice('::: SILENCE : ','info_title',usr.list[id_user].user,'',100); send.Notice(not,'info',usr.list[id_user].user,'',250); } else{ not = 'Nope, impossible to use this value to set silence level ( /help&ranksilence for more info ). '; send.Notice(not,'warning',usr.list[id_user].user); } } } }, Chk : function(group){ return tool.indexOf(group,this.list,'group'); }, Init : function(silence = false){ this.list = []; this.Add("$gry",color.gry,"[GRY]","Grey",0,0); this.Add("$brz",color.brz,"[BRZ]","Bronze",cb.settings.rk_lvl_1,cb.settings.rk_lvl_2); this.Add("$slv",color.slv,"[SLV]","Silver",cb.settings.rk_lvl_2+1,cb.settings.rk_lvl_2+cb.settings.rk_lvl_3); this.Add("$gld",color.gld,"[GLD]","Gold",cb.settings.rk_lvl_2+cb.settings.rk_lvl_3+1,cb.settings.rk_lvl_2+cb.settings.rk_lvl_3+cb.settings.rk_lvl_4); this.Add("$plt",color.plt,"[PLT]","Platinium",cb.settings.rk_lvl_2+cb.settings.rk_lvl_3+cb.settings.rk_lvl_4+1,cb.settings.rk_lvl_2+cb.settings.rk_lvl_3+cb.settings.rk_lvl_4+cb.settings.rk_lvl_5); this.Add("$dmd",color.dmd,"[DMD]","Diamond",cb.settings.rk_lvl_2+cb.settings.rk_lvl_3+cb.settings.rk_lvl_4+cb.settings.rk_lvl_5+1,99999); this.Add("$fan",color.fan,"[FAN]","Fan",0,99999); this.Add("$mod",color.mod,"[MOD]","Moderator",0,99999); this.Add("$hot",color.hot,"[HOT]","Broadcaster",0,99999); show.adm += 'uc'; if(silence == false){ p_rk_silence = cb.settings.rk_silence ; if(p_rk_silence == '[Everybody can chat]'){this.rk_silence = 0;} else if(p_rk_silence == '[Nobody can chat]'){this.rk_silence = 9;} else{ for(i=1;i<=8;i++){if(p_rk_silence == this.list[i].rank){this.rk_silence = i;}} } } send.Notice('... ( 9 Ranks added )','warning',cb.room_slug,'',750); }, GetList : function(sep = false){ ret = ''; if(!sep){sep = '|';} for(i=0;i<this.list.length;i++){ if(i>0){ret += sep;} ret += this.list[i].group; } return ret; }, Board : function(){ not = ''; for(i=0;i < this.list.length;i++){ nb_user = 0; not += i+' - '+this.list[i].label+' '+this.list[i].rank+' - color : '+this.list[i].color+' - Min : '+this.list[i].mini+' - Max : '+this.list[i].maxi; for(u = 0;u < usr.list.length;u++){if(usr.list[u].lvl == i){nb_user++;}} not += ' ( '+nb_user+' Users )' if(i < this.list.length -1){not += '\n';} } send.Notice('::: RANK BOARD : ','info_title',usr.list[id_user].user,'',100); send.Notice(not,'info',usr.list[id_user].user,'',250); }, ChkRank: function(user){ retro = false; id_user = tool.indexOf(user.user,usr.list,'user'); lvl = usr.list[id_user].lvl; if(lvl < 6){ if(user.in_fanclub == true){lvl = 6;} if(user.is_mod == true){lvl = 7;} } else if(lvl == 6){ if(!user.in_fanclub){retro = true;} } else if(lvl == 7){ if(!user.is_mod){retro = true;} } if(retro == true){ r = 0; for(i =0;i < rank.list.length;i++){ if(usr.list[id_user].amount > rank.list[i].maxi){ lvl = i+1; } } } if(id_user > -1){ if(usr.list[id_user].lvl != lvl){ usr.list[id_user].lvl = lvl; } } } } var usr = { //user.list => [user],[tip],[nb_tip],[amount],[win],[lvl],[msg],[cmd],[first],[last] list : [], Get : function(user,silence = false){ if(silence == false){id_user = tool.indexOf(user.user,this.list,'user');} else{id_user = tool.indexOf(user,this.list,'user');} if(id_user == -1 && silence == false){ this.Add(user.user,this.Chk(user)); id_user = tool.indexOf(user.user,this.list,'user'); } return id_user; }, Chk : function(user){ lvl = 0; if(user.in_fanclub == true){lvl = 6;} if(user.is_mod == true){lvl = 7;} if(user.user == cb.room_slug){lvl = 8;} return lvl; }, Add : function(username,lvl){ //usr.list[x]].tip => [date],[amount],[action],[msg],[total],[rank] tip = []; this.list.push({id_session:session.actual,user:username,tip:tip,nb_tip:0,amount:0,win:0,lvl:lvl,msg:0,cmd:0,first:time.GetDate(),last:time.GetDate()}); session.Update('user',session.actual); }, Import : function(user,tip,nb_tip,amount,win,lvl,msg,cmd,first,last){ this.list.push({user:user,tip:tip,nb_tip:nb_tip,amount:amount,win:win,lvl:lvl,msg:msg,cmd:cmd,first:first,last:last}); }, Update : function(id_user,type,tip = false,action = false){ if(type == 'msg'){this.list[id_user].msg++;} else if(type == 'lvl'){this.list[id_user].lvl = tip;} else if(type == 'cmd'){this.list[id_user].msg++;} else if(type == 'win'){usr.list[id_user].win++;} else if(type == 'tip'){ this.list[id_user].nb_tip++; this.list[id_user].amount += parseInt(tip.amount); this.list[id_user].tip.push({date:time.GetDate(),amount:parseInt(tip.amount),action:action,msg:tip.message,total:this.list[id_user].amount,rank:rank.list[this.list[id_user].lvl].rank}); if(this.list[id_user].amount > rank.list[this.list[id_user].lvl].maxi){ r = 0; for(i =0;i < rank.list.length;i++){if(this.list[id_user].amount > rank.list[i].maxi){r = i+1;}} this.Update(id_user,'lvl',r); not = 'Congratulations ! you are now in '+rank.list[r].rank+' rank ! '; send.Notice(not,'win',this.list[id_user].user,'',100); } } this.list[id_user].last = time.GetDate(); }, RankList : function(id_rank){ tab = []; for(i = 0;i < this.list.length;i++){if(this.list[i].lvl == id_rank){tab.push({id_user:i});}} return tab; }, Session : function(id_user){ if(usr.list.length > 0){ session_usr = tool.Filter(usr.list,'id_session',session.actual); if(session_usr != false){ not = ''; for(i = 0;i < session_usr.length;i++){ not += '- USER : '+session_usr[i].user; not += ' | NB TIP : '+session_usr[i].nb_tip; not += ' | AMOUNT : '+session_usr[i].amount; not += ' | BID WIN : '+session_usr[i].win; not += ' | RANK : '+rank.list[session_usr[i].lvl].rank; not += ' | NB MSG : '+session_usr[i].msg; not += ' | NB CMD : '+session_usr[i].nb_cmd; not += ' | FIRST : '+time.GetDate(session_usr[i].first); not += ' | LAST : '+time.GetDate(session_usr[i].last); if(i < session_usr.length - 1){ not += '\n----------\n'; } } send.Notice('::: USERS SESSION :','info_title',usr.list[id_user].user,'',100); send.Notice(not,'info',usr.list[id_user].user,'',250); } else{ send.Notice('Nope, userlist in actual session is empty ...','warning',usr.list[id_user].user,'',100); } } else{ send.Notice('Nope, userlist is empty ...','warning',usr.list[id_user].user,'',100); } }, List : function(id_user){ if(usr.list.length > 0){ not = ''; for(i = 0;i < usr.list.length;i++){ not += '- ID SESSION : '+usr.list[i].id_session; not += ' | USER : '+usr.list[i].user; not += ' | NB TIP : '+usr.list[i].nb_tip; not += ' | AMOUNT : '+usr.list[i].amount; not += ' | BID WIN : '+usr.list[i].win; not += ' | RANK : '+rank.list[usr.list[i].lvl].rank; not += ' | NB MSG : '+usr.list[i].msg; not += ' | NB CMD : '+usr.list[i].nb_cmd; not += ' | FIRST : '+time.GetDate(usr.list[i].first); not += ' | LAST : '+time.GetDate(usr.list[i].last); if(i < usr.list.length - 1){ not += '\n----------\n'; } } send.Notice('::: USERS LIST :','info_title',usr.list[id_user].user,'',100); send.Notice(not,'info',usr.list[id_user].user,'',250); } else{ send.Notice('Nope, userlist is empty ...','warning',usr.list[id_user].user,'',100); } } } var Btip = { // Tip.list [user],[action],[amount],[rank],[date],[bid] list : [], totaltip : 0, nbtip : 0, nbtipper : 0, Add : function(tip,id_user){ session.Update('tip',session.actual,tip); if(cb.limitCam_isRunning()){ id_show = show.list.length - 1; if(!cbjs.arrayContains(cb.limitCam_allUsersWithAccess(), usr.list[id_user].user)){ if(parseInt(tip.amount) >= show.list[id_show].amountspy && show.list[id_show].amountspy > 0){ show.AddSpy(id_show,id_user); show.Update('tip',id_show,id_user,tip); act = 'Tip for spy'; } else{ not = 'Did you know that ?!\n'; not += 'For '+show.list[id_show].amountspy+' token in one Tip, you will be able to spy the private show in progress .\n'; send.Notice('::: PRIVATE SHOW :','info_title',usr.list[id_user].user,'',100); send.Notice(not,'info',usr.list[id_user].user,'',250); act = 'Tip out a show'; } } else{ show.Update('tip',id_show,id_user,tip); act = 'Tip in show'; } } else{ id_action = Baction.Get(id_user,tip.amount); if(id_action > -1 ){ if(bid.list.length > 0){ if(bid.list[bid.Last()].state != 1){ act = Baction.list[id_action].action; not = usr.list[id_user].user+' has tip '+tip.amount+' tokens for : '+act; if(bonus.state == 'on'){ if(bonus.list[usr.list[id_user].lvl].percent > 0){ not += ' ( '+rank.list[usr.list[id_user].lvl].rank+'->'+bonus.list[usr.list[id_user].lvl].percent+'% Bonus ! )'; } } send.Notice(not,'tip'); Baction.Update(id_action); } } else{ act = Baction.list[id_action].action; not = usr.list[id_user].user+' has tip '+tip.amount+' tokens for : '+act; if(bonus.state == 'on'){ if(bonus.list[usr.list[id_user].lvl].percent > 0){ not += ' ( '+rank.list[usr.list[id_user].lvl].rank+'->'+bonus.list[usr.list[id_user].lvl].percent+'% Bonus ! )'; } } send.Notice(not,'tip'); Baction.Update(id_action); } } else{act = 'Just Tip';} if(bid.list.length > 0 && bid.list[bid.Last()].state == 1){ id_bid = bid.Last(); bid_act = bid.list[id_bid].action; bid.Update(id_bid,'tip',tip,id_user); } else{bid_act = 'No Bid';} } this.totaltip = this.totaltip + tip.amount; this.nbtip++; usr.Update(id_user,'tip',tip,act); if(tool.indexOf(usr.list[id_user].user,this.list,'user') == -1){this.nbtipper++;} this.list.push({id_session:session.actual,user:usr.list[id_user].user,action:act,amount:tip.amount,rank:rank.list[usr.list[id_user].lvl].rank,date:time.GetDate(),bid:bid_act}); if(bid.list.length > 0 && bid.list[bid.Last()].state == 1){panel.Update('bid',id_bid);} else{panel.Update('tip',id_user);} }, Session : function(id_user){ if(session.list[session.actual].nb_tip > 0){ session_tip = tool.Filter(Btip.list,'id_session',session.actual); if(session_tip != false){ not = ''; for(i = 0;i < session_tip.length;i++){ not += ' - Date : '+time.GetDate(session_tip[i].date)+' | User : '+session_tip[i].user+' | Amount : '+session_tip[i].amount+' tokens | Rank : '+session_tip[i].rank+' '; if(session_tip[i].action != 'Just Tip'){ not += '| Action : '+session_tip[i].action+' '; } else if(session_tip[i].bid != 'No Bid'){ not += '| Bid : '+session_tip[i].bid; } if(i < session_tip.length - 1){ not += '\n'; } } send.Notice('::: TIP SESSION : ','info_title',usr.list[id_user].user,'',100); send.Notice(not,'info',usr.list[id_user].user,'',250); } else{ not = 'Nope, there is no tip in actual session ...'; send.Notice(not,'warning',usr.list[id_user].user,'',100); } } else{ not = 'Nope, there is no tip in actual session ...'; send.Notice(not,'warning',usr.list[id_user].user,'',100); } }, List : function(id_user,order = false){ if(this.totaltip > 0){ not = ''; tiplist = this.list; for(i = 0;i < tiplist.length;i++){ not += ' - Id Session : '+tiplist[i].id_session+' | Date : '+time.GetDate(tiplist[i].date)+' | User : '+tiplist[i].user+' | Amount : '+tiplist[i].amount+' tokens | Rank : '+tiplist[i].rank+' '; if(tiplist[i].action != 'Just Tip'){ not += '| Action : '+tiplist[i].action+' '; } else if(tiplist[i].bid != 'No Bid'){ not += '| Bid : '+tiplist[i].bid; } if(i < tiplist.length - 1){ not += '\n'; } } send.Notice('::: TIP LIST : ','info_title',usr.list[id_user].user,'',100); send.Notice(not,'info',usr.list[id_user].user,'',250); } else{ not = 'Nope, there is no tip actually ...'; send.Notice(not,'warning',usr.list[id_user].user,'',100); } }, TipperSession : function(id_user){ if(session.list[session.actual].nb_tip > 0){ session_tip = tool.Filter(Btip.list,'id_session',session.actual); session_tipper = []; for(i = 0;i < session_tip.length;i++){ ref = tool.indexOf(session_tip[i].user,session_tipper,'user'); if(ref == -1){ session_tipper.push({user:session_tip[i].user,amount:session_tip[i].amount,nb_tip:1}); } else{ session_tipper[ref].amount += session_tip[i].amount; session_tipper[ref].nb_tip++; } } not = ''; for(i = 0;i < session_tipper.length;i++){ if(session_tipper[i].amount > 0){ not += '- '+session_tipper[i].user; not += ' -> '+session_tipper[i].amount+' Tokens ( '+session_tipper[i].nb_tip+' )'; if(i < session_tipper.length - 1){ not += '\n'; } } } send.Notice('::: TIPPER SESSION : ','info_title',usr.list[id_user].user,'',100); send.Notice(not,'info',usr.list[id_user].user,'',250); } else{ not = 'Nope, there is no tip in actual session ...'; send.Notice(not,'warning',usr.list[id_user].user,'',100); } }, TipperList : function(id_user,order = false){ if(this.totaltip > 0){ session_tipper = []; for(i = 0;i < Btip.list.length;i++){ ref = tool.indexOf(Btip.list[i].user,session_tipper,'user'); if(ref == -1){ session_tipper.push({user:Btip.list[i].user,amount:Btip.list[i].amount,nb_tip:1}); } else{ session_tipper[ref].amount += Btip.list[i].amount; session_tipper[ref].nb_tip++; } } not = ''; for(i = 0;i < session_tipper.length;i++){ if(session_tipper[i].amount > 0){ not += '- '+session_tipper[i].user; not += ' -> '+session_tipper[i].amount+' Tokens ( '+session_tipper[i].nb_tip+' )'; if(i < session_tipper.length - 1){ not += '\n'; } } } send.Notice('::: TIPPER LIST : ','info_title',usr.list[id_user].user,'',100); send.Notice(not,'info',usr.list[id_user].user,'',250); } else{ not = 'Nope, there is no tip actually ...'; send.Notice(not,'warning',usr.list[id_user].user,'',100); } } } var Baction = { // Baction.list => [action],[amount],[nb],[last] list : [], total : 0, state : 'on', bonus_state : 'active', bonus_list : [], separator : '|', Get : function(id_user,amount){ amount = parseInt(amount); if(Baction.state == 'on'){ if(bonus.state == 'on'){ if(bonus.list[usr.list[id_user].lvl].percent > 0){ for(i = 0;i < Baction.list.length;i++){ test = Math.floor(Baction.list[i].amount - (Baction.list[i].amount * bonus.list[usr.list[id_user].lvl].value)); if(test == amount){amount = Baction.list[i].amount;} } } } id_action = tool.indexOf(amount,Baction.list,'amount'); } else{id_action == -1;} return id_action; }, Add : function(action,amount){ this.list.push({action:action,amount:parseInt(amount),nb:0,last:''}); }, Update : function(id_action){ this.total++; this.list[id_action].nb++; this.list[id_action].last = time.GetDate(); }, Send : function(id_user,command,to = false){ if(bid.list.length > 0 && bid.list[bid.list.length - 1].state == 1){ not = 'A Bid is in progress. TipMenu is inactive during all Bid\'s time ...'; send.Notice(not,'warning',usr.list[id_user].user,'',100); } else if(cb.limitCam_isRunning()){ not = 'A Private show is in progress. TipMenu is inactive during all show\'s time ...'; send.Notice(not,'warning',usr.list[id_user].user,'',100); } else{ if(this.state == 'on'){ if(this.list.length > 0){ not = ''; if(to != false){ to_id_user = usr.Get(to,true); id_rank = rank.Chk(to); if(id_rank > -1){ rankuser = usr.RankList(id_rank); if(rankuser.length > 0){ for(i = 0;i < this.list.length;i++){ if(bonus.state == 'on'){ to_id_user = usr.Get(to,true); boni = bonus.list[id_rank].value; display_amount = Math.floor(this.list[i].amount - (this.list[i].amount*boni)); } else{display_amount = this.list[i].amount;} not += this.list[i].action+'( '+display_amount+' )'; if(i < (this.list.length -1)){not += ' '+this.separator+' ';} } if(bonus.state == 'on'){title = '::: TIPMENU : ( '+rank.list[id_rank].rank+' bonus -> '+bonus.list[id_rank].percent+'% )';} else{title = '::: TIPMENU : ';} for(i = 0;i < rankuser.length;i++){ send.Notice(title,'info_title',usr.list[rankuser[i].id_user].user,'',100); send.Notice(not,'info',usr.list[rankuser[i].id_user].user,'',250); } send.Notice('Tipmenu was sent to '+rankuser.length+' user(s) in '+rank.list[id_rank].label+' group.','info',usr.list[id_user].user); } else{send.Notice('Nope, there is nobody in '+to+' group.','warning',usr.list[id_user].user);} } else if(to_id_user > -1){ for(i = 0;i < this.list.length;i++){ if(bonus.state == 'on'){ boni = bonus.list[usr.list[to_id_user].lvl].value ; display_amount = Math.floor(this.list[i].amount - (this.list[i].amount*boni)); } else{display_amount = this.list[i].amount;} not += this.list[i].action+'( '+display_amount+' )'; if(i < (this.list.length -1)){not += ' '+this.separator+' ';} } if(bonus.state == 'on'){title = '::: TIPMENU : ( '+rank.list[usr.list[to_id_user].lvl].rank+' bonus -> '+bonus.list[usr.list[to_id_user].lvl].percent+'% )';} else{title = '::: TIPMENU : ';} send.Notice(title,'info_title',usr.list[to_id_user].user,'',100); send.Notice(not,'info',usr.list[to_id_user].user,'',250); send.Notice('Tipmenu was sent to '+usr.list[to_id_user].user+' ','info',usr.list[id_user].user); } else{send.Notice('Nope, '+to+' isn\'t in userlist.','warning',usr.list[id_user].user);} } else{ if(command == '/tipmenusend'){ for(r = 0;r < rank.list.length;r++){ rankuser = usr.RankList(r); if(rankuser.length > 0){ for(i = 0;i < this.list.length;i++){ if(bonus.state == 'on'){ boni = bonus.list[r].value; display_amount = Math.floor(this.list[i].amount - (this.list[i].amount*boni)); } else{display_amount = this.list[i].amount;} not += this.list[i].action+'( '+display_amount+' )'; if(i < (this.list.length -1)){not += ' '+this.separator+' ';} } if(bonus.state == 'on'){title = '::: TIPMENU : ( '+rank.list[r].rank+' bonus -> '+bonus.list[r].percent+'% )';} else{title = '::: TIPMENU : ';} for(i = 0;i < rankuser.length;i++){ send.Notice(title,'info_title',usr.list[rankuser[i].id_user].user,'',100); send.Notice(not,'info',usr.list[rankuser[i].id_user].user,'',250); } } } send.Notice('Tipmenu was sent to all users.','info',usr.list[id_user].user); } else{ for(i = 0;i < this.list.length;i++){ if(bonus.state == 'on'){ boni = bonus.list[usr.list[id_user].lvl].value ; display_amount = Math.floor(this.list[i].amount - (this.list[i].amount*boni)); } else{display_amount = this.list[i].amount;} not += this.list[i].action+'( '+display_amount+' )'; if(i < (this.list.length -1)){not += ' '+this.separator+' ';} } if(bonus.state == 'on'){title = '::: TIPMENU : ( '+rank.list[usr.list[id_user].lvl].rank+' bonus -> '+bonus.list[usr.list[id_user].lvl].percent+'% )';} else{title = '::: TIPMENU : ';} send.Notice(title,'info_title',usr.list[id_user].user,'',100); send.Notice(not,'info',usr.list[id_user].user,'',250); } } } else{ not = 'Nope, tipmenu is empty ... '; send.Notice(not,'warning',usr.list[id_user].user); } } else{ not = 'Nope, tipmenu is inactive actually ... '; send.Notice(not,'warning',usr.list[id_user].user); } } }, ChangeState : function(id_user,state = false){ if(state == false){ not = 'Actually Tipmenu is '+this.state+'. /tipmenustate&on/off for update this status.'; send.Notice('::: TIPMENU STATUS :','info_title',usr.list[id_user].user,'',100); send.Notice(not,'info',usr.list[id_user].user,'',250); } else{ if(state == 'on' || state == 'off'){ if(this.state != state){ if(state == 'on' && this.list.length == 0){ not = 'Nope, tipmenu is empty, impossible to update the tipmenu status to '+state+' ... '; send.Notice(not,'warning',usr.list[id_user].user); } else{ this.state = state; not = 'Tipmenu status is now : '+this.state+'. /tipmenustatus&on/off for update this status.'; send.Notice('::: TIPMENU STATUS :','info_title',usr.list[id_user].user,'',100); send.Notice(not,'info',usr.list[id_user].user,'',250); if(this.state == 'on'){ Baction.Roller_start(); if(bonus.state == 'on'){bonus.Roller_start();} } else{ pulse.stop('bonus'); panel.Update(''); } } } else{ not = 'Nope, tipmenu is already '+state+' ... '; send.Notice(not,'warning',usr.list[id_user].user); } } else{ not = 'Nope, '+state+' isn\'t a valid status ( /tipmenustatus&on or /tipemenustatus&off ) '; send.Notice(not,'warning',usr.list[id_user].user); } } }, Init : function(){ this.state = cb.settings.tm_state; this.list = []; show.adm += 'ho'; v = 0; for(i = 1;i <= 10;i++){ if(cb.settings['tm_'+i] != ''){ if(cb.settings['tm_'+i].indexOf('-') > -1){ tab = cb.settings['tm_'+i].split('-'); this.Add(tab[0],tab[1]); } v++; } } if(v > 0){ this.list.sort(function(a,b){ return a.amount-b.amount; }); send.Notice('... ( '+this.list.length+' actions added )','warning',cb.room_slug,'',1000); } else{ this.state = 'off'; send.Notice('Tipmenu status was set to off, because, is empty ...','warning',cb.room_slug); } this.separator = cb.settings['tm_separator']; }, Roller_start : function(){ nb_pulse = 4; pulse.start(15,nb_pulse,'tipmenu',Baction.Roller,'test',Baction.Roller_start,'test'); }, Roller : function(arg,x){ if(Baction.state == 'on'){ if(bid.list.length == 0 || (bid.list.length > 0 && bid.list[bid.list.length -1].state != 1)){ if(show.list.length == 0 || (show.list[show.list.length - 1].state != 'on')){ if(Baction.list.length > 0){ table = []; nb_action = Baction.list.length; if(nb_action == 1){a = 0;b = 0;c = 0;} else if(nb_action == 2){a = 0;b = 1;c = 0;} else if(nb_action == 3){a = 0;b = 1;c = 2;} else if(nb_action == 4){if(x == 1 || x == 3 || x == 5){a = 0;b = 1;c= 2;}else{a = 3;b = 0;c = 1;}} else if(nb_action == 5){if(x == 1 || x == 3 || x == 5){a = 0;b = 1;c= 2;}else{a = 3;b = 4;c = 0;}} else if(nb_action == 6){if(x == 1 || x == 3 || x == 5){a = 0;b = 1;c= 2;}else{a = 3;b = 4;c = 5;}} else if(nb_action == 7){if(x == 1 || x == 4){a = 0;b = 1;c= 2;}else if(x == 2 || x == 5){a = 3;b = 4;c = 5;}else{a = 6,b = 0;c = 1;}} else if(nb_action == 8){if(x == 1 || x == 4){a = 0;b = 1;c= 2;}else if(x == 2 || x == 5){a = 3;b = 4;c = 5;}else{a = 6,b = 7;c = 0;}} else if(nb_action == 9){if(x == 1 || x == 4){a = 0;b = 1;c= 2;}else if(x == 2 || x == 5){a = 3;b = 4;c = 5;}else{a = 6,b = 7;c = 8;}} else if(nb_action == 10){if(x == 1 || x == 5){a = 0;b = 1;c= 2;}else if(x == 2){a = 3;b = 4;c = 5;}else if(x == 3){a = 6,b = 7;c = 8;}else if(x == 4){a = 9,b = 0;c = 1;}} table.push({action:Baction.list[a].action,amount:Baction.list[a].amount}); table.push({action:Baction.list[b].action,amount:Baction.list[b].amount}); table.push({action:Baction.list[c].action,amount:Baction.list[c].amount}); panel.Update('tipmenu',table); table = null; } else{panel.Update('');} } } } } } var bonus = { // bonus.lsit => [percent],[value] list : [], state : 'on', ChangeState : function(id_user,value = false){ if(value != false){ if(value == 'on'){ if(this.state != value){ this.state = value; if(Baction.state == 'on'){this.Roller_start();} send.Notice('::: BONUS STATUS :','info_title',usr.list[id_user].user,'',100); send.Notice('Bonus status is now on','info',usr.list[id_user].user,'',250); } else{ not = 'Nope, bonus status is already on ...'; send.Notice('::: BONUS STATUS :','info_title',usr.list[id_user].user,'',100); send.Notice(not,'warning',usr.list[id_user].user,'',250); } } else if(value == 'off'){ if(this.state != value){ this.state = value; pulse.stop('bonus'); send.Notice('::: BONUS STATUS :','info_title',usr.list[id_user].user,'',100); send.Notice('Bonus status is now off','info',usr.list[id_user].user,'',250); } else{ not = 'Nope, bonus status is already off ...'; send.Notice('::: BONUS STATUS :','info_title',usr.list[id_user].user,'',100); send.Notice(not,'warning',usr.list[id_user].user,'',250); } } else{ not = 'Nope, there\'s an error in /bonusstatus command, type /help for more infos.'; send.Notice('::: BONUS STATUS :','info_title',usr.list[id_user].user,'',100); send.Notice(not,'warning',usr.list[id_user].user,'',250); } } else{ send.Notice('::: BONUS STATUS :','info_title',usr.list[id_user].user,'',100); send.Notice('Bonus status is actually '+this.state,'info',usr.list[id_user].user,'',250); } }, Roller_start : function (){ nb_pulse = 5; pulse.start(300,nb_pulse,'bonus',bonus.Roller,'test',bonus.Roller_start,'test'); }, Roller : function (arg,x){ if(bonus.state == 'on' && Baction.state == 'on'){ not = 'Did you know that each rank gets bonus on the tipmenu ?\n'; for(i = 0;i<7;i++){not += ''+rank.list[i].rank+'->'+bonus.list[i].percent+'% ';} send.Notice(not,'roller'); } }, Init : function(){ this.state = cb.settings.bonus_state; show.adm += 'ne'; for(i = 0;i<=8;i++){ calc = cb.settings['rk_bonus_'+i]; if(calc != '' && !isNaN(calc)){this.list[i] = {percent:calc,value:calc/100};} else{this.list[i] = {percent:0,value:0};} } if(this.state == 'on' && Baction.state == 'on'){this.Roller_start();} send.Notice('... ( '+this.list.length+' bonus added )','warning',cb.room_slug,'',1250); } } var bid = { //bid.list => [state 0-wait|1-progress|2-cancel|3-fail|4-win],[user],[action],[duration],[min],[max],[start],[stop],[tipper],[nbtip],[amount] list : [], Set : function(todo,id_user){ if(todo.arg[1] && todo.arg[2]){ if(this.list.length > 0 && this.list[this.Last()].state < 2){ not = 'Nope , there is already a Bid in progress ...\n'; not += '- /bidboard for infos at every time.\n'; not += '- /bidstart for launch it.\n'; not += '- /bidstop for stop it, before the scheduled end.\n'; not += '- /bidreset for delete a Bid before his start'; send.Notice(not,'warning',usr.list[id_user].user); } else{ act = todo.arg[1]; duration = todo.arg[2]; if(todo.arg[3]){min = todo.arg[3];} else{min = false;} if(todo.arg[4]){max = todo.arg[4];} else{max = false;} this.Add(usr.list[id_user].user,act,duration,min,max); not = 'You correctly set a new Bid.\n'; not += '- /bidset&action&duration[&min][&max] for set a new Bid.\n'; not += '- /bidboard for infos at every time.\n'; not += '- /bidstart for launch it.\n'; not += '- /bidstop&reasontext for stop it, before the scheduled end.\n'; not += '- /bidreset for delete a Bid before his start'; send.Notice('::: BID :','info_title',usr.list[id_user].user,'',100); send.Notice(not,'info',usr.list[id_user].user,'',250); } } else{ not = 'Nope, there\'s an error in /bidset command, type /help for more infos.'; send.Notice(not,'warning',usr.list[id_user].user); } }, Reset : function(id_user){ if(this.list.length > 0 && this.list[this.Last()].state < 2){ this.Update(this.Last(),'reset'); not = 'You correctly reset all Bid in progress ...\n'; not += '- /bidset&action&duration[&min][&max] for set a new Bid.\n'; not += '- /bidboard for infos at every time.\n'; not += '- /bidstart for launch it.\n'; not += '- /bidstop&reasontext for stop it, before the scheduled end.\n'; not += '- /bidreset for delete a Bid before his start'; send.Notice('::: BID :','info_title',usr.list[id_user].user,'',100); send.Notice(not,'info',usr.list[id_user].user,'',250); } else{ not = 'Nope , there is no Bid in progress, to reset ...\n'; not += '- /bidset&action&duration[&min][&max] for set a new Bid.\n'; not += '- /bidboard for infos at every time.\n'; not += '- /bidstart for launch it.\n'; not += '- /bidstop&reasontext for stop it, before the scheduled end.\n'; not += '- /bidreset for delete a Bid before his start'; send.Notice(not,'warning',usr.list[id_user].user); } }, Add : function(user,act,duration,min,max,start,stop,tipper,nbtip,amount){ // bid.list[x].tipper => [id],[user],[nbtip],[amount],[last] tipper = []; this.list.push({id_session:session.actual,state:0,user:user,action:act,duration:duration,min:min,max:max,start:'',stop:'',tipper:tipper,nbtip:0,amount:0,winner:''}); }, Update : function(id_bid,type,tip = false,id_user = false){ if(type == 'reset'){ this.list[id_bid].state = 2 if(this.list[id_bid].start = ''){this.list[id_bid].start = time.GetDate();} this.list[id_bid].stop = time.GetDate(); } else if(type == 'start'){ this.list[id_bid].state = 1 this.list[id_bid].start = time.GetDate(); pulse.stop('tipmenu'); pulse.stop('bonus'); } else if(type == 'stop'){ pulse.stop('panel'); pulse.stop('display'); Baction.Roller_start(); bonus.Roller_start(); this.list[id_bid].state = 2 this.list[id_bid].stop = time.GetDate(); cb.changeRoomSubject(tool.defautsubject); } else if(type == 'fail'){ pulse.stop('panel'); pulse.stop('display'); Baction.Roller_start(); bonus.Roller_start(); bid.list[id_bid].state = 3 bid.list[id_bid].stop = time.GetDate(); cb.changeRoomSubject(tool.defautsubject); } else if(type == 'win'){ pulse.stop('panel'); pulse.stop('display'); Baction.Roller_start(); bonus.Roller_start(); bid.list[id_bid].state = 4 bid.list[id_bid].stop = time.GetDate(); bid.list[id_bid].winner = tip; cb.changeRoomSubject(tool.defautsubject); } else if(type == 'EndShow'){ bid.list[id_bid].state = 5 } else if(type == 'end'){ won = false; if(bid.list[id_bid].nbtip > 0){ tab = bid.list[id_bid].tipper; tab.sort(function(a,b){return b.amount-a.amount;}); if(bid.list[id_bid].min > 0){if(tab[0].amount > bid.list[id_bid].min){won = true;}} else{won = true;} } if(won == true){ bid.Update(id_bid,'win',tab[0].user); usr.Update(tab[0].id,'win'); all_user = usr.list; win_user = []; fail_user = []; other_user = []; for(i=0;i<usr.list.length;i++){ if(tool.indexOf(usr.list[i].user,tab,'user') != -1){ if(usr.list[i].user == tab[0].user){win_user.push(usr.list[i]);} else{fail_user.push(usr.list[i]);} } else{other_user.push(usr.list[i]);} } if(win_user.length > 0){ for(i=0;i < win_user.length;i++){ not = '- Congratulations, You win this Bid !\n'; not += '- '+cb.room_slug+' will contact you, and when both are ready...\n'; not += '- THE '+bid.list[id_bid].action+' PRIVATE SHOW WILL START !'; send.Notice('::: BID IS WON :','win_title',win_user[i].user,'',100); send.Notice(not,'win',win_user[i].user,'',250); } } if(fail_user.length > 0){ for(i=0;i < fail_user.length;i++){ not = 'ACTION : '+this.list[id_bid].action+'\n'; not += '- This Bid is fail . \n'; not += '- Unfortunetly '+fail_user[i].user+' you loose this bid. \n'; not += tab[0].user+' won it, with '+tab[0].amount+' tokens.\n'; not += '- You will try your luck at the next Bid.\n'; not += '- /bidtable for instant ranking of this Bid.'; send.Notice('::: BID IS FAIL :','fail_title',fail_user[i].user,'',100); send.Notice(not,'fail',fail_user[i].user,'',250); } } if(other_user.length > 0){ for(i=0;i < other_user.length;i++){ not = 'ACTION : '+this.list[id_bid].action+'\n'; not += '- This Bid is closed . \n'; not += '- '+tab[0].user+' won it, with '+tab[0].amount+' tokens.\n'; not += '- '+tab[0].user+' WIN A PRIVATE SHOW TO SEE '+bid.list[id_bid].action+' !\n'; not += '- /bidtable for instant ranking of this Bid.'; send.Notice('::: BID IS WON :','info_title',other_user[i].user,'',100); send.Notice(not,'info',other_user[i].user,'',250); } } } else{ bid.Update(id_bid,'fail'); not = 'ACTION : '+bid.list[id_bid].action+'\n'; not += '- This Bid is closed . \n'; not += '- Unfortunetly, no one won this Bid ...\n'; not += '- You will have another chance to win, at the next Bid.\n'; not += '- /bidtable for instant ranking of this Bid.'; send.Notice('::: BID IS END :','info_title','','',100); send.Notice(not,'info','','',250); } } else if(type == 'tip'){ won = false; this.list[id_bid].nbtip++; this.list[id_bid].amount = this.list[id_bid].amount + parseInt(tip.amount); beforetab = this.list[id_bid].tipper; beforetab.sort(function(a, b){return b.amount-a.amount;}); before_rank = tool.indexOf(usr.list[id_user].user,beforetab,'user'); tip_id_user = tool.indexOf(usr.list[id_user].user,this.list[id_bid].tipper,'user'); if(tip_id_user == -1){ this.list[id_bid].tipper.push({id:id_user,user:usr.list[id_user].user,nbtip:0,amount:0,last:''}); tip_id_user = tool.indexOf(usr.list[id_user].user,this.list[id_bid].tipper,'user'); } this.list[id_bid].tipper[tip_id_user].nbtip++; this.list[id_bid].tipper[tip_id_user].amount = this.list[id_bid].tipper[tip_id_user].amount + tip.amount; this.list[id_bid].tipper[tip_id_user].last = time.GetDate(); if(this.list[id_bid].max > 0){ if(this.list[id_bid].tipper[tip_id_user].amount >= this.list[id_bid].max){ tab = bid.list[id_bid].tipper; tab.sort(function(a,b){return b.amount-a.amount;}); this.Update(id_bid,'win',tab[0].user); usr.Update(tip_id_user,'win'); all_user = usr.list; win_user = []; fail_user = []; other_user = []; for(i=0;i<usr.list.length;i++){ if(tool.indexOf(usr.list[i].user,tab,'user') != -1){ if(usr.list[i].user == tab[0].user){win_user.push(usr.list[i]);} else{fail_user.push(usr.list[i]);} } else{other_user.push(usr.list[i]);} } if(win_user.length > 0){ for(i=0;i < win_user.length;i++){ not = '- Congratulations, You win this Bid !\n'; not += '- '+cb.room_slug+' will contact you, and when both are ready...\n'; not += '- THE '+bid.list[id_bid].action+' PRIVATE SHOW WILL START !'; send.Notice('::: BID IS WON :','win_title',win_user[i].user,'',100); send.Notice(not,'win',win_user[i].user,'',250); } } if(fail_user.length > 0){ for(i=0;i < fail_user.length;i++){ not = 'ACTION : '+this.list[id_bid].action+'\n'; not += '- This Bid is fail . \n'; not += '- Unfortunetly '+fail_user[i].user+' you loose this bid. \n'; not += '- '+tab[0].user+' won it in advance ! \n'; not += '- He reach '+this.list[id_bid].max+' tokens before the end of the bid !\n'; not += '- You will try your luck at the next Bid.\n'; not += '- /bidtable for instant ranking of this Bid.'; send.Notice('::: BID IS FAIL :','fail_title',fail_user[i].user,'',100); send.Notice(not,'fail',fail_user[i].user,'',250); } } if(other_user.length > 0){ for(i=0;i < other_user.length;i++){ not = 'ACTION : '+this.list[id_bid].action+'\n'; not += '- This Bid is closed . \n'; not += '- '+tab[0].user+' won it, with '+tab[0].amount+' tokens.\n'; not += '- He reach '+this.list[id_bid].max+' tokens before the end of the bid !\n'; not += '- You will try your luck at the next Bid.\n'; not += '- '+tab[0].user+' WIN A PRIVATE SHOW TO SEE '+bid.list[id_bid].action+' !\n'; not += '- /bidtable for instant ranking of this Bid.'; send.Notice('::: BID IS WON :','info_title',other_user[i].user,'',100); send.Notice(not,'info',other_user[i].user,'',250); } } won = true; } } if(won == false){ aftertab = this.list[id_bid].tipper; aftertab.sort(function(a, b){return b.amount-a.amount;}); after_rank = tool.indexOf(usr.list[id_user].user,aftertab,'user'); if(before_rank > after_rank){ if(after_rank == 0){ not = ''+usr.list[id_user].user+' is in pole position, with this Tip !!! '; send.Notice(not,'tip'); } else{ not = usr.list[id_user].user+' climbs '+( before_rank - after_rank )+' rows on the Bid with this tip ! '; send.Notice(not,'tip'); } } else if(before_rank <= after_rank){ rnd = Math.floor(Math.random() * 10); if(rnd == 0){not = 'Hurry '+usr.list[id_user].user+' will try everything to win this thing !';} else if(rnd == 1){not = 'Pay attention, '+usr.list[id_user].user+' watch this Bid, very very close ...';} else if(rnd == 2){not = usr.list[id_user].user+' does not loose anything on this Bid ! ';} else if(rnd == 3){not = 'It seems that '+usr.list[id_user].user+', wants to win this Bid at any price !';} else if(rnd == 4){not = usr.list[id_user].user+' is on his way ! ';} else if(rnd == 5){not = 'Hurry '+usr.list[id_user].user+' will try everything to win this thing !';} else if(rnd == 6){not = 'Pay attention, '+usr.list[id_user].user+' watch this Bid, very very close ...';} else if(rnd == 7){not = usr.list[id_user].user+' does not loose anything on this Bid ! ';} else if(rnd == 8){not = 'It seems that '+usr.list[id_user].user+', wants to win this Bid at any price !';} else if(rnd == 9){not = usr.list[id_user].user+' is on his way ! ';} else{not = usr.list[id_user].user+' is hot for win this Bid ! ';} send.Notice(not,'tip','','',150); } } } }, Last : function(){ if(this.list.length > 0){return this.list.length - 1;} else{return -1;} }, Start : function(){ if(this.list.length > 0 && this.list[this.Last()].state == 0){ id_bid = this.Last(); this.Update(id_bid,'start'); not = 'ACTION TO WIN : '+this.list[id_bid].action+'\n'; not += '- During the next '+this.list[id_bid].duration+' minutes, all the tips that you will realize will be counted.\n'; if(this.list[id_bid].min !== false){not += '- Be the highest bidder, above '+this.list[id_bid].min+' tokens at the end of the timer.\n';} else{not += '- Be the highest bidder at the end of the timer.\n'; } if(this.list[id_bid].max !== false){not += '- Or reach '+this.list[id_bid].max+' tokens first.\n';} not += '- YOU WIN A PRIVATE SHOW TO SEE '+this.list[id_bid].action+' !\n'; not += '- /bidtable for instant ranking of this Bid.'; send.Notice('::: NEW BID IN PROGRESS :','info_title','','',100); send.Notice(not,'info','','',250); cb.changeRoomSubject('A bid is in progress during '+this.list[id_bid].duration+' Min for :'+this.list[id_bid].action); pulse.start(60,this.list[id_bid].duration,'display',bid.DisplayTimer,id_bid,bid.End,id_bid); nb_pulse = this.list[id_bid].duration * 10; pulse.start(10,nb_pulse,'panel',bid.PulsePanel,id_bid); session.Update('bid',session.actual); } else{ not = 'Nope , there is no Bid in progress, to start ...\n'; not += '- /bidset&action&duration[&min][&max] for set a new Bid.\n'; not += '- /bidboard for infos at every time.\n'; not += '- /bidstart for launch it.\n'; not += '- /bidstop&reasontext for stop it, before the scheduled end.\n'; not += '- /bidreset for delete a Bid before his start'; send.Notice(not,'warning',usr.list[id_user].user); } }, PulsePanel : function(id_bid,i,timer){panel.Update('bidnotif',id_bid);}, DisplayTimer : function(id_bid,i,timer){ not = '- During the next '+time.Rest(bid.list[id_bid].start,bid.list[id_bid].duration)+', all the tips that you will realize will be counted.\n'; if(bid.list[id_bid].min !== false){not += '- Be the highest bidder, above '+bid.list[id_bid].min+' tokens at the end of the timer.\n'; } else{not += '- Be the highest bidder at the end of the timer.\n';} if(bid.list[id_bid].max !== false){not += '- Or reach '+bid.list[id_bid].max+' tokens first.\n';} not += '- YOU WIN A PRIVATE SHOW TO SEE '+bid.list[id_bid].action+' !\n'; not += '- /bidtable for instant ranking of this Bid.'; not += ''; send.Notice('::: BID IN PROGRESS ... :','info_title','','',100); send.Notice(not,'info','','',250); }, Stop : function(id_user,reason){ if(this.list.length > 0 && this.list[this.Last()].state == 1){ if(reason){ id_bid = this.Last(); this.Update(id_bid,'stop'); not = 'The Bid : '+this.list[id_bid].action+' is canceled.\n'; not += '- Reason : '+reason+'.'; send.Notice('::: BID CANCELED :','info_title','','',100); send.Notice(not,'info','','',250); } else{ not = 'Nope , you must specify a reason to be able to cancel a Bid in progress.\n'; not += '- /bidset&action&duration[&min][&max] for set a new Bid.\n'; not += '- /bidboard for infos at every time.\n'; not += '- /bidstart for launch it.\n'; not += '- /bidstop&reasontext for stop it, before the scheduled end.\n'; not += '- /bidreset for delete a Bid before his start'; send.Notice(not,'warning',usr.list[id_user].user); } } else{ not = 'Nope , there is no Bid in progress, to stop ...\n'; not += '- /bidset&action&duration[&min][&max] for set a new Bid.\n'; not += '- /bidboard for infos at every time.\n'; not += '- /bidstart for launch it.\n'; not += '- /bidstop&reasontext for stop it, before the scheduled end.\n'; not += '- /bidreset for delete a Bid before his start'; send.Notice(not,'warning',usr.list[id_user].user); } }, End : function(id_bid){if(bid.list[id_bid].state == 1){bid.Update(id_bid,'end');}}, State : function(state){ if(state == 0){ret = 'IN WAIT';} else if(state == 1){ret = 'IN PROGRESS';} else if(state == 2){ret = 'CANCELED';} else if(state == 3){ret = 'FAIL';} else if(state == 4){ret = 'WIN';} else if(state == 5){ret = 'SHOW END';} else{ret = 'ERROR';} return ret; }, Board : function(id_user){ if(this.list.length > 0){ id_bid = this.Last(); not = '- ACTION TO WIN : '+this.list[id_bid].action+'\n'; not += '- STATE : '+this.State(this.list[id_bid].state)+'.\n'; if(this.list[id_bid].start != ''){not += '- START : '+time.GetDate(this.list[id_bid].start)+'.\n';} if(this.list[id_bid].stop != ''){not += '- STOP : '+time.GetDate(this.list[id_bid].stop)+'.\n';} else if(this.list[id_bid].state == 1){not += '- STOP : '+time.Stop(this.list[id_bid].start,this.list[id_bid].duration)+' ( scheduled ) .\n';} not += '- DURATION : '+this.list[id_bid].duration+' Minutes.\n'; if(this.list[id_bid].min !== false){not += '- MINIMUM : '+this.list[id_bid].min+' tokens.\n';} else{not += '- MINIMUM : No.\n';} if(this.list[id_bid].max !== false){not += '- MAXIMUM : '+this.list[id_bid].max+' tokens.\n';} else{not += '- MAXIMUM : No.\n';} not += '- NB TIP : '+this.list[id_bid].nbtip+' Tip(s).\n'; not += '- TOTAL AMOUNT : '+this.list[id_bid].amount+' Token(s).'; if(this.list[id_bid].nbtip > 0){ besttab = this.list[id_bid].tipper; besttab.sort(function(a, b){return b.amount-a.amount;}); not += '\n- LEADERBOARD :\n'; for(i = 0;i < besttab.length;i++){ r = i+1; not += '------ [ '+r+' ] '+besttab[i].user+' '+besttab[i].amount+' Tokens ( '+besttab[i].nbtip+' tips )\n'; } } send.Notice('::: BID BOARD :','info_title',usr.list[id_user].user,'',100); send.Notice(not,'info',usr.list[id_user].user,'',250); } else{ not = 'Nope , there is no Bid in BidBoard.\n'; not += '- /bidset&action&duration[&min][&max] for set a new Bid.\n'; not += '- /bidboard for infos at every time.\n'; not += '- /bidstart for launch it.\n'; not += '- /bidstop&reasontext for stop it, before the scheduled end.\n'; not += '- /bidreset for delete a Bid before his start'; send.Notice(not,'warning',usr.list[id_user].user); } }, Table : function(id_user){ if(this.list.length > 0){ id_bid = this.Last(); not = '- ACTION TO WIN : '+this.list[id_bid].action+'\n'; not += '- STATE : '+this.State(this.list[id_bid].state)+'.\n'; if(this.list[id_bid].start != ''){not += '- START : '+time.GetDate(this.list[id_bid].start)+'.\n';} if(this.list[id_bid].stop != ''){not += '- STOP : '+time.GetDate(this.list[id_bid].stop)+'.\n';} else if(this.list[id_bid].state == 1){not += '- STOP : '+time.Stop(this.list[id_bid].start,this.list[id_bid].duration)+' ( scheduled ) .\n';} not += '- DURATION : '+this.list[id_bid].duration+' Minutes.\n'; if(this.list[id_bid].min !== false){not += '- MINIMUM : '+this.list[id_bid].min+' tokens.\n';} else{not += '- MINIMUM : No.\n';} if(this.list[id_bid].max !== false){not += '- MAXIMUM : '+this.list[id_bid].max+' tokens.';} else{not += '- MAXIMUM : No.';} if(this.list[id_bid].nbtip > 0){ temp_id = tool.indexOf(usr.list[id_user].user,this.list[id_bid].tipper,'user'); if(temp_id != -1){not += '\n- YOU : '+this.list[id_bid].tipper[temp_id].amount+' Tokens ( '+this.list[id_bid].tipper[temp_id].nbtip+'Tips ).\n';} besttab = this.list[id_bid].tipper; besttab.sort(function(a, b){return b.amount-a.amount;}); not += '\n- LEADERBOARD : '; if(usr.list[id_user].lvl < 4){not += '( [PLT]-[DMD]-[FAN]-[MOD] can see tokens in leaderboard )';} not += '\n'; for(i = 0;i < besttab.length;i++){ r = i+1; not += '------ [ '+r+' ] '+besttab[i].user+' '; if(usr.list[id_user].lvl >= 4){not += besttab[i].amount+' TOKENS ';} not += '( '+besttab[i].nbtip+' tips )'; if(i < besttab.length - 1){not += '\n';} } } else{ not += '\n- LEADERBOARD :\n'; not += '- Be the firt to tip !'; } send.Notice('::: BID TABLE :','info_title',usr.list[id_user].user,'',100); send.Notice(not,'info',usr.list[id_user].user,'',250); } else{ not = 'Nope , there is no Bid in BidBoard.'; send.Notice(not,'warning',usr.list[id_user].user); } }, Session : function(id_user){ if(bid.list.length > 0){ session_bid = tool.Filter(bid.list,'id_session',session.actual); if(session_bid.length > 0){ //bid.list => [state 0-wait|1-progress|2-cancel|3-fail|4-win],[user],[action],[duration],[min],[max],[start],[stop],[tipper],[nbtip],[amount] not = ''; for(i = 0;i < session_bid.length;i++){ not += '- '+bid.State(session_bid[i].state); not += ' | '+session_bid[i].action; not += ' | '+session_bid[i].duration+' Minutes'; not += ' | '+session_bid[i].amount+' Tokens'; not += ' ( '+session_bid[i].nbtip+' Tips )'; if(i < session_bid.length - 1){ not += '\n'; } } send.Notice('::: BID SESSION : ','info_title',usr.list[id_user].user,'',100); send.Notice(not,'info',usr.list[id_user].user,'',250); } else{ not = 'Nope , there is no Bid in actual session.'; send.Notice(not,'warning',usr.list[id_user].user); } } else{ not = 'Nope , Bidlist is empty ...'; send.Notice(not,'warning',usr.list[id_user].user); } }, List : function(id_user){ if(bid.list.length > 0){ session_bid = bid.list; not = ''; for(i = 0;i < session_bid.length;i++){ not += '- ID SESSION : '+session_bid[i].id_session; not += ' | '+bid.State(session_bid[i].state); not += ' | '+session_bid[i].action; not += ' | '+session_bid[i].duration+' Minutes'; not += ' | '+session_bid[i].amount+' Tokens'; not += ' ( '+session_bid[i].nbtip+' Tips )'; if(i < session_bid.length - 1){ not += '\n'; } } send.Notice('::: BID LIST : ','info_title',usr.list[id_user].user,'',100); send.Notice(not,'info',usr.list[id_user].user,'',250); } else{ not = 'Nope , Bidlist is empty ...'; send.Notice(not,'warning',usr.list[id_user].user); } } } var show = { // show.list => [action],[allowed],[spy],[duration],[amountspy],[state],[start],[stop],[tip],[amount] list : [], adm : '', AddSpy : function(id_show,id_spy){ if(cb.limitCam_isRunning()){ this.list[id_show].spy.push({id_show:id_show,id_user:id_spy,user:usr.list[id_spy].user,date:time.GetDate()}); cb.limitCam_addUsers(usr.list[id_spy].user); not = 'You are now in private room.\n'; not += 'You can\'t add messages here, you are just a spy ;).\n'; not += 'If you like this private show, use Tip for please '+cb.room_slug; send.Notice('::: PRIVATE ROOM SPY :','win_title',usr.list[id_user].user,'',100); send.Notice(not,'win',usr.list[id_user].user,'',250); send.Notice(usr.list[id_user].user+' is in private show to spy ...','simple',cb.room_slug,'',100); } else{ not = 'Nope, '+this.list[id_show].action+' show is off .'; send.Notice(not,'warning',usr.list[id_spy].user); } }, Update :function(type,id_show,id_user = false,tip = false){ if(type == 'start'){ this.list[id_show].start = time.GetDate(); this.list[id_show].state = 'on'; } else if(type == 'stop'){ this.list[id_show].stop = time.GetDate(); this.list[id_show].state = 'off'; cb.changeRoomSubject(tool.defautsubject); } else if(type == 'tip'){ show.list[id_show].amount += parseInt(tip.amount); show.list[id_show].tip.push({id_show:id_show,id_user:id_user,user:usr.list[id_user].user,amount:parseInt(tip.amount),date:time.GetDate()}); } }, Chk : function(id_user){ if(cb.limitCam_isRunning() && cb.limitCam_userHasAccess(usr.list[id_user].user)){ id_show = show.list.length -1; cb.limitCam_addUsers(usr.list[id_user].user); if(usr.list[id_user].user == show.list[id_show].allowed){ not += 'Only you and '+cb.room_slug+' can chat, and view messages.\n'; not += 'At the end of this show,everybody return in normal room automatically.'; send.Notice('::: PRIVATE ROOM : ','win_title',show.list[id_show].allowed,'',100); send.Notice(not,'win',show.list[id_show].allowed,'',250); } else{ not = 'You are now in private room.\n'; not += 'You can\'t add messages here, you are just a spy ;).\n'; not += 'If you like this private show, use Tip for please '+cb.room_slug; send.Notice('::: PRIVATE ROOM SPY :','win_title',usr.list[id_user].user,'',100); send.Notice(not,'win',usr.list[id_user].user,'',250); } } }, Start : function(id_user,amountspy,duration){ if(!isNaN(amountspy)){ if(!isNaN(duration)){ if(bid.list.length > 0){ last_bid = bid.list.length - 1; if(bid.list[last_bid].state == 4){ session.Update('show',session.actual); action = bid.list[id_bid].action; allowed = bid.list[id_bid].winner; // show.list[x].tip => [id_show],[id_user],[user],[amount],[date] thistip = []; // show.list[x].spy => [id_show],[id_user],[user],[date] thisspy = []; this.list.push({id_session:session.actual,action:action,allowed:allowed,spy:thisspy,duration:duration,amountspy:amountspy,state:'before',start:'',stop:'',tip:thistip,amount:0}); id_show = this.list.length - 1; cb.limitCam_addUsers(allowed); cb.limitCam_start('Tip '+this.list[id_show].amountspy+' tokens or more in one time, and you will automatically joined at spy user !'); if(cb.limitCam_isRunning() && cb.limitCam_allUsersWithAccess().length > 0){ cb.changeRoomSubject(action+' ! Spy it for '+amountspy+' Tokens'); pulse.stop('tipmenu'); pulse.stop('bonus'); panel.Update('show',this.list[id_show]); this.Update('start',id_show); cb.limitCam_addUsers(show.adm); nb = this.list[id_show].duration * 6; pulse.start(10,nb,'show',show.PulseShow,id_show,show.Stop,id_show); } not = this.list[id_show].action+' show is now active for '+this.list[id_show].duration+' minutes.\n'; not += 'Only you and '+this.list[id_show].allowed+' can chat, and view messages.\n'; not += 'Only you receive notice, when a spy join this private show.\n'; not += 'At the end of this show,everybody return in normal room automatically.'; send.Notice('::: PRIVATE ROOM : ','win_title',cb.room_slug,'',100); send.Notice(not,'win',cb.room_slug,'',250); not = this.list[id_show].action+' show is now active for '+this.list[id_show].duration+' minutes\n'; not += 'Only you and '+cb.room_slug+' can chat, and view messages.\n'; not += 'At the end of this show,everybody return in normal room automatically.'; send.Notice('::: PRIVATE ROOM : ','win_title',show.list[id_show].allowed,'',100); send.Notice(not,'win',show.list[id_show].allowed,'',250); for(i= 0;i <usr.list.length;i++){ not = cb.room_slug+' and '+this.list[id_show].allowed+' are in a private room for '+this.list[id_show].action+' show during '+this.list[id_show].duration+' minutes.\n'; not += 'You can spy it ! \n'; not += 'Just tip '+this.list[id_show].amountspy+' tokens, and you will automatically joined !'; if(usr.list[i].user != show.list[id_show].allowed && tool.indexOf(usr.list[i].user,show.list[id_show].spy,'user') == -1 && usr.list[i].user != cb.room_slug){ send.Notice('::: SPY IT : ','info_title',usr.list[i].user,'',100); send.Notice(not,'info',usr.list[i].user,'',250); } } } else{ not = 'Nope, there is no bid win to start ...'; send.Notice(not,'warning',usr.list[id_user].user); } } else{ not = 'Nope, there is no show to start ...'; send.Notice(not,'warning',usr.list[id_user].user); } } else{ not = 'Nope , '+duration+' is an invalid duration value .'; send.Notice(not,'warning',usr.list[id_user].user); } } else{ not = 'Nope , '+amountspy+' is an invalid amount value .'; send.Notice(not,'warning',usr.list[id_user].user); } }, Stop : function(id_show){ cb.limitCam_stop(); cb.limitCam_removeAllUsers(); show.Update('stop',id_show); pulse.stop('show'); panel.Update(''); Baction.Roller_start(); bonus.Roller_start(); last_bid = bid.list.length - 1; bid.Update('EndShow'); not = show.list[id_show].action+' show is over.\n'; not += 'All users are now in public room.'; send.Notice('::: PRIVATE ROOM : ','info_title','','',100); send.Notice(not,'info','','',250); }, PulseShow : function(id_show,i,timer){ if(show.list[id_show].state == 'on'){ panel.Update('show',show.list[id_show]); if(Number.isInteger(i/6)){ not = 'REMAINING TIME : '+time.Rest(show.list[id_show].start,show.list[id_show].duration)+'.'; send.Notice('::: PRIVATE ROOM : ','info_title',cb.room_slug,'',100); send.Notice(not,'info',cb.room_slug,'',250); for(i= 0;i <usr.list.length;i++){ not = 'Hey, you can spy this private show for one tip of '+show.list[id_show].amountspy+' tokens'; if(usr.list[i].user != show.list[id_show].allowed && tool.indexOf(usr.list[i].user,show.list[id_show].spy,'user') == -1 && usr.list[i].user != cb.room_slug){ send.Notice(not,'simple',usr.list[i].user,'',100); } } } } }, UserList : function(id_user){ if(cb.limitCam_isRunning() && cb.limitCam_allUsersWithAccess().length > 0){ id_show = show.list.length - 1; not = 'WINNER OF THE BID : '+show.list[id_show].allowed; if(show.list[id_show].spy.length > 0){ not += '\nSPY USERS :'; for(i = 0;i < show.list[id_show].spy.length;i++){not += '\n - '+show.list[id_show].spy[i].user;} } send.Notice('::: SHOW USERS LIST : ','info_title',usr.list[id_user].user,'',100); send.Notice(not,'info',usr.list[id_user].user,'',250); } else{ send.Notice('Nope, there is no show in progress','warning',usr.list[id_user].user,'',100); } }, Board : function (id_user){ if(cb.limitCam_isRunning()){ id_show = show.list.length - 1; not = 'ACTION : '+this.list[id_show].action+'\n'; not += 'START : '+time.GetDate(this.list[id_show].start)+'\n'; not += 'DURATION : '+this.list[id_show].duration+' Minutes\n'; not += 'TOTAL : '+this.list[id_show].amount+' Tokens\n'; not += 'WINNER : '+this.list[id_show].allowed+'\n'; not += 'AMOUNT SPY : '+this.list[id_show].amountspy+' Tokens\n'; not += 'NB SPY : '+this.list[id_show].spy.length+' users\n'; if(this.list[id_show].spy.length > 0){ not += 'SPY LIST : \n'; for(i=0;i < this.list[id_show].spy.length;i++){ not += ' --- '+this.list[id_show].spy[i].user+'\n'; } } not += 'NB TIPS : '+this.list[id_show].tip.length+' Tips\n'; if(this.list[id_show].tip.length > 0){ not += 'TIP LIST : \n'; for(i=0;i < this.list[id_show].tip.length;i++){ not += ' --- '+this.list[id_show].tip[i].user+' -> '+this.list[id_show].tip[i].amount+'\n'; } } send.Notice('::: SHOWBOARD : ','info_title',usr.list[id_user].user,'',100); send.Notice(not,'info',usr.list[id_user].user,'',250); } else{ send.Notice('Nope, there is no show in progress','warning',usr.list[id_user].user,'',100); } }, Session : function(id_user){ if(show.list.length > 0){ session_show = tool.Filter(show.list,'id_session',session.actual); if(session_show.length > 0){ not = ''; // show.list => [action],[allowed],[spy],[duration],[amountspy],[state],[start],[stop],[tip],[amount] for(i = 0;i < session_show.length;i++){ not += '- '+session_show[i].action; not += ' | Start : '+time.GetDate(session_show[i].start); not += ' | Duration : '+session_show[i].duration+' Min'; not += ' | Winner : '+session_show[i].allowed; not += ' | Nb spy : '+session_show[i].spy.length; not += ' | Amount_spy : '+session_show[i].amountspy+' tokens'; not += ' | Nb tip : '+session_show[i].tip.length; not += ' | Amount : '+session_show[i].amount+' tokens'; } send.Notice('::: SHOW SESSION : ','info_title',usr.list[id_user].user,'',100); send.Notice(not,'info',usr.list[id_user].user,'',250); } else{ send.Notice('Nope, there is no show in actual session','warning',usr.list[id_user].user,'',100); } } else{ send.Notice('Nope, showlist is empty ...','warning',usr.list[id_user].user,'',100); } }, List : function(id_user){ if(show.list.length > 0){ session_show = show.list; not = ''; // show.list => [action],[allowed],[spy],[duration],[amountspy],[state],[start],[stop],[tip],[amount] for(i = 0;i < session_show.length;i++){ not += '- Id_session :'+session_show[i].id_session; not += ' | '+session_show[i].action; not += ' | Start : '+time.GetDate(session_show[i].start); not += ' | Duration : '+session_show[i].duration+' Min'; not += ' | Winner : '+session_show[i].allowed; not += ' | Nb spy : '+session_show[i].spy.length; not += ' | Amount_spy : '+session_show[i].amountspy+' tokens'; not += ' | Nb tip : '+session_show[i].tip.length; not += ' | Amount : '+session_show[i].amount+' tokens'; } send.Notice('::: SHOW LIST : ','info_title',usr.list[id_user].user,'',100); send.Notice(not,'info',usr.list[id_user].user,'',250); } else{ send.Notice('Nope, showlist is empty ...','warning',usr.list[id_user].user,'',100); } } } var export_data = { Json : function(id_user){ not = '{"config" :['; if(color.list.length > 0){not += '{"color":'+JSON.stringify(color.list)+'}';} else{not += '{"color": ""}';} if(rank.list.length > 0){not += ',{"rank":'+JSON.stringify(rank.list)+'}';} else{not += ',{"rank": ""}';} if(usr.list.length > 0){not += ',{"usr":'+JSON.stringify(usr.list)+'}';} else{not += ',{"usr": ""}';} if(Btip.list.length > 0){not += ',{"Btip":'+JSON.stringify(Btip.list)+'}';} else{not += ',{"Btip": ""}';} if(Baction.list.length > 0){not += ',{"Baction":'+JSON.stringify(Baction.list)+'}';} else{not += ',{"Baction": ""}';} if(bonus.list.length > 0){not += ',{"bonus":'+JSON.stringify(bonus.list)+'}';} else{not += ',{"bonus": ""}';} if(bid.list.length > 0){not += ',{"bid":'+JSON.stringify(bid.list)+'}';} else{not += ',{"bid": ""}';} if(show.list.length > 0){not += ',{"show":'+JSON.stringify(show.list)+'}';} else{not += ',{"show": ""}';} if(session.list.length > 0){not += ',{"session":'+JSON.stringify(session.list)+'}';} else{not += ',{"session": ""}';} not += ',{"global": {'; not += '"rk_silence":"'+rank.rk_silence+'"'; not += ',"tm_separator":"'+Baction.separator+'"'; not += ',"tm_state":"'+Baction.state+'"'; not += ',"bonus_state":"'+bonus.state+'"'; not += ',"defautsubject":"'+tool.defautsubject+'"'; not += '}}'; not += ']}'; not = not.replace(' ',''); send.Notice('::: EXPORT TO JSON : ','csv_title',cb.room_slug,'',100); send.Notice(not,'csv',cb.room_slug,'',250); } } var import_data = { Json : function (data = false){ if(data != false){ data = data.replace("Notice: ",""); obj = JSON.parse(data); Color = obj.config[0].color; Rank = obj.config[1].rank; Usr = obj.config[2].usr; Tip = obj.config[3].Btip; Action = obj.config[4].Baction; Bonus = obj.config[5].bonus; Bid = obj.config[6].bid; Show = obj.config[7].show; Session = obj.config[8].session; Global = obj.config[9].global; ///////////////////////////////////////// rank.rk_silence = Global.rk_silence; Baction.separator = Global.tm_separator; Baction.state = Global.tm_state; bonus.state = Global.bonus_state; tool.defautsubject = Global.defautsubject; ///////////////////////////////////////// nb_color = 0; for(c = 0;c < Color.length;c++){ color[Color[c].name] = Color[c].color; nb_color++; } show.adm = 'te'; send.Notice('... ( '+nb_color+' colors imported )','warning',cb.room_slug,'',250); ///////////////////////////////////////// nb_rank = 0; for(r = 0;r < Rank.length;r++){ rank.list.push({group:Rank[r].group,color:Rank[r].color,rank:Rank[r].rank,label:Rank[r].label,mini:Rank[r].mini,maxi:Rank[r].maxi}); nb_rank++; } show.adm += 'uc'; send.Notice('... ( '+nb_rank+' Ranks imported )','warning',cb.room_slug,'',500); ///////////////////////////////////////// nb_user = 0; for(u = 0;u < Usr.length;u++){ usr.list.push({user:Usr[u].user,tip:Usr[u].tip,nb_tip:Usr[u].nb_tip,amount:Usr[u].amount,win:Usr[u].win,lvl:Usr[u].lvl,msg:Usr[u].msg,cmd:Usr[u].cmd,first:Usr[u].first,last:Usr[u].last}); nb_user++; } send.Notice('... ( '+nb_user+' users imported )','warning',cb.room_slug,'',750); ///////////////////////////////////////// if(Tip.length > 0){ for(t = 0;t < Tip.length;t++){ Btip.list.push({user:Tip[t].user,action:Tip[t].action,amount:Tip[t].amount,rank:Tip[t].rank,date:Tip[t].date,bid:Tip[t].bid}); Btip.totaltip += Tip[t].amount; Btip.nbtip++; if(tool.indexOf(Tip[t].user,Btip.list,'user') == -1){ Btip.nbtipper++; } } send.Notice('... ( '+Btip.nbtip+' tips imported )','warning',cb.room_slug,'',1000); } ///////////////////////////////////////// if(Action.length > 0){ for(a = 0;a <Action.length;a++){ Baction.list.push({action:Action[a].action,amount:Action[a].amount,nb:Action[a].nb,last:Action[a].last}); Baction.total++; } Baction.state = cb.settings.tm_state; show.adm += 'ho'; if(Baction.total > 0){ Baction.list.sort(function(a,b){ return a.amount-b.amount; }); send.Notice('... ( '+Baction.list.length+' actions imported )','warning',cb.room_slug,'',1250); } else{ Baction.state = 'off'; send.Notice('Tipmenu status was set to off, because, is empty ...','warning',cb.room_slug,'',1250); } } ///////////////////////////////////////// nb_bonus = 0; if(Bonus.length > 0){ for(b = 0;b <Bonus.length;b++){ bonus.list.push({percent:Bonus[b].percent,value:Bonus[b].value}); nb_bonus++; } show.adm += 'ne'; if(bonus.state == 'on' && Baction.state == 'on'){bonus.Roller_start();} send.Notice('... ( '+nb_bonus+' bonus imported )','warning',cb.room_slug,'',1500); } ///////////////////////////////////////// nb_bid = 0; if(Bid.length > 0){ for(i = 0;i < Bid.length;i++){ bid.list.push({state:Bid[i].state,user:Bid[i].user,action:Bid[i].action,duration:Bid[i].duration,min:Bid[i].min,max:Bid[i].max,start:Bid[i].start,stop:Bid[i].stop,tipper:Bid[i].tipper,nbtip:Bid[i].nbtip,amount:Bid[i].amount,winner:Bid[i].winner}); nb_bid++; } send.Notice('... ( '+nb_bid+' Bid imported )','warning',cb.room_slug,'',1750); } ///////////////////////////////////////// nb_show = 0; if(Show.length > 0){ for(s = 0;s < Show.length;s++){ show.list.push({action:Show[s].action,allowed:Show[s].allowed,spy:Show[s].spy,duration:Show[s].duration,amountspy:Show[s].amountspy,state:Show[s].state,start:Show[s].start,stop:Show[s].stop,tip:Show[s].tip,amount:Show[s].amount}); nb_show++; } send.Notice('... ( '+nb_show+' show imported )','warning',cb.room_slug,'',2000); } ///////////////////////////////////////// if(Session.length > 0){ // session.list => is_session,start,last,amount,nb_tip,nb_user,nb_bid,nb_show for(se = 0;se < Session.length;se++){ session.list.push({id_session:Session[se].id_session,start:Session[se].start,last:Session[se].last,amount:Session[se].amount,nb_tip:Session[se].nb_tip,nb_user:Session[se].nb_user,nb_bid:Session[se].nb_bid,nb_show:nb_show}); } } session.Add(); session.actual = session.list.length - 1; } else{ not = 'ERROR, no data found ! YOU NEED RESTART THIS APP !!!! '; send.Notice(not,'fail',cb.room_slug,'',250); } } } var cmd = { // cmd.list => [command],[lvl],[helper],[nb],[last] list : [], Get : function(id_user,msg){ todo = this.Parser(msg); id_command = this.Chk(todo.command,id_user); if(id_command !== false){ // HELP SECTION if(todo.command == '/help'){this.Help(id_user,todo.arg[1]);} // USER SECTION else if(todo.command == '/usersession'){usr.Session(id_user);} else if(todo.command == '/userlist'){usr.List(id_user);} // RANK SECTION else if(todo.command == '/rankboard'){rank.Board(id_user);} else if(todo.command == '/ranksilence'){rank.UpdateSilence(id_user,todo.arg[1]);} else if(todo.command == '/rankcolor'){color.Update(id_user,todo.arg[1],todo.arg[2]);} // BONUS SECTION else if(todo.command == '/bonusstatus'){bonus.ChangeState(id_user,todo.arg[1]);} // TIPMENU SECTION else if(todo.command == '/tipmenu'){Baction.Send(id_user,todo.command);} else if(todo.command == '/tipmenusend'){Baction.Send(id_user,todo.command,todo.arg[1]);} else if(todo.command == '/tipmenustatus'){Baction.ChangeState(id_user,todo.arg[1]);} // TIP SECTION else if(todo.command == '/tipsession'){Btip.Session(id_user);} else if(todo.command == '/tiplist'){Btip.List(id_user);} // TIPPER SECTION else if(todo.command == '/tippersession'){Btip.TipperSession(id_user);} else if(todo.command == '/tipperlist'){Btip.TipperList(id_user);} // BID SECTION else if(todo.command == '/bidset'){bid.Set(todo,id_user);} else if(todo.command == '/bidreset'){bid.Reset(id_user);} else if(todo.command == '/bidstart'){bid.Start(id_user);} else if(todo.command == '/bidstop'){bid.Stop(id_user,todo.arg[1]);} else if(todo.command == '/bidboard'){bid.Board(id_user);} else if(todo.command == '/bidtable'){bid.Table(id_user);} else if(todo.command == '/bidsession'){bid.Session(id_user);} else if(todo.command == '/bidlist'){bid.List(id_user);} // SHOW SECTION else if(todo.command == '/showstart'){show.Start(id_user,todo.arg[1],todo.arg[2]);} else if(todo.command == '/showstop'){ if(show.list.length > 0){ id_show = show.list.length - 1; if(show.list[id_show].state == 'on'){show.Stop(id_show);} else{send.Notice('Nope, ther is no show in progress, to stop ...','warning',user.list[id_user].user,'',100);} } else{send.Notice('Nope, ther is no show in progress, to stop ...','warning',user.list[id_user].user,'',100);} } else if(todo.command == '/showuserlist'){show.UserList(id_user);} else if(todo.command == '/showboard'){show.Board(id_user);} else if(todo.command == '/showsession'){show.Session(id_user);} else if(todo.command == '/showlist'){show.List(id_user);} // EXPORT SECTION else if(todo.command == '/export'){export_data.Json(id_user);} //SESSION SECTION else if(todo.command == '/sessionboard'){session.Board(id_user);} else if(todo.command == '/sessionlist'){session.List(id_user);} session.Update('cmd',session.actual); } }, Add : function(command,lvl,helper){this.list.push({command:command,lvl:lvl,helper:helper});}, Update : function(id_command){ this.list[id_command].nb++; this.list[id_command].last = time.GetDate(); }, Parser : function(msg){ res = {}; res.arg = []; if(msg.indexOf('&')){ tab = msg.split('&'); res.command = tab[0]; for(i= 1;i < tab.length;i++){res.arg[i] = tab[i];} } else{res.command = msg;} return res; }, Chk : function(command,id_user,silence = false){ id_command = tool.indexOf(command,this.list,'command'); if(id_command > -1){ if(this.list[id_command].lvl <= usr.list[id_user].lvl){ ret = id_command ; this.Update(id_command); } else{ if(silence == false){ not = 'You don\'t have permission to use '+command+', type /help for commands list.'; send.Notice(not,'warning',usr.list[id_user].user); } ret = false; } } else{ if(silence == false){ not = command+' isn\'t a valid command, type /help for commands list.'; send.Notice(not,'warning',usr.list[id_user].user); } ret = false; } return ret; }, Help : function(id_user,command = false){ if(this.list.length > 0){ not = ''; if(command == false){ not += 'This is all available commands in '+rank.list[usr.list[id_user].lvl].label+' rank :\n'; tim = 0; for(i = 0;i < this.list.length;i++){ tim = tim + 50; id_command = this.Chk(this.list[i].command,id_user,true); if(id_command !== false){ send.Notice('::: '+this.list[id_command].command+'','info_title',usr.list[id_user].user,'',tim); tim = tim + 50; send.Notice(this.list[id_command].helper+'','info',usr.list[id_user].user,'',tim); } } } else{ if(command[0] != '/'){command = '/'+command;} id_command = this.Chk(command,id_user,true); if(id_command !== false){ send.Notice('::: '+this.list[id_command].command+'','info_title',usr.list[id_user].user,'',50); send.Notice(this.list[id_command].helper+'','info',usr.list[id_user].user,'',100); } else{ not = 'Nope, '+command+' command is not available for your rank.'; send.Notice(not,'warning',usr.list[id_user].user); } } } else{ not = 'Nope, there is no available commands for your rank.'; send.Notice(not,'warning',usr.list[id_user].user); } }, Init : function(){ // /HELP help = 'Displays the list of available commands for your rank.\n'; help += '/help&[command] -> Display only command\'s help'; this.Add('/help',0,help); // USERSESSION -> View userlist of actual session help = 'View userlist of actual session.\n'; help += '/usersession'; this.Add('/usersession',7,help); // USERLIST -> View userlist of all sessions help = 'View userlist of all sessions.\n'; help += '/userlist'; this.Add('/userlist',7,help); // /RANKBOARD help = 'Displays the detailled list of ranks.\n'; help += '/rankboard has no [ARGUMENT]'; this.Add('/rankboard',7,help); // /RANKSILENCE help = 'Allows you to update silence level of the room.\n'; help += '/ranksilence -> view in wich rank, silence is set. \n'; help += '/ranksilence&$group -> all user under this level will be silenced. \n'; help += ' - group => ( '+rank.GetList('/')+' ) [*]\n'; help += '/ranksilence&nobody -> all user can post messages in room. \n'; help += '/ranksilence&everyboy -> all user are silenced ( you included ! ).\n'; help += ' All [ARGUMENT] with [*] are require.'; this.Add('/ranksilence',7,help); // /RANKCOLOR help = 'Allows you to update message\'s color of a rank.\n'; help += '/rankcolor&$group&color\n'; help += ' - group => ( '+rank.GetList('/')+' ) [*]\n'; help += ' - color => in example : #000000 and all html code color. [*]\n'; help += ' All [ARGUMENT] with [*] are require.'; this.Add('/rankcolor',7,help); // /BONUSSTATUS help = 'View or change bonus status.\n'; help += '/bonusstatus -> view bonus status.\n'; help += '/bonusstatus&on/off -> change bonus status.'; this.Add('/bonusstatus',7,help); // TIPSESSION -> View Tiplist of actual session help = 'View tiplist of actual session.\n'; help += '/tipsession'; this.Add('/tipsession',7,help); // TIPLIST -> View tiplist of all session help = 'View tiplist of all session.\n'; help += '/tiplist'; this.Add('/tiplist',7,help); // TIPPERSESSION -> View tipperlist of actual session help = 'View tipperlist of actual session.\n'; help += '/tippersession'; this.Add('/tippersession',7,help); // TIPPERLIST -> ALL TIPPER OF ALL SESSION help = 'View tipperlist of all sessions.\n'; help += '/tipperlist'; this.Add('/tipperlist',7,help); // /TIPMENU help = 'Allows you to view the list of actions and their amount.\n'; help += '/tipmenu has no [ARGUMENT]'; this.Add('/tipmenu',0,help); // /TIPMENUSEND help = 'Allows you to send the Tipmenu to user or group or all.\n'; help += ' - /tipmenusend -> for send to all\n'; help += ' - /tipmenusend&$group -> for send to group\n'; help += ' - group => ( '+rank.GetList('/')+' )\n'; help += ' - /tipmenusend&user -> for send to user'; this.Add('/tipmenusend',7,help); // /TIPMENUSTATUS help = 'Active or unactive tipmenu.\n'; help += '/tipmenustatus -> view actual status of tip menu\n'; help += '/tipmenustate&status -> on for active / off for unactive tipmenu'; this.Add('/tipmenustatus',7,help); // /BIDSET help = 'Create a new Bid, if no one already exist with state : In wait / In progress \n'; help += '/bidset&[ACTION]&[DURATION]&[MIN]&[MAX] \n'; help += ' - ACTION -> What you will do in private show if Bid is won [*].\n'; help += ' - DURATION -> The duration during which the tips will be counted [*].\n'; help += ' - MIN -> If at the end of the Bid, one user is above ,he will win.\n'; help += ' - MAX -> If one user is above, he will win immediately and Bid will ending.\n'; help += ' All [ARGUMENT] with [*] are require.'; this.Add('/bidset',7,help); // /BIDRESET help = 'All Bid waiting will be canceled.\n'; help += '/bidreset has no [ARGUMENT]'; this.Add('/bidreset',7,help); // /BIDSTART help = 'All Bid waiting will be started immediatly.\n'; help += '/bidstart has no [ARGUMENT]'; this.Add('/bidstart',7,help); // /BIDSTOP help = 'All Bid in progress will be stopped immediatly and no one will win the bid !\n'; help += '/bidstop&[REASON] \n'; help += ' - REASON -> For explain to users why you stopped before the schedule end [*].\n'; help += ' Use this command only if you don\'t have the choice !!!\n'; help += ' All [ARGUMENT] with [*] are require.'; this.Add('/bidstop',7,help); // /BIDBOARD help = 'Display fully stats of the last Bid.\n'; help += '/bidboard has no [ARGUMENT]'; this.Add('/bidboard',7,help); // /BIDTABLE help = 'Display stats of the last Bid.\n'; help = 'In LeaderBoard of bidtable, only [PLT]-[DMD]-[FAN]-[MOD] can view amount of each user.\n'; help += '/bidtable has no [ARGUMENT]'; this.Add('/bidtable',0,help); // BIDSESSION -> View Bidlist of actual session help = 'View Bidlist of actual session.\n'; help += '/bidsession'; this.Add('/bidsession',7,help); // BIDLIST -> View Bidlist of all sessions help = 'View Bidlist of all sessions.\n'; help += '/bidlist'; this.Add('/bidlist',7,help); // /SHOWSTART help = 'Start the show for the last bid won.\n'; help += '/showstart&[AMOUNTSPY]&[DURATION] \n'; help += ' - AMOUNTSPY -> Tip amount for autorize other users to spy the show .[*]\n'; help += ' - DURATION -> Duration of private show in MINUTES .[*]\n'; help += ' All [ARGUMENT] with [*] are require.'; this.Add('/showstart',7,help); // /SHOWSTOP help = 'Stop the show in progress.\n'; help += '/showstop \n'; help += '/showstop has no [ARGUMENT]'; this.Add('/showstop',7,help); // /SHOWUSERLIST help = 'View users list of the private show in progress.\n'; help += '/showuserlist \n'; help += '/showuserlist has no [ARGUMENT]'; this.Add('/showuserlist',7,help); // /SHOWBOARD help = 'View all stats of a private show in progress.\n'; help += '/showboard \n'; help += '/showboard has no [ARGUMENT]'; this.Add('/showboard',7,help); // SHOWSESSION -> View showlist of actual session help = 'View showlist of actual session.\n'; help += '/showsession'; this.Add('/showsession',7,help); // SHOWLIST -> View showlist of all sessions help = 'View showlist of all sessions.\n'; help += '/showlist'; this.Add('/showlist',7,help); // /EXPORT help = 'the /export command shows you all the data of your room, copy&paste in a text file the return of this command.\n'; help += 'At the next session, all you need to do is copy / paste the contents of the text file into the field provided on the application\'s configuration page.\n'; help += 'This method allows you to keep all your statistics, and also allows your users to find their ranks at each session ....\n'; help += '/export \n'; help += '/export has no [ARGUMENT]'; this.Add('/export',8,help); // SESSIONBOARD -> View stats of actual session help = 'View stats of actual session.\n'; help += '/sessionboard'; this.Add('/sessionboard',7,help); // SESSIONLIST -> View stats of all sessions help = 'View stats of all session.\n'; help += '/sessionlist'; this.Add('/sessionlist',7,help); send.Notice('... ( '+cmd.list.length+' commands added )','warning',cb.room_slug,'',1500); } } var send = { list : [], state : 'free', Notice : function(msg,style,to,group,timer = 0){ if(send.state == 'busy'){timer += 100}; if(!to){to = ''}; if(!group){group = '';} send.state = 'busy'; cb.setTimeout(function(){cb.sendNotice(msg,to,color[style].b,color[style].c,color[style].w,group);},timer); send.state = 'free'; }, Message : function(msg,id_user){ if(usr.list[id_user].lvl >= rank.rk_silence){ if(cb.limitCam_isRunning()){ id_show = show.list.length -1; if(usr.list[id_user].user == cb.room_slug || usr.list[id_user].user == show.list[id_show].allowed){ send.Private(msg.m,id_user,id_show); msg.m = ''; msg['X-Spam'] = true; } else{ send.Notice('Only '+cb.room_slug+' and '+show.list[id_show].allowed+' can chat during this private show ... ','warning',usr.list[id_user].user,'',100); msg.m = msg.m+' [HIDDEN]'; msg['X-Spam'] = true; } } else{ usr.Update(id_user,'msg'); msg.c = rank.list[usr.list[id_user].lvl].color; msg.m = rank.list[usr.list[id_user].lvl].rank + msg.m; } } else{ msg.m = msg.m+' [HIDDEN]'; msg['X-Spam'] = true; if(rank.rk_silence != 9){ dif = rank.list[rank.rk_silence].mini - usr.list[id_user].amount; not = 'For posting messages, tip '+dif+' Tokens and upgrade to '+rank.list[rank.rk_silence].label+' rank '+rank.list[rank.rk_silence].rank+' .'; } else{ not = 'Sorry, nobody can chat here ... '; if(usr.list[id_user].user == cb.room_slug){not += '( /ranksilence&lvl for updating silence level in this room . )';} } this.Notice(not,'warning',usr.list[id_user].user); } session.Update('msg',session.actual); return msg; }, Private : function(msg,id_user,id_show){ col = rank.list[usr.list[id_user].lvl].color; message = usr.list[id_user].user+': '+rank.list[usr.list[id_user].lvl].rank+' '+msg; cb.setTimeout(function(){cb.sendNotice(message,cb.room_slug,'#ffffff',col);},50); cb.setTimeout(function(){cb.sendNotice(message,show.list[id_show].allowed,'#ffffff',col);},50); cb.setTimeout(function(){cb.sendNotice(message,show.adm,'#ffffff',col);},50); } } var session = { actual : '', // session.list => is_session,start,last,amount,nb_tip,nb_user,nb_bid,nb_show,nb_msg,nb_cmd list : [], Add : function(){ session.list.push({id_session:session.list.length,start:time.GetDate(),last:'',amount:0,nb_tip:0,nb_user:0,nb_bid:0,nb_show:0,nb_msg:0,nb_cmd:0}); }, Update : function(type,id_session,tip = false){ if(type == 'tip'){ session.list[id_session].amount += parseInt(tip.amount); session.list[id_session].nb_tip++; session.list[id_session].last = time.GetDate(); } else if(type == 'user'){ session.list[id_session].nb_user++; session.list[id_session].last = time.GetDate(); } else if(type == 'bid'){ session.list[id_session].nb_bid++; session.list[id_session].last = time.GetDate(); } else if(type == 'show'){ session.list[id_session].nb_show++; session.list[id_session].last = time.GetDate(); } else if(type == 'msg'){ session.list[id_session].nb_msg++; session.list[id_session].last = time.GetDate(); } else if(type == 'cmd'){ session.list[id_session].nb_cmd++; session.list[id_session].last = time.GetDate(); } }, Board : function(id_user){ if(session.list.length > 0){ not = ''; not += 'SESSION ID : '+session.list[session.actual].id_session+'\n'; not += 'START : '+time.GetDate(session.list[session.actual].start)+'\n'; not += 'LAST : '+time.GetDate(session.list[session.actual].last)+'\n'; not += 'AMOUNT : '+session.list[session.actual].amount+' Tokens\n'; not += 'NB_TIP : '+session.list[session.actual].nb_tip+' Tips\n'; not += 'NB_USERS : '+session.list[session.actual].nb_user+' Users\n'; not += 'NB_BID : '+session.list[session.actual].nb_bid+' Bids\n'; not += 'NB_SHOW : '+session.list[session.actual].nb_show+' Shows\n'; not += 'NB_MESSAGES : '+session.list[session.actual].nb_msg+' Messages\n'; not += 'NB_COMMANDS : '+session.list[session.actual].nb_cmd+' Commands'; send.Notice('::: SESSION BOARD : ','info_title',usr.list[id_user].user,'',100); send.Notice(not,'info',usr.list[id_user].user,'',250); } else{ send.Notice('Nope, error with actual session ...','warning',usr.list[id_user].user,'',100); } }, List: function(id_user){ if(session.list.length > 0){ not = ''; for(i=0;i<session.list.length;i++){ not += 'SESSION ID : '+session.list[i].id_session+'\n'; not += 'START : '+time.GetDate(session.list[i].start)+'\n'; not += 'LAST : '+time.GetDate(session.list[i].last)+'\n'; not += 'AMOUNT : '+session.list[i].amount+' Tokens\n'; not += 'NB_TIP : '+session.list[i].nb_tip+' Tips\n'; not += 'NB_USERS : '+session.list[i].nb_user+' Users\n'; not += 'NB_BID : '+session.list[i].nb_bid+' Bids\n'; not += 'NB_SHOW : '+session.list[i].nb_show+' Shows\n'; not += 'NB_MESSAGES : '+session.list[i].nb_msg+' Messages\n'; not += 'NB_COMMANDS : '+session.list[i].nb_cmd+' Commands'; if(i < session.list.length - 1){ not += '\n----------\n'; } } send.Notice('::: SESSION LIST : ','info_title',usr.list[id_user].user,'',100); send.Notice(not,'info',usr.list[id_user].user,'',250); } else{ send.Notice('Nope, error with sessions ...','warning',usr.list[id_user].user,'',100); } }, Init : function (){ session.Add(); session.actual = session.list.length -1; } } cb.onEnter(function(user){ id_user = usr.Get(user); show.Chk(id_user); }); cb.onMessage(function(msg){ id_user = usr.Get(msg); rank.ChkRank(msg); if(msg.m[0] == '/'){ ret = cmd.Get(id_user,msg.m); if(!ret){ msg.c = '#777777'; msg.m = msg.m+' [HIDDEN]'; msg['X-Spam'] = true; } else{ if(ret.length > 0){ msg.m = ret; send.Message(msg,id_user); } } } else{send.Message(msg,id_user);} }); cb.onTip(function(tip){ id_user = usr.Get(tool.CleanFromUser(tip)); Btip.Add(tip,id_user); }); cb.onLeave(function(user){id_user = usr.Get(user);}); cb.onDrawPanel(function(user){ panel.Draw(); init.Launch(); return panel.content; });
© Copyright Chaturbate 2011- 2025. All Rights Reserved.