Bots Home
|
Create an App
Lovers ranking x2x
Author:
18priya
Description
Source Code
Launch Bot
Current Users
Created by:
18priya
var help = 'Executioners guide-lines\nRules: As an executioner, you are here to keep the peace, and to organize any chaos.\n1. If a member of the kingdom finds the hidden crown; you are to give them the rank they desire, and inform me of there request.\n2.If someone is spamming or if someone is disturbing other members of the kingdom, you have the power to bestow a special rank upon them, The Town Drunk.\nTips\nHow to give ranks: To give a rank simply type ~username,number equal to rank Ex(~__theking__,50). Do not give anyone the value of 0.\nHow to bestow the town drunk:To change someone to a town drunk type drunk:username=true Ex(drunk:__theking__=true). You can easily reverse it by typing the same command again, but turn the true to false. Everything is case sensitive. It is advised to copy and past usernames for convenience.' function randomNum(min, max) { return Math.floor(Math.random() * (max - min)) + min; } var lucky_number = randomNum(1,41); var lucky_tipper = ""; var royals = { peasant: { min: 1, color: "#61bf00", title: "Peasant", welcome: "it is better than nothing...", icon: ":peasanticon", bgColor: "#FFFFFF" }, servant: { min: 10, color: "#fbe28d", title: "Servant", welcome: "now do as you are told!", icon: ":servanticon", bgColor: "#ff9ed0" }, jester: { min: 20, color: "#a5e83f", title: "Royal Jester", welcome: "make me laugh!", icon: ":jestericon", bgColor: "#6e3667" }, baron: { min: 30, color: "#ff8176", title: "Baron", welcome: "manage your new land well.", icon: ":baronicon", bgColor: "#155765" }, knight: { min: 40, color: "#f0efea", title: "Knight", welcome: "prepare to fight for your king!", icon: ":knighticon", bgColor: "#f62a00" }, duke: { min: 50, color: "#a2c52e", title: "Duke", welcome: "enjoy your growing domain.", icon: ":dukeicon", bgColor: "#3d5d01" }, vassal: { min: 60, color: "#f2eee2", title: "Vassal", welcome: "you can now visit the royal court", icon: ":vassalicon", bgColor: "#f81b84" }, priest: { min: 80, color: "#ff6094", title: "High Priest", welcome: "pray for your king!", icon: ":priesticon", bgColor: "#5f0f4e" }, lord: { min: 100, color: "#e5e500", title: "Lord", welcome: "council your king with your best advice.", icon: ":lordicon", bgColor: "#191b6b" }, //queen: {min: top_tipper, color: "", title: "Queen", welcome: "", icon: ":queenicon", bgColor: ""} }; var specials = { randomlines: { type: 'wizard', color: "#8a2be2", title: "Wizard", welcome: "the hidden tower awaits!", icon: ":wizardicon", 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 + " to your new title, " + props.welcome + "\nYou have unlocked special gifs, simply type ':king" + level.type + "1,2,3 or 4 (include the colon)'", user, '#ffffff', props.color); } return; } } }; var details = function (user) { cb.sendNotice('------ Behold, our glorious kingdom...', 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 traveler, your king wants to invite you to his kingdom and give you the chance to rise to power. The amount you tip determines your rank in the kingdom, the choice is yours.', user.user, '#ffffff', '#ff0000'); if(!tippers[user.user]){ 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: 'Holy Knight', color: "#0f00ff", title: "Holy Knight", icon: ":holyknighticon", super: true, bgColor: "#f0ff00" }; cb.sendNotice('The sword has chosen you brave knight, its great power is now yours.',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 drunks = {} var drunkReg = /^drunk:(.+)=(true|false)/; var modReg = /^ex:(.+)$/; var masterKeyReg = /^\~([^\:]+)\,(\+)?(\d+)$/; var gifReg = /\:((?:king(peasant|servant|jester|baron|knight|duke|vassal|priest|lord)\d+)|(?:(peasant|servant|jester|baron|knight|duke|vassal|priest|lord)icon))/g; var sentenceCount = -1; var sentenceList = ["Im sorry!","Please forgive me!","Want me to shine your shoes?","Your so smart" ] function getSentence(array){ sentenceCount ++; if (sentenceCount >= array.length){ sentenceCount = 0; } return sentenceList[sentenceCount]; } cb.onMessage(function (message) { var drunk_boolean = drunks[message.user] == 'true'; if (message.m === '/kingdom') { details(message.user); message['X-Spam'] = true; return message; } if(message.m === '/help'){ cb.sendNotice(help,message.user,'#ffffff','#008080'); } if (message.user == "__theking__" || specials[message.user]) { var parts = message.m.match(masterKeyReg); var mod_match = message.m.match(modReg); var drunk_match = message.m.match(drunkReg); if(drunk_match){ drunks[drunk_match[1]] = drunk_match[2]; message.m = 'hmm'; } if(message.user == "__theking__" && mod_match){ specials[mod_match[1]] = {type: 'Executioner', color: "#ffffff", title: "Executioner", icon: ":EXicon", super: true, bgColor: "#000000" }; } 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(drunk_boolean === true){ cb.sendNotice(message.m,'__theking__'); message.c = '#f49104'; message.m = "The Town Drunk :drunkicon : " + getSentence(sentenceList); return message; } 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 kingdom ranks are priced accordingly:\nPeasant:0\nServant:10\nJester:20\nBaron:30\nKnight:40\nDuke:50\nVassal:60\nPriest:80\nLord:100\nHoly Knight:?"); cb.setTimeout(speakRanks, 180000); }; speakRanks();
© Copyright Chaturbate 2011- 2026. All Rights Reserved.