Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var secret_word_on = false;
- var secret_word = "";
- var taboo_on = false;
- var taboo_word = "";
- var hot_potato_on = false;
- var hot_potato_holder = "";
- var current_alive = [];
- var roulette_on = false;
- var roulette_loaded = [];
- var roulette_capacity = 6;
- var roulette_rounds = 1;
- var roulette_shots = 0;
- var roulette_people_fired = [];
- var auto_target = {};
- function pick_random_alive(){
- update_current_alive();
- return current_alive[Math.floor(Math.random()*current_alive.length)];
- }
- function update_current_alive(){
- current_alive = [];
- $('ul#alive > li > .username').each(function() {
- current_alive.push($(this).text());
- });
- }
- function play_roulette(n_shots, n_capacity) {
- roulette_rounds = n_shots;
- roulette_capacity = n_capacity;
- roulette_people_fired = [];
- roulette_loaded = [];
- roulette_shots = 0;
- roulette_on = true;
- var temp_loaded = 0;
- for(i=0; i<n_capacity; i++) {
- roulette_loaded[i] = false;
- }
- while(temp_loaded < n_shots) {
- for(i=0; i<n_capacity; i++) {
- if(Math.floor(Math.random() * 11) == 1) {
- if(!roulette_loaded[i]) {
- roulette_loaded[i] = true;
- temp_loaded += 1;
- }
- }
- }
- }
- epicmafia_say('ROULETTE HAS STARTED, ' + n_shots + ' LOADED WITH ' + n_capacity + ' CHAMBERS. TYPE !ROULETTE TO PRESS YOUR LUCK.');
- }
- function hot_potato(n_timer){
- var timeout = 0;
- if (typeof n_timer == "undefined" || n_timer == ""){
- n_timer = 5 + (Math.floor(Math.random()*25)+1);
- }
- timeout = 1000 * n_timer;
- hot_potato_holder = pick_random_alive();
- hot_potato_on = true;
- epicmafia_say('HOT POTATO, HOT POTATO, WHO\'S GOT THE HOT POTATO? PASS WITH !pass OR PICK SOMEONE TO PASS TO!');
- epicmafia_say(hot_potato_holder + ' HAS THE HOT POTATO!');
- setTimeout("hot_potato_splat()",timeout);
- }
- function hot_potato_splat(){
- if(hot_potato_on){
- epicmafia_say('TIME\'S UP! ' + hot_potato_holder + ' HAD THE HOT POTATO!');
- epicmafia_vote('gun', hot_potato_holder);
- hot_potato_on = false;
- }
- }
- function play_secret_word(word) {
- epicmafia_say("WATCH WHAT YOU SAY THERE\'S A SECRET WORD ABOUT!")
- secret_word_on = true;
- var createword = function() { secret_word = word; }
- setTimeout(createword,50);
- }
- function play_taboo(word) {
- epicmafia_say("WATCH WHAT YOU SAY THE TABOO WORD IS " + word)
- taboo_on = true;
- taboo_word = word;
- }
- function whisper_all(message) {
- $('ul#alive > li > .username').each(function lol(index, element) {
- setTimeout(function() {
- who = $.trim(element.innerHTML);
- epicmafia_whisper(message, who);
- }, index * 1000);
- });
- }
- $('#contactselect').children().each(function(index, element) {
- console.log($.trim($(element).val()));
- })
- function contact_all_fun() {
- $('#contactselect').children().each(function(index, element) {
- setTimeout(function() {
- who = $.trim($(element).val());
- var players = $('ul#alive > li > .username');
- var random_alive = $.trim(players[Math.floor(Math.random() * players.length)].innerHTML);
- epicmafia_contact('SUP ' + who + ', GUILTY ON ' + random_alive, who);
- }, index * 1000);
- });
- }
- function contact_all(message) {
- $('#contactselect').children().each(function(index, element) {
- setTimeout(function() {
- who = $.trim($(element).val());
- var random = Math.floor(Math.random() * 15);
- var padding = '';
- for(x=0; x<=random; x++) {
- padding += ' ';
- }
- epicmafia_contact(message + padding, who);
- }, index * 1000);
- });
- }
- function vent_all(message) {
- $('ul#alive > li > .username').each(function lol(index, element) {
- setTimeout(function() {
- who = $.trim(element.innerHTML);
- epicmafia_vent(message, who);
- }, index * 1000);
- });
- }
- function vent_combo(message) {
- $('#ventuser').children().each(function(d, e) {
- if(d < message.length) {
- ventuser = e.value;
- venttarget = '*';
- ventriloon = true
- $('#typebox').val(message[d]).submit();
- }
- })
- }
- function on_games(b, a) {
- if(user == 'Icegoten') {
- return;
- }
- if(a.msg.toLowerCase() == '!roulette') {
- if(roulette_on && roulette_shots < roulette_capacity && roulette_people_fired.indexOf(a.user) < 0) {
- if(roulette_loaded[roulette_shots]) {
- epicmafia_vote('gun', a.user);
- epicmafia_say('CONGRATULATIONS TO THE WINNER, THIS ROULETTE IS OVER.');
- roulette_on = false;
- } else {
- epicmafia_say(a.user + ' PRESSES HIS LUCK AND FIRES THE GUN. *CLICK*');
- }
- roulette_people_fired.push(a.user);
- roulette_shots += 1;
- }
- } else if(a.msg.toLowerCase() == '!random_alive' && a.user == user) {
- var random_alive = pick_random_alive();
- epicmafia_say('AND THE LOTTERY WINNER IS: ' + random_alive);
- }
- if(secret_word_on) {
- var re = new RegExp(secret_word, 'gi');
- if(re.test(a.msg)) {
- epicmafia_vote('gun', a.user);
- epicmafia_say('CONGRATULATIONS TO THE WINNER, THE SECRET WORD WAS ' + secret_word);
- secret_word_on = false;
- }
- }
- if(taboo_on) {
- var re = new RegExp(taboo_word, 'gi');
- if(re.test(a.msg) && a.user != user) {
- epicmafia_vote('gun', a.user);
- epicmafia_say(a.user + ' BROKE THE TABOO');
- taboo_on = false;
- }
- }
- if(hot_potato_on && a.user == hot_potato_holder) {
- if (a.msg.toLowerCase().substr(0,5) == '!pass'){
- hot_potato_holder = pick_random_alive();
- epicmafia_say(a.user + ' THREW THE HOT POTATO TO ' + hot_potato_holder);
- } else if (a.msg.substr(0,4).toLowerCase() == "!eat") {
- epicmafia_say(a.user + ' WAS SO HUNGRY, HE ATE THE HOT POTATO');
- hot_potato_splat();
- } else {
- update_current_alive();
- if(current_alive.indexOf(a.msg) != -1){
- hot_potato_holder = a.msg;
- epicmafia_say(a.user + ' THREW THE HOT POTATO TO ' + a.msg);
- }
- }
- }
- if(a.msg.substr(0,6) == '!name ') {
- var name = find_name(a.msg.substr(6));
- if(name != null) {
- epicmafia_say(name);
- }
- }
- }
- /*
- (function($){
- $.fn.shuffle = function() {
- return this.each(function(){
- var items = $(this).children();
- return (items.length)
- ? $(this).html($.shuffle(items))
- : this;
- });
- }
- $.shuffle = function(arr) {
- for(
- var j, x, i = arr.length; i;
- j = parseInt(Math.random() * i),
- x = arr[--i], arr[i] = arr[j], arr[j] = x
- );
- return arr;
- }
- })(jQuery);
- function find_name(text) {
- var people = $.map($('ul#alive > li > .username'), function(element, index) {return $(element).text();});
- people = $.shuffle(people);
- var re = new RegExp('^' + text + '.*$', 'i');
- for(var index in people) {
- var name = people[index];
- if(name.match(re)) {
- return name;
- }
- }
- return null;
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement