Apps Home
|
Create an App
RHV420 Leader Board
Author:
ardchism
Description
Source Code
Launch App
Current Users
Created by:
Ardchism
let rhv = {}; rhv.User = class { constructor(userName, initialTip) { this.userName = userName; this.tipTotal = initialTip; } addTip(newTip){ this.tipTotal += newTip; } }; rhv.firstTipper = new rhv.User("this_could_be_you1", 0); rhv.secondTipper = new rhv.User("this_could_be_you2", 0); rhv.thirdTipper = new rhv.User("this_could_be_you3", 0); rhv.userMap = new Map(); rhv.highestTipUser = new rhv.User("this_could_be_you", 0); rhv.kingOfMonth = rhv.highestTipUser; rhv.tipMenuMap = new Map(); rhv.menuString = "Vixen's Tip Menu: "; rhv.noraString = "Vixen's Nora Levels: "; rhv.lushString = "Vixen's Lush Levels: "; rhv.specialCommandString = "Vixen's Special Commands: "; rhv.separatorString = String(cb.settings.tipSeparator); rhv.currentToy = "Lush"; rhv.currentMonth = ""; rhv.sendChatNotice = function(message, userName){ if(userName){ cb.sendNotice(message, userName, cb.settings.backGroundColor, cb.settings.chatTextColor, "bold"); } else{ cb.sendNotice(message, "", cb.settings.backGroundColor, cb.settings.chatTextColor, "bold"); } }; rhv.processTip = function(tip){ let userName = tip["from_user"]; let tipAmount = tip["amount"]; let tipAmountString = String(tipAmount); let currentUser; rhv.sendChatNotice("TIP_INFO UserName:" + tip['from_user'] + " Tip Amount:" + tip['amount'] + " Tip Message:" + tip['message'], cb.room_slug); if(rhv.userMap.has(userName)){ currentUser = rhv.userMap.get(userName); currentUser.addTip(tipAmount); }else{ currentUser = new rhv.User(userName, tipAmount); rhv.userMap.set(currentUser.userName, currentUser); rhv.sendChatNotice(`Thanks ${currentUser.userName}! :blowheart`); } if(currentUser.tipTotal > rhv.firstTipper.tipTotal && currentUser.userName !== rhv.firstTipper.userName){ rhv.thirdTipper = (rhv.secondTipper.userName === currentUser.userName) ? rhv.thirdTipper : rhv.secondTipper; rhv.secondTipper = rhv.firstTipper; rhv.firstTipper = currentUser; rhv.sendChatNotice(`:kingcrown ${currentUser.userName} is the new king :kingcrown`); cb.drawPanel(); } else if(currentUser.tipTotal > rhv.secondTipper.tipTotal && currentUser.userName !== rhv.secondTipper.userName && currentUser.userName !== rhv.firstTipper.userName){ rhv.thirdTipper = rhv.secondTipper; rhv.secondTipper = currentUser; } else if(currentUser.tipTotal > rhv.thirdTipper.tipTotal && currentUser.userName !== rhv.thirdTipper.userName && currentUser.userName !== rhv.secondTipper.userName && currentUser.userName !== rhv.firstTipper.userName){ rhv.thirdTipper = currentUser; } if(tipAmount > rhv.highestTipUser.tipTotal){ rhv.highestTipUser = new rhv.User(userName, tipAmount); cb.drawPanel(); } if(userName === rhv.firstTipper.userName){ cb.drawPanel(); } if(rhv.tipMenuMap.has(tipAmountString)){ let menuItem = rhv.tipMenuMap.get(tipAmountString); let itemFoundString = `${userName} tipped for ${menuItem.desc}`; rhv.sendChatNotice(itemFoundString); } }; rhv.displayKingTipper = function(userName){ let leaderBoardString = `:kingcrown Leader Board :kingcrown \n :goldmedaltest ${rhv.firstTipper.userName} |${rhv.firstTipper.tipTotal}| \n :silvermedaltest ${rhv.secondTipper.userName} |${rhv.secondTipper.tipTotal}| \n :bronzemedaltest ${rhv.thirdTipper.userName} |${rhv.thirdTipper.tipTotal}|`; rhv.sendChatNotice(leaderBoardString, userName); }; rhv.displayKingTipperAll = function(){ let leaderBoardString = `:kingcrown Leader Board :kingcrown \n :goldmedaltest ${rhv.firstTipper.userName} |${rhv.firstTipper.tipTotal}| \n :silvermedaltest ${rhv.secondTipper.userName} |${rhv.secondTipper.tipTotal}| \n :bronzemedaltest ${rhv.thirdTipper.userName} |${rhv.thirdTipper.tipTotal}|`; rhv.sendChatNotice(leaderBoardString); }; rhv.displayKingTipperTimeOut = function(timeOutTime){ rhv.displayKingTipperAll(); cb.setTimeout(function(){ rhv.displayKingTipperTimeOut(timeOutTime);}, timeOutTime * 1000); }; rhv.displayCommands = function(){ let message = "Vixen's Leader Board is Active. /leaders to View Leaders."; rhv.sendChatNotice(message); message = "Vixen's Tip Menu is Active. /tipmenu to View Tip Menu."; rhv.sendChatNotice(message); message = `Vixen's ${rhv.currentToy} is Active. /levels to View The Current Toy's Levels.`; rhv.sendChatNotice(message); }; rhv.displayCommandsTimeOut = function(timeOutTime){ rhv.displayCommands(); cb.setTimeout(function(){ rhv.displayCommandsTimeOut(timeOutTime);}, timeOutTime * 1000); }; rhv.processMessage = function(message){ let userName = message["user"]; let currentMessage = message["m"]; if(currentMessage.startsWith("/")){ if(currentMessage === "/leaders"){ rhv.displayKingTipper(userName); message["X-Spam"] = true; return message; } else if(currentMessage === "/leaders all" && (message["is_mod"] || message["user"] === cb.room_slug)){ rhv.displayKingTipperAll(); message["X-Spam"] = true; return message; } else if(currentMessage === "/tipmenu all" && (message["is_mod"] || message["user"] === cb.room_slug)){ rhv.displayTipMenuAll(); message["X-Spam"] = true; return message; } else if(currentMessage === "/tipmenu" ){ if(userName === cb.room_slug){ rhv.displayTipMenuAll(); } else{ rhv.displayTipMenu(userName); } message["X-Spam"] = true; return message; } else if(currentMessage.includes("/changeLeader") && (message["is_mod"] || message["user"] === cb.room_slug)){ let splitCommand = currentMessage.split(" "); let newUserName = splitCommand[1]; let newTipTotal = parseInt(splitCommand[2]); rhv.kingOfMonth = new rhv.User(newUserName, newTipTotal); message["X-Spam"] = true; cb.drawPanel(); return message; } else{ rhv.sendChatNotice(`${currentMessage} is not a valid comand`, userName); message["X-Spam"] = true; return message; } }else if(rhv.userMap.has(userName)){ let currentUser = rhv.userMap.get(userName); message["m"] = `|${currentUser.tipTotal}| ` + currentMessage; return message; } else if(currentMessage.startsWith("********My LOVENSE") && cb.settings.lovenseFlag === "Yes"){ if(currentMessage.includes("Nora") && rhv.currentToy !== "Nora"){ rhv.currentToy = "Nora"; rhv.sendChatNotice("Nora is active... :NORA"); } else if(currentMessage.includes("Lush") && rhv.currentToy !== "Lush"){ rhv.currentToy = "Lush"; rhv.sendChatNotice("Lush is now active... :lush123"); } let lovenseTipMessage = currentMessage.substring(currentMessage.indexOf(" is")); cb.sendNotice(rhv.currentToy + lovenseTipMessage, "", "#000000", "#ffff33", "bold"); message["X-Spam"] = true; return message; } }; rhv.buildPanels = function(){ let panels = {}; panels.template = "3_rows_of_labels"; panels.row1_label = "Today's King"; panels.row1_value = `${rhv.firstTipper.userName}|${rhv.firstTipper.tipTotal}|`; panels.row2_label = "Today's High Tip"; panels.row2_value = `${rhv.highestTipUser.userName}|${rhv.highestTipUser.tipTotal}|`; panels.row3_label = `King of ${rhv.currentMonth}`; panels.row3_value = `${rhv.kingOfMonth.userName}|${rhv.kingOfMonth.tipTotal}|`; return panels; }; rhv.displayTipMenuAll = function(){ if(rhv.tipMenuMap.size === 0){ for(let i = 0; i < 20; i++){ let currentString = String(cb.settings["item " + (i+1)]); if(currentString.includes("--")){ let splitItem = currentString.split("--"); let menuItem = {}; menuItem.amount = splitItem[0]; menuItem.desc = splitItem[1]; rhv.tipMenuMap.set(menuItem.amount, menuItem); rhv.menuString += `${menuItem.desc}(${menuItem.amount})`; rhv.menuString += ` ${rhv.separatorString} `; } } rhv.menuString = rhv.menuString.substring(0, rhv.menuString.length - (rhv.separatorString.length + 2)); } rhv.sendChatNotice(rhv.menuString); }; rhv.displayTipMenu = function(userName){ rhv.sendChatNotice(rhv.menuString, userName); }; rhv.displayTipMenuTimeOut = function(timeOutTime){ rhv.displayTipMenuAll(); cb.setTimeout(function(){ rhv.displayTipMenuTimeOut(timeOutTime);}, timeOutTime * 1000); }; rhv.configureSettings = function(){ let settings = []; let backgroundColor = {}; backgroundColor.name = "backGroundColor"; backgroundColor.type = "str"; backgroundColor.label = "Background Color"; backgroundColor.inLength = 7; backgroundColor.maxLength = 7; settings.push(backgroundColor); let chatTextColor = {}; chatTextColor.name = "chatTextColor"; chatTextColor.type = "str"; chatTextColor.label = "Chat Text Color"; chatTextColor.minLength = 7; chatTextColor.maxLength = 7; settings.push(chatTextColor); let tipSeparator = {}; tipSeparator.name = "tipSeparator"; tipSeparator.type = "str"; tipSeparator.label = "Tip Separator"; tipSeparator.minLength = 0; tipSeparator.maxLength = 255; settings.push(tipSeparator); for(let i = 0; i < 20; i++){ let currentField = {}; currentField.name = "item " + (i + 1); currentField.type = "str"; currentField.minLength = 0; currentField.maxLength = 255; currentField.required = false; settings.push(currentField); } let lovenseFlag = {}; lovenseFlag.name = "lovenseFlag"; lovenseFlag.type = "choice"; lovenseFlag.label = "Decorate Lovense Messages?"; lovenseFlag.choice1 = "Yes"; lovenseFlag.choice2 = "No"; lovenseFlag.defaultValue = "No"; settings.push(lovenseFlag); cb.settings_choices = settings; }; rhv.findCurrentMonth = function(){ let month = new Date().getMonth(); if(month === 0){ rhv.currentMonth = "Jan"; } else if(month === 1){ rhv.currentMonth = "Feb"; } else if(month === 2){ rhv.currentMonth = "March"; } else if(month === 3){ rhv.currentMonth = "April"; } else if(month === 4){ rhv.currentMonth = "May"; } else if(month === 5){ rhv.currentMonth = "June"; } else if(month === 6){ rhv.currentMonth = "July"; } else if(month === 7){ rhv.currentMonth = "August"; } else if(month === 8){ rhv.currentMonth = "September"; } else if(month === 9){ rhv.currentMonth = "October"; } else if(month === 10){ rhv.currentMonth = "November"; } else if(month === 11){ rhv.currentMonth = "December"; } }; rhv.findCurrentMonth(); rhv.configureSettings(); cb.onTip(rhv.processTip); cb.onMessage(rhv.processMessage); cb.setTimeout(function(){rhv.displayKingTipperTimeOut(600);}, 600 * 1000); cb.setTimeout(function(){rhv.displayCommandsTimeOut(180);}, 180 * 1000); rhv.displayTipMenuAll(); cb.setTimeout(function(){rhv.displayTipMenuTimeOut(600);}, 300 * 1000); cb.onDrawPanel(rhv.buildPanels); cb.drawPanel();
© Copyright Chaturbate 2011- 2025. All Rights Reserved.