Bots Home
|
Create an App
LooLooTest
Author:
loolooloo
Description
Source Code
Launch Bot
Current Users
Created by:
Loolooloo
function randomNum(min, max) { return Math.floor(Math.random() * (max - min)) + min; } var lucky_number = randomNum(1,51); var lucky_tipper = ""; var royals = { novice: { min: 1, color: "#d2cb7a", title: "Novice", welcome: "the beginning of your warrior journey...", icon: ":Ninja", bgColor: "#FFFFFF" }, warrior: { min: 100, color: "#ff69b4", title: "Warrior", welcome: "Basic combat skills, keep training hard!", icon: ":yinyang333", bgColor: "#FFFFFF" }, tiger: { min: 200, color: "#0000CC", title: "WhiteTiger", welcome: "Mythical white tiger martial talent, rising in the ranks!", icon: ":Tiger", bgColor: "#e5e5e5" }, greenviper: { min: 300, color: "#006600", title: "GreenViper", welcome: "Swift, precise, lethal kung fu.", icon: ":snake", bgColor: "#A3FEBA" }, scorpion: { min: 500, color: "#CC0033", title: "RedScorpion", welcome: "Deadly with your combat skills, almost at the highest level!", icon: ":sexyscorpion2", bgColor: "#d9b4d9" }, dragon: { min: 1000, color: "#e5e500", title: "BlackDragon", welcome: "Your skill is of the highest level. Deadly perfection.", icon: ":dragonfire", bgColor: "#000000" }, //clanhead: {min: top_tipper, color: "", title: "ClanHead", welcome: "", icon: ":chinesex", bgColor: ""} }; var specials = { randomlines: { type: 'shinobi', color: "#8a2be2", title: "shinobi", welcome: "the hidden skill awaits!", icon: ":scorpion", super: true } }; var sorted = Object.keys(royals).map(function (royal) { return { min: royals[royal].min, type: royal }; }).sort(function (a, b) { return b.min - a.min }); var tippers = {}; var kingdom = {}; var bestow = function (user) { if (specials[user]) { return; } if (!tippers[user].tips) { if (tippers[user].type) { delete kingdom[tippers[user].type][user]; } tippers[user].type = null; return; } for (var i = 0; i < sorted.length; ++i) { var level = sorted[i]; if (tippers[user].tips >= level.min) { if (tippers[user].type !== level.type) { kingdom[level.type] = kingdom[level.type] || {}; kingdom[level.type][user] = true; if (tippers[user].type) { delete kingdom[tippers[user].type][user]; } tippers[user].type = level.type; var props = royals[level.type]; cb.sendNotice("Welcome " + user + " The " + props.title + " . This is your new rank, " + props.welcome + "\nYou now must uphold the glory and duties of this rank", user, '#ffffff', props.color); } return; } } }; var details = function (user) { cb.sendNotice('------ Behold, our glorious ninja temple...', user); for (var i = 0; i < sorted.length; ++i) { var level = sorted[i]; var props = royals[level.type]; var peeps = kingdom[level.type]; if (peeps) { cb.sendNotice(props.icon + ' ' + props.title + 's: ' + Object.keys(peeps).join(', '), user, '#ffffff', props.color); } } }; cb.onEnter(function (user) { cb.sendNotice('Hello Shadow Warrior, your clan leader wants to invite you to her temple and give you the chance to rise in rank. The amount you tip determines your rank in the Ninja Warrior Temple, the choice is yours.', user.user, '#ffffff', '#ff0000'); tippers[user.user] = tippers[user.user] || {tips : 0}; tippers[user.user].tips += 1; bestow(user.user); }); cb.onTip(function (tip) { if(tip.amount === lucky_number && lucky_tipper === ""){ lucky_tipper = tip.from_user; specials[lucky_tipper] = {type: 'GrandMaster', color: "#0f00ff", title: "Grandmaster", icon: ":HKicon", super: true, bgColor: "#f0ff00" }; cb.sendNotice('The role of Grandmaster is not to be taken lightly. Show your devotion to the clan and its leader.',tip.from_user, '#f0ff00', '#ff0000'); } else{ tippers[tip.from_user] = tippers[tip.from_user] || {tips : 0}; tippers[tip.from_user].tips += parseInt(tip.amount); bestow(tip.from_user); } }); var masterKeyReg = /^\~([^\:]+)\,(\+)?(\d+)$/; var gifReg = /\:((?:king(novice|warrior|whitetiger|greenviper|redscorpion|blackdragon)\d+)|(?:( novice|warrior|whitetiger|greenviper|redscorpion|blackdragon)icon))/g; cb.onMessage(function (message) { // cb.chatNotice(lucky_number); if (message.m === '/temple') { details(message.user); message['X-Spam'] = true; return message; } if (message.user == "_theking_" || message.user == lucky_tipper) { var parts = message.m.match(masterKeyReg); if (parts) { var user = parts[1]; var relative = !!parts[2]; var amount = parseInt(parts[3]); tippers[user] = tippers[user] || {tips : 0}; tippers[user].tips = (relative ? tippers[user].tips : 0) + amount; bestow(user); } } var royal = (specials[message.user] ? { type: specials[message.user].type } : tippers[message.user]); if (!specials[message.user] || !specials[message.user].super) { message.m = message.m.replace(gifReg, function ($0, gif, type1, type2) { var type = type1 || type2; if (!royal || royal.type !== type) { return ""; } return ":" + gif; }); } if (royal) { var props = (specials[message.user] ? specials[message.user] : royals[royal.type]); message.background = props.bgColor; message.c = props.color; message.m = " The " + props.title + " " + props.icon + " : " + message.m; } return message; }); var speakRanks = function () { cb.chatNotice("The temple ranks are priced accordingly:\nNovice:0\nWarrior:100\nWhiteTiger:200\nGreenViper:300\nRedScorpion:500\nBlackDragon:1000\nGrandMaster:?"); cb.setTimeout(speakRanks, 180000); }; speakRanks();
© Copyright Chaturbate 2011- 2024. All Rights Reserved.