· 6 years ago · Mar 17, 2020, 11:14 AM
1// ==UserScript==
2// @name Relyks's fixed MPP Piano Script
3// @namespace http://www.multiplayerpiano.com/
4// @notice This was originally made by electrashave. And furthermore edited by Relyks
5// @Version 8.0
6// @description Modded Script For Multiplayerpiano.com
7// @include http://www.multiplayerpiano.com/*
8// @match http://www.multiplayerpiano.com/script.js
9// @copyright 2013+
10// ==/UserScript==
11$("#volume-slider").hide();
12var startUpDelay = window.performance.now();
13// ♥ // personal notes // ♥ //
14/*
15Here's how to get your _id: MPP.client.getOwnParticipant()._id
16Here's how to get your id MPP.client.participantId
17Here's how to get a name: MPP.client.ppl["11b6b8d23ad8d4040b8ac00e"].name
18Here's how to get your name and split it up: MPP.client.getOwnParticipant().name.split('');
19Here's how to split the room into an array: MPP.client.channel._id.split('');
20Here's how to check if an something is in an array: if(arrayName.indexOf(id) != -1) { It is there. } else { Nope };
21Here's a cool way to generate a number Thanks B@K$!: Math.floor(Math.random()*2) ? "win " + Math.floor(Math.random()*2) : "lost " + Math.floor(Math.random()*2)
22Here's how to generate two numbers one negative and one positive using a function, thanks for the help Yoshify: function meowPuff(Min, Max) { return Math.floor(Math.random() * (Max-Min)+Min);} meowPuff(-5, 5); //c:
23Here's a test: function catdog(num, win, lose) { Math.floor( Math.random() * num ) ? "win " + Math.floor( Math.random() * num ) : "lose " + Math.floor( Math.random() * num ); }
24Here's how to add a message to chat locally (thanks SomeGuy) function localMsg(msg) { $("#chat ul").append('<li style="color: green; opacity: 0.97;"><span class="name">bot: </span><span style="position: initial!important;" class="message"><span class="msg_">' +msg+ '</span></span></li>'); }; localMsg("Hello")
25Here's how to append something to something (thanks SomeGuy) $("ul").append( name );
26Here's stuff: function x(min, max) { return Math.round(Math.random() * (max - min) + min); }; x(-10, 10)
27Here's stuff too: name.length === 5 && name === "Logan" && gClient.isOwner() && last_known_channel === "Logan" && last_known_channel.length === 5
28Here's more stuff: me = MPP.client.getOwnParticipant(); delete me.cursorDiv; delete me.nameDiv; JSON.stringify(me)
29Here's how to add notifications, thanks Kappa! new window.Notification("Hello", { icon: "http://dreamatico.com/data_images/kitten/kitten-2.jpg", body: "world" })
30Here's how to get a random user (thanks Impossible) function meow() {return MPP.client.ppl[Object.keys(MPP.client.ppl)[Math.round(Math.random()*MPP.client.channel.count)]].name}; meow()
31
32♥ Here's how databases work, Logan ♥
33 var puff = MPP.client.ppl[MPP.client.getOwnParticipant().id].name
34
35 Chacha–㉖ MPP.client.ppl is the DATABASE
36 Chacha–㉖ MPP.client.getOwnParticipant().id is the INDEX or KEY
37 Chacha–㉖ MPP.client.ppl[MPP.client.getOwnParticipant().id] is the RECORD or DATA
38 Chacha–㉖ MPP.client.ppl[MPP.client.getOwnParticipant().id].name is ONE FIELD OF THAT RECORD
39
40 //Object.defineProperty(MDB,"length",{get:function(){return Object.keys(this).length}})
41 //MPP.client.on("n", function(n){if(!MPP.piano.keys[n.n[0]])MPP.chat.receive({t:Date.now(),p:MPP.client.ppl[n.p],a:n.n.map(function(x){return x.n}).join("")})})
42♥ Here's how databases work, Logan ♥
43
44`X: ${mx} Y: ${my}` //template string
45
46καρρα To be exact, it is 4 every 6 seconds.
47καρρα 10 every 2 seconds when crowned.
48
49καρρα To get the properties names use: Object.getOwnPropertyNames(String.prototype)
50
51Josh MPP.piano.play('a1', 1, MPP.client.getOwnParticipant(), 0);
52
53//made by Impossible(RU)
54//var anims = 0; setInterval(function () { var char = "Logan"; var name = ""; anims++; for (i = 0; i < char.length; i++) { name += char[(anims + i) % char.length]; } MPP.client.sendArray([{ m: "userset", set: { name: name } }]); }, 2100);
55
56x = setInterval(function(){ press('e1',0.5); press('b1',0.5); press('gs2',0.5) }, 4000); y = setInterval(function(){ press('b1',0.5); press('ds1',0.5); press('b2',0.5) }, 4000);
57
58
59*/
60// ♥ // personal notes // ♥ //
61
62//Change to true to stop the notification displaying on start-up.
63//You can always view the hotkeys with the H key.
64//I encourage you to edit this script and see what cool things you can make.
65var i_know_how_to_use_this_bot = true;
66
67//js LOL = setInterval(() => { if (MDB[selfId].inventory.bananaMilk > 1000) { clearInterval(LOL) } MPP.chat.send('!mshop banana milk') }, 200)
68
69this.worker = new Worker("/workerTimer.js"); //must be same origin - thanks B@K$
70
71/*
72//List of names I find interesting or too funny to forget:
73Names: ""
74Names: ๖ۣۜʟᴏɢɪᴇ ๖ۣۜʙᴇᴀʀ
75Names: ℒℴℊąɳ
76Names: ℒℴℊɨℯ
77Names: ℋℯℓℓℴ ℐℳ ℒℴℊɨℯؕ ぼ
78Names: ℒℴℊɨℯ ܮ̬͔̰̹̮̫̬͔̰̹̮̫̬͔̰̹̮̫̇ͅͅͅ
79Names: ๖ۣۜSnorkel ๖ۣۜWarrior
80Names: くコ:彡 ๖ۣۜSevant ๖Squidly *le slurrpy*
81Names: ᶠᵃᵍᵍᵒᵗ
82Names: ████████████████████████████████████████
83Names: "ㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤ"
84Names: ͚ ͚͚ ͚͚͚ ͚͚͚͚ ͚͚͚͚͚ ͚͚͚͚͚͚ ͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚͚͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚͚͚͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚͚͚͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚͚͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚ ͚͚͚͚͚͚ ͚͚͚͚͚ ͚͚͚͚ ͚͚͚ ͚͚ ͚
85Names: ௵LOGAN!Ϡ
86Names: Raza२
87Names: Logan هلا
88Names: ✿ۣۣۜۜ✿
89Names: ♥̬͔̰̹̮̫̇ͪͣ͐̆̍̇ͩ́ͣ̕͞ͅ
90Names: ><(((⊚>
91Names: (_̅_̅_̅_̅_̅м̅a̅я̅i̅j̅u̅a̅n̅a̅_̅_̅_̅ () ด้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็็
92Names: █̶̧̗̫̜̟̟͓̈̎ͯ͌͗ͩ̀ͮ̾͊͌̈́͌̃ͪͮ̎̑̕͡͠█̷̧̣̘̣͓͕͍̜͎̝̝͉͚͓̩̩͇̭̱͔͋̀̏ͦͯͬͬͥͭ͋̇ͫ͒͝█̶̵̨̹̝͙̲̻̦̘͉̙̭̠̠̺̲̭͍̠̝̤͋̇̀̆ͯ̂ͤͦ͒̌̈́̌ͧ͂͢█̷̴̡̭̤̗̫͓̹̳̯̫̤͇̰̗͔͓ͫ̌̽̏̎̇̐̿͂ͦ█͚̫͖̯͇̝̲̞̱͕̟̗͍̳̠͛ͥ͂̅ͨ̆ͤͥͩͦ̉̈́̾̆̒ͥ̓̄́̕͘█̷̶͋̌̈͌̆̓͒̄̃̏͗̏̽҉̪͕͓̠̩̱̖͚█ͮͣ͛̓̌̓̊̆̌̑̇ͯͯ̽͞͏̷̛̩̝̫̱͉̦̼̳̱̮͓͙̤͓̦█̶̫̫͈̣͈̦̼̻̝̟͐̋͗̐̉̐̓̈̔ͪ͗͌͋͢͝█̔̾̊͒͑̉̔̈̀͋ͣ̓̓͆̎̎͂̾͏̡̰̟̺̻̬̳͚̝͉̝́ͅ█̸̌̓ͯ͌̆̀͏̛̗̙̣̻ͅ█̧ͧ̈͐ͫ̎͊̔ͨͩ̃ͨ̎̑̑̆ͮ͗ͯ́̕͏̮͈̳̲̤̪̹̘͔͔̜͘█̧̠͈̮̤̍͑̒͆̌͂̋̋ͭ́͜█̶̷̧̟͎̻̹͈͕͔͗ͪ͌ͧ͊ͩ͒͛ͨͫͩ͋ͦ̓̓ͨ̈͢͠█͊ͥ͛̒ͦ̿̉̃̽͌ͨ͆ͫ͟͢͡҉͍̤̳̗́█̴̴̸̡ͣ͐ͯͨ̆ͥ̊̾͋͆̎ͨ҉̘̻̳̺͍̺̹͙͓█̜̙̞̩̘͔̓ͧ̓͋͊̋ͦ̍̋ͯͦ̉͂͆̊̋̇̉̚͢͢͠ͅ█̢̫̙̭̜͕̺̦̥͔͍͕̺̻̀̈́̄̂̋͐̃̔͟͞ͅͅ█̸͙̯̝̟̘͉̙̪̬̰̪ͥ̏͂ͣ͐͐̽ͤͭ͡█̶̵̤̱͍̤̖͔̭̰̗̻̩͉̣̤͕̹͍̥͋ͩ̐͐͠͝█̷̧̱̱̖̱̠̤̥͔̪̖̪̠̖͖̞͖͖ͦ͋̑̈ͬ̈́ͫ͗ͦ̏̏ͤͨͩ̓̄͋̔ͅͅ█̴̏͑̉ͦ̊̀͒͑҉͈̜̼̗̪̘͍͉͇̼̝͖̻ͅͅ█̠͕̺͙̝̦͉͉͖̞̖͇͍̖̣ͪͤ̿ͬͧ͊̌͒̒̈́͗ͨ͋̈ͩͫͪ̌́͘█̢̖̱̣̣̆̾͒̿́͘͜͡█̡̢̗̺͎͇͙̺̜̤̜̭̦͔̞̬̖̌̈̐̀͘͡█̸̸̴̛͇̯̪̗̗͕̼̙̬̮̆ͭ̿̈́ͩ̍͊̒͢█̈́̽ͨ҉̡̳̰͙͓̟̯̹͈͙̩͕̥̘̫̱̀͘ͅ█̷̗͓͎͖͈͚̗͎̪͙̾͑͒̍͆̾̑̍ͮ̍̽̍ͪ͆̋́͘█̢̢̋̊̊ͪ̍͒̇̉̏̌ͪ́̚͘҉͔̬͓̫͍̞̥̫̤̯̭͚̝̗͖̖ͅ█̵̈́̏̐ͩ̆̑͠͠͏͖̫͇̣̗̣̠̤̠͟█̵ͣ̍̊̅ͤ̂ͫͧ̌̆̈̈́ͪ̆҉̭̟̣͚̳͢͡ͅͅ█͐͌̾̌̄͆̅̉̆̅̋ͪ͆͟҉͉̘̬̙͎̗̙͞█̘̲̳̘̯͎̱͍̮̱̎̏̀̀ͦ͠ͅ█̨̧̢̪̜̺̣̣̞̞̰͚̹̣̣̺͈ͨ̿ͭͤͭ̈́̇͜█ͩͯ̄̔͋̽̅̅̇̑҉̛̖̳̩̠̜͈́█̧̨̧̯̺̪̤̬̪̼͇͍̖͎̞̲̠̊̐̎ͤ͊̑ͪ͛ͥ͐̍̌́̔̿̏̀̕█̑̃͗̎̃͛̾̋̎̾͗́̆̚͜͏̫̮͕͚͍̳̣̱̬̼͙͇͎̥̘͕͎̦█̶̶̲͖̳͍̮̭̣͈̻͓̮̮̘̬̠̥͙ͨ͗̋̽̔͗̒ͣ͢͞█̵̸̧̲͔̙̻͉̫ͨ͑̀ͮͮ͒ͭ̉͢͜ͅ█̛̰̼̙̯̬͈͉̘̜̲͈̬̲̋̊̅͒̾͒͊͊ͯ͋́͠ͅ█̶̸̘̹̰̼͛͐̒̓͛̈́̐ͥͧ̐͐̓̌ͪ̆͑͜͝█̶̨̛̏̑͌̍ͭ̄ͩ̂ͥ͌̓͆̇ͯ͊̾ͮ͏̩̮̭͎̙͈̲̮͓͚̣█̷̴̡̙̖̪̖̯̻̫͙̄̔̍͛͛́̾̈ͬ̇̾̾͡█͕̠̮̭͖͚̉ͥͨ̉͒̅̋̌͊̄̎͞͞█̷̨̠̺͓̳̤͉̗͍͙̠̮̙̼̿͛̓̀ͧ̊̄ͫ͐̐̎̕͘█̶͎͍̮̲͈̫̲̭̈́͂͗̽ͫͥͧ́͞█͎̲̻̣͓̎̌̀ͪ͑̉ͥ̀ͭͩ̿̾̀█̙͍̦̘̪̥̦̪̲̖͙̤̤̭͓͌ͣ̏̆̂͞█̸̷̹̙̗̳̮͇͎̦͇͊͒ͣ̀̆̈́͒ͪ̀̿̓͊͋͂̃ͫ͝█̛̲̳̲̰̰̜̘̐ͥ̈͂̏̓̇̉̋ͪ̔̅͞█̶̯̰̯̖͉͈͇̮͇̝̻̥̰͔͔̬̙̪̂͑ͨ̍ͦͧ̀͢͡ͅ█̷͓̹͈̩̰̼̪͇̙͙͕̼̻ͭ̓̅̈̈ͮ̍ͯ̊ͫ̇͛̉͜͞͠͠█̵̧̛̩̺̼͍͕̞̾͂͑ͦ̅̀͐̏̄͝█̋̈͗ͫͩͤ̅ͦ͋̓͆̃̒̀҉̶͉͖̺̖̤͇͚̭̮̞̕͜█̵̢̰̞͔̜̥̠̤ͧ̉͐͐͒͊̎̎͊̐̀̍̔̎͛̾́͘͢█̴̶̧̛͇̩̰̼̣̲͚̠̻͖̞͚̯̼̝̲͙̻̒ͦ̍ͪ̾̊ͨ̇͠█̴̷̢͔͇̗̙̦̅͑̉͆̋̈̎ͤ͋͞█̧̛̞̺̥̳͚̭͔̰͉̮̟͎͇͙̗̾͌ͭͬͨ̒̉̂█̶̧̡̦̗̥̘̤̜̦̞̹̣̘͉̻̬̮̠͎̐ͭ̃͆̃ͮ͑ͯ̾̔ͨ█̡͚̺̮͔̭̺̰͉̗̦͉̝͈̀̋͛̽ͦ̋͂ͅ█̶̛̳̯̪̝͕̼̞͖̑̊ͥ̀ͅ█̅̍̆̆ͩ͛͌͐͊ͦͫ͏̶̤̻͉̯̣̪͎̳̯̦̠̭͎́█̨̹̖̩͍̭͉̺ͨ̃ͯͨ́ͬ̾̄̕█̸̸̡̥̞̯̺̪̹̬̙̼͎̹̫̗̘͖̤͑́ͥ̒͊͑̒̈́ͦ̂ͧ͑͡█̦̭̺̰͎͖͋͌͂͊̊́́͝͠█̵̵͚̥͍̰̮̫̥̙͕̬̳͔͐͐̅͂ͫͣ̕͝ͅͅ█ͮ̐̊͑̄̉͋̿̋̅̾̆̈͋ͫͭ͋̒ͭ͡҉̱͎̪̫̝̲̘̭̥͉͍̱̬̬ͅ█̶ͣ̈̆̉̂̾͠҉̖̹̻̯̣̯͉̟̠͚█̘̼̣͔̮̳̻͇̠͕͎̹̤̺̏̃̔ͩ̐̌͜͟͠͞█̶̧̫͔̼͇̭̞̫̤̹̱̞̖̙ͪͦ̉̈́̏̊̿̈͞█̷̸̨͔͚͎͇̬̠͕̣͎̟̩̠͙̬̥͉̞͗͗ͥ̑̽̋̔̈ͯͪ̋ͬ͊̅͐ͅ█̴̡̡̺̰͙̳̱̜̣̟̱̼͇̘̣̅͆͑͗͑ͭ̅̃͋ͦ̄̾ͩ̅̓̑̌̓́█̵̷̊͒̀ͣ͌̒̓ͧ̐̉̀͞͏̬̞̺̬̣̦̲̱̤̩͔͚̦̞̪ͅ█̮͔̳̏̐̓͛̐ͩ̂̾̍̚͝█̴̨͗ͯ̽̓̑͗̂̈̚̚͘͟͏͖̩͕̮͉█̖̹͇͓͖͍͖̪̱͔̗̣̯̬̾͛ͯͦͤͬ͒̾̚̚͜͡█̛̓̐̈ͥͣͮ͂ͨ̃҉̢̙̮̤̬̜̭͇̘͈͍̬█̷̶͔̩̖͙͙̺̟̞̻̖̜̈̂̌͋̾̾ͣ̓̃͌ͧ̏ͧ̀̎͛͢͠█̛̆ͤͫ̿ͯͩ̔̈̉͊́͛͌̽̽҉̧͏̣̣͓̜̙̭͖͝█̷̠͍̝̘̃͂̍̔̊̉͐͠█̴̨̧̨͉̞̤̜̪̠̥̣̬͒̏̊̿͐̋̀̓͊͡ͅ█̴̜͓͔̯͖͕̙̝̗͚̪̘͙ͤͫ̂̇̿̄ͪ̑̑͡█̳̥̬̬̭͈̟͚̪͉͕ͯ̒̓ͫ͗ͧͣͩ̇͋̎ͬ̌ͣ̿̚̕͢ͅ█̰̼̹͕̎̒ͩ͆ͧͨ̽̌͒͋̾̈́̍͐̎̇ͪ̌͜█̧͔͓̫̠̤̣̟̳̥̦̘̼͓ͤ͗ͥ̏̐ͨ̆ͥ͐̀ͩͤ̑̕͞͝█̶̛̊̿͗̓̇̅͏̴͖̫͉͚̩̣̟̠͎̟̟̙̜ͅ█̬̫̘̜̤̣̫̤̠͈̃̓̑̓̀̀͘█̶̹̱̙͎̺̥̹̙̟̩͍̰͓̹̤͎̞̞̃ͤͬ̈́̔̊̏͛͋̈́ͨ̂̈́ͪͭ̽█̴̴̨ͯ̉̃̿͌̅͒͛͗ͩ̀̚͡͏͙̫̥̰͚͈█̵̄ͫͤͬ́ͨͩ̏͂̆̀̈̃̌͋͏̷̛̗̬̰͚͞█̡̨͚̱̗̰̥̪̮͍ͤ͆͑ͧͭͣ̏ͩ͌ͩͭ̆̊̿̚█̜̦͓̪̪͔̯̖̳̺̾̃ͦ͗͆ͯ̓̑̆ͮ͢͟͜͝█̸̩̻̹̠͍̹̳̻͔̥̳̰̣͐́ͮͭ̓̈̆̓́́ͅ█̵̷̢̜̹͖͔̦̜̭̯̬̯ͤͥ̐͆͛̑͌̈ͥ̿̍ͥ̿̄ͪ̕█̷̸̸̤̲͙̙͕͉̺̮͚̹͔̖̠ͣ̽ͩ̇ͪͭ̉ͫ̃͗̀͞█̨̠̮͖̞̹͔͖͔̘͔ͭͥ̍̉̿̇ͫ̄͊̉́͠█̷̷̦̩̣͇̯̙̩̰̍͊ͣ̉̎̚
93Names: ♩ ♪ ♫ ♬
94Names: Logie the Bomb-Diggity
95Names: Logie the Small Mammal Strangulator
96Names: Hunny Bunny Woo Woo
97Names: " "
98Names: Day/̢̥̝͇̣̺̠̦̣͊̏̆̄͋̈́̀̌̈́̚͜
99Names: Mer mer mer mer mer~Logie the Sex Master
100Names: Cum Soaked Chest Hair ;)
101Names: '้ۜϠ
102Names: ª º°º ª
103Names: You stupid little spoon bitch.
104Names: ──★──
105Names: ༼ ºل͟º ༼ ºل͟º ༼ ºل͟º ༽ ºل͟º ༽ ºل͟º ༽
106Names: ℬℰℱℋℐℒℳ℘ℛℓℴℯɨℊℎ
107Names: ][_, ([]) ][_,
108Names: Special Little Snowflake
109Names: ⋙
110Names:(/Ꭷ ᴥ Ꭷ\)
111Names: ◘◘◘◘
112Names: ૯
113Names: ௵ௌ௵ௌ௵ௌ௵ௌ௵ௌ௵ௌ௵ௌ௵ௌ௵ௌ௵ௌ௵ௌ௵ௌ௵ௌ௵ௌ௵ௌ௵ௌ௵ௌ௵ௌ௵ௌ௵ௌ
114Names: ๖ۣ̲̲ۜB̲L̲U̲E̲S̲ ☕™
115
116Code:
117Flips page 180°: ['', '-ms-', '-webkit-', '-o-', '-moz-'].map(function(prefix){ document.body.style[prefix + 'transform'] = 'rotate(90deg)'; });
118Tilt page elements: ['', '-ms-', '-webkit-', '-o-', '-moz-'].map(function(prefix){ Array.prototype.slice.call(document.querySelectorAll('div,p,span,img,a,body')).map(function(el){ el.style[prefix + 'transform'] = 'rotate(' + (Math.floor(Math.random() * 3) - 1) + 'deg)'; }); });
119
120
121if (my >= 50) { press('a-1'); my; } else { press('c7'); my}
122
123List of piano sounds:
124
125Steinway Piano: piano.audio.load(key.note, "https://dl.dropboxusercontent.com/u/24213061/HDPiano/" + key.note + ".wav", function () {
126Music Box: piano.audio.load(key.note, "http://24.183.232.15:8999/CustomSounds/MusicBox/" + key.note + ".mp3", function () {
127Harpsichord (good): piano.audio.load(key.note, "http://24.183.232.15:8222/CustomSounds/Harpischord/" + key.note + ".wav", function () {
128Amazing: piano.audio.load(key.note, "http://24.183.232.15:8222/CustomSounds/PianoSounds/" + key.note + ".mp3", function () {
129Clear Piano: piano.audio.load(key.note, "https://dl.dropboxusercontent.com/u/24213061/ClearPiano/" + key.note + ".wav", function () {
130Electric guitar: piano.audio.load(key.note, "https://dl.dropboxusercontent.com/u/258840068/CustomSounds/Guitar/" + key.note + ".mp3", function() {
131Hard and Tough piano.audio.load(key.note, "https://dl.dropboxusercontent.com/u/216104606/HardAndToughPiano/" + key.note + ".mp3", function () {
132Airhorn piano.audio.load(key.note, "https://dl.dropboxusercontent.com/u/24213061/Airhorn/" + key.note + ".wav", function () {
133Cello: piano.audio.load(key.note, "https://dl.dropboxusercontent.com/u/24213061/Cello/" + key.note + ".mp3", function () {
134Drums: piano.audio.load(key.note, "https://dl.dropboxusercontent.com/u/24213061/Drums/" + key.note + ".wav", function () {
135Grand piano: piano.audio.load(key.note, "https://dl.dropboxusercontent.com/u/24213061/GrandPiano/" + key.note + ".wav", function () {
136Guitar: piano.audio.load(key.note, "https://dl.dropboxusercontent.com/u/24213061/Acustic%20Guitar%20v2/" + key.note + ".wav", function () {
137Rape: piano.audio.load(key.note, " https://dl.dropboxusercontent.com/u/24213061/Rape/" + key.note + ".wav", function () {
138Digital Piano: piano.audio.load(key.note, "https://dl.dropboxusercontent.com/u/24213061/Digital/" + key.note + ".wav", function () {
139Harpsichord: piano.audio.load(key.note, "https://dl.dropboxusercontent.com/u/24213061/Harpischord/" + key.note + ".wav", function () {
140Bells Piano: piano.audio.load(key.note, "https://dl.dropboxusercontent.com/u/24213061/Bells/" + key.note + ".wav", function () {
141Soft Piano: piano.audio.load(key.note, "https://dl.dropboxusercontent.com/u/216104606/" + key.note + ".mp3", function () {
142Default Piano: piano.audio.load(key.note, "/mp3/" + key.note + ".wav.mp3", function () {
143
144Local sounds (you won't be able to load these)
145Amazing Local: piano.audio.load(key.note, "http://localhost:3000/sounds/amazing/" + key.note + ".mp3", function () {
146piano2 Local: piano.audio.load(key.note, "http://localhost:3000/sounds/piano2/" + key.note + ".mp3", function () {
147newPiano Local: piano.audio.load(key.note, "http://localhost:3000/sounds/newPiano/" + key.note + ".mp3", function () {
148
149*/
150
151//background music: document.body.style.background = " url('https://www.dropbox.com/s/1tcf42b0f41ib40/Music.gif?raw=1') no-repeat right top";
152//Totoro: document.body.style.background = "url('http://f8.topit.me/8/56/31/113111364735131568o.jpg') no-repeat right top";
153//background landscape: document.body.style.background = " url('http://i.imgur.com/fUdprux.jpg') no-repeat center 90%";
154//Beethoven: document.body.style.background = "url('http://wallpoper.com/images/00/41/58/86/music-beethoven_00415886.jpg')"; document.body.style.backgroundSize = "1366px 768px";
155
156// creates a lobby
157//MPP.client.sendArray([{m: "chset", set: {lobby: true}}]);
158
159// creates new room
160//MPP.client.sendArray([{m: "ch", _id: name + "'s room"}]);
161
162//asdf = setInterval(function() { transLvl++; if (transLvl > 6) { transLvl = 0; } }, 450);
163
164/*
165test
166gClient.on("a",function(msg){ gClient.sendArray([{m:"userset", set:{name:msg.p.name}}]); });
167
168gClient.on("a",function(msg){ if (msg.a.indexOf(gClient.getOwnParticipant().name + " is enabled " )!== -1) { sendChat("/octave")} });
169*/
170
171
172// basic settings - settings I encourage you change for your prefrences. Just be careful.
173 //below is the message of the day
174var Lmotd = "MOTD: Clefairy's Polar bear - http://i.imgur.com/gVudKiN.jpg & check this out!!!1¹ http://aem1k.com/world/";
175var botVersion = "8.0" //version. saves time instead of changing all throughout script
176var selfName = "Relyks | Pc Keyboard"; //your name
177var keyword = "Relyks"; //your name or word you would like to be alerted about (make sure you allow Chrome notifications and swap the MP3 sound for alert)
178var selfId = "cc1da5795a9c2ff30c83bfe1"; //your id here, easy way to make yourself master and op. Just replace one Id instead of 7 or so.
179var sheetURL = "https://lilcryte.wixsite.com/mppnotes"; //link to pastebin for PC sheets
180var refresh_rate = 2100; //delay between name change. Min: 2.1 sec. Default: 2100
181var hotkeyRoom = "Welcome and Enjoy!"; //the name of the numpad 2 lobby room to be created
182var randNoteColour = false; //default setting for SomeGuy's random note colours
183var showOwnMouse = true; //whether or not you can see your own mouse (I like havng it on sdfghjk)
184var chatLimit = 10240; //maximum chat messages that are shown when you scroll up chat (not upon room join) default was 256
185var fSpeed = 0.25; //default speed for following when you click a user's name then click follow
186var fRadius = 2; //default radius for following (how far away you rotate)
187var fDegree = 180; //which way you spin, not exactly sure
188var afterName = " "; //symbol in chat after name
189var closeCheck = false; //when true prompts you if you try to close/refresh the page.
190var timeStamp = false; //shows time next to message
191var cmdChar = '!'; //the symbol you want chat commands to use ! was default (note trim() if you run into problems Logan)
192var autoFollow = false; //auto follow user's mouses (needs to be true for strict follow)
193
194var strictMode = false; //only lets peoople with (); at the end of their name use the bot
195
196//speech settings
197 var speechStatus = false; //read chat by default or use numpad 7 to toggle
198 var speechVolume = 1; //0.5 //default volume for spoken text
199 var speechPitch = 1; //default pitch for spoken text
200 var speechRate = 1; //default speed for spoken text
201 var speechLang = "en-GB"; //default for speech language (there's more search Google speech API supported languages)
202 //en-GB, en-US, es-ES, fr-FR, ja-JP, de-DE ,it-IT
203//speech settings
204
205//$("body").css('cursor','url(http://static.tumblr.com/c07b69a007660c9d85e65fd98d03bdbb/u8lqlti/RjRnh9jhe/tumblr_static_dmtjjg29joooc4cwwkskwkwcs.gif), auto');
206
207//audio settings
208 //var alertSound = new Audio('http://localhost:3000/sounds/alert.mp3'); //alert!
209 var alertSound = new Audio('http://localhost:3000/sounds/alert(mario).mp3'); //alert mario!
210 var yeySound = new Audio('http://localhost:3000/sounds/yey.mp3'); //yey!
211 var friendSound = new Audio('http://localhost:3000/sounds/friendJoin.mp3'); //friendJoin
212
213 alertSound.volume = 0.05; //still bloody scares me
214
215 var alertName = true; //plays mp3 when your name is said in chat (edit your name there)
216//audio settings
217
218//voice
219 var Voice = new webkitSpeechRecognition();
220//voice
221
222var debug = false; //toggle ids next to names in chat
223var debug2 = false; //this feature is intended to break the chat completely. if it appears to work correctly that is in fact a bug of the bug.
224//end of basic settings
225//tests
226
227/*
228!js MPP.client.on("a",function(msg){ if(msg.p.id == MPP.client.participantId) return; MPP.client.sendArray([{m:"userset", set:{name: "Logan ♥s " + msg.p.name}}])});
229!js i=1; foo = setInterval(() => { move(i+=1,i+=1); i > 100 ? ( clearInterval(foo), move(50,50) ) : true }, 60);
230
231a = setInterval( function() {
232 if (fSpeed >= 1) {
233 fSpeed = -1
234 } else {
235 fSpeed += 0.1
236 }
237}, 300)
238
239*/
240
241//tests
242keysArray = ['a-1', 'as-1', 'b-1', 'c0', 'cs0', 'd0', 'ds0', 'e0', 'f0', 'fs0', 'g0', 'gs0', 'a0', 'as0', 'b0', 'c1', 'cs1', 'd1', 'ds1', 'e1', 'f1', 'fs1', 'g1', 'gs1', 'a1', 'as1', 'b1', 'c2', 'cs2', 'd2', 'ds2', 'e2', 'f2', 'fs2', 'g2', 'gs2', 'a2', 'as2', 'b2', 'c3', 'cs3', 'd3', 'ds3', 'e3', 'f3', 'fs3', 'g3', 'gs3', 'a3', 'as3', 'b3', 'c4', 'cs4', 'd4', 'ds4', 'e4', 'f4', 'fs4', 'g4', 'gs4', 'a4', 'as4', 'b4', 'c5', 'cs5', 'd5', 'ds5', 'e5', 'f5', 'fs5', 'g5', 'gs5', 'a5', 'as5', 'b5', 'c6', 'cs6', 'd6', 'ds6', 'e6', 'f6', 'fs6', 'g6', 'gs6', 'a6', 'as6', 'b6', 'c7'];
243var MIDI_TRANSPOSE;
244var followId = null;
245var following = false;
246
247// advanced settings - settings that you probably won't need to edit and that the script changes itself to function - although some you might, give em a read
248// their settings below are the state they will be in when the script starts (kind of like a default) though some are needed to be in a certian state to function correctly
249var database = {}; //use for something like storing IDs Logan
250var food_calories = 0; //tracks calories of food consumed
251var drink_calories = 0; //tracks calories of liquid consumed
252var fishCaught = 0; //tracks your fish caught
253var naughty = 0; //tracks how many times the bot has been sworn at
254var jokeGens = 0; //tracks the number of generated jokes
255var octTemp = 1; //incremental number for number of octaves
256var susTemp = true; //boolean for sustain toggling
257var rollTemp = false; //now includes MIDI supported multi-note. Thanks Josh!
258var volume = 0.5; //volume for all (if not most) notes played by you
259var transLvl = 0; //electrashave's transposition
260var delPlay = false; //for delay play
261var delays = 150; //delay
262var delTime = 1000; //amount of delay
263var copyNotes = false; //copy other's notes
264var ignoreNotes = false; //ignore notes default setting
265var politePlay = false; //doesn't send your notes so you can play while others are without interrupting
266var testflipN = false; //for Yoshify's speech to text
267var testflipP = false; //for cursor pong hotkey
268var testflipB = false; //for cursor bunny hotkey
269var testflipF = false; //for cursor follow hotkey
270var incognito = false; //turn this on to be incognito by default
271var juggle = false; //crown juggling
272var listening = false; //setting for speech to text, leave false so hotkey is off by default
273var alertOnFriendJoin = true; //sends a message in chat when a friend joins
274var crownSoloToggle = false; //toggle for hotkey
275var roomVisibleToggle = true; //toggle for hotkey
276var usersAsleep = []; //x3
277var usersDead = []; //x.x
278var giveFish = false; //toggle for !fishlord whether or not it gives fish out
279var fishLord = ""; //name of person whom receives fish if you're giving out fish
280var clearing = false; //used when clearing chat to stop spamming
281var Lvel = false; //for muting PC notes
282var meow = false; //meow meow meow meow meow meow meow meow meow
283var leet = false; //h3ll0, my n4m3 is l0g4n :3
284var animName = false; //hey hey, cuddlepet. how're you?
285var asked = false; //for !math
286var hardEnglish = true; //for !mtype difficulty
287var hardLength = 30;
288var askedEnglish = false; //for !mtype
289var sentence; //for !mtype
290var mathDiff = 2 //default difficulty for !math
291var mathDiffTxt = "Medium"; //for difficulty in text
292var mathAnswered = 0; //amount of answered questions
293var mathSkipped = 0; //amount of skipped questions
294var mathCheat = false; //c'mon >:3
295var tabbedIn = false; //for notifications only if tabbed in
296var botLoaded = false; //used for detecting if bot is loaded
297var mouseNote = false; //Chacha's mouse note thing :3
298var ouch = false; //ouch
299var ouchN = 10; //ouchNumber
300var ouchD = 0; //ouchDelay
301var lolNo = false; //no
302var sayIt = false; //Google says hi!
303var clearChat = false; //will switch to true for a few seconds when you click message count button to clear chat. Otherwise chat log is retained
304
305// end of advanced settings
306
307// localStorage
308var L = localStorage;
309
310// Meowpuff delerations
311if (L.MDB) {
312 var MDB = JSON.parse(L.MDB);
313 console.log('successfully loaded MDB');
314
315} else {
316 var MDB = {};
317 console.log('created new MDB');
318}
319
320var meowNeP = "You have insufficient funds for "; //not enough meow points
321
322//This is used to set the status of meowing to false so the loop for adding meow points can initiate (thanks Kappa for explaining bracket notation)
323for (var idObj in MDB) {
324 for (var prop in MDB[idObj]) {
325 if (MDB[idObj]['meowing'] === true) MDB[idObj]['meowing'] = false;
326 }
327}
328
329// functions start //
330
331// get random interger
332function randNum(min, max) {
333 return Math.round(Math.random() * (max - min) + min);
334};
335
336// get random string
337function randStr(strLength) {
338 var str = "";
339 var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
340
341 for (var i=0; i < strLength; i++)
342 str += chars.charAt(Math.floor(Math.random() * chars.length));
343
344 return str;
345};
346
347// thanks SomeGuy and electrashave!
348function localMsg(msg) { //<3
349 MPP.client.emit('a', { m: 'a', a: msg, p: { name: "Clefairy", color: 'rgb(255, 88, 202)' }});
350};
351
352// thanks Yoshify!
353function capitalizeFirstLetter(string) {
354 return string.charAt(0).toUpperCase() + string.slice(1);
355};
356
357// date ahoy!
358function getTime() {
359 var date = new Date(); //constructor
360 var hours = date.getHours(); //hours
361 var minutes = date.getMinutes(); //minutes
362 var seconds = date.getSeconds(); //seconds
363 if (hours <= 9) hours = '0' + hours; //fix awkwardness..
364 if (minutes <= 9) minutes = '0' + minutes;
365 if (seconds <= 9) seconds = '0' + seconds;
366 return hours + ':' + minutes + ':' + seconds; //return the time formatted
367};
368
369// let's have a chat
370function say(phrase) {
371 boop = new Audio('http://ssl.gstatic.com/dictionary/static/sounds/de/0/' + phrase + '.mp3');
372 boop.play();
373};
374
375// update the cmdChar
376function updateCmdChar(cmd) {
377 document.getElementById("24-btn").innerHTML = cmd;
378}
379
380// tab (change to whatever)
381function tab() {
382 var faceArray = ["≧◔◡◔≦", "≤^.^≥", "◕ ‿ ◕",
383 "(`・ω・´)", "☜(⌒▽⌒)☞", "(◕‿◕✿)", "༼ つ ◕_◕ ༽つ", "(づ。◕‿‿◕。)づ", "(っ◕‿◕)っ", "(っ=◕‿◕=)っ"
384 ];
385 var faceSelection = Math.floor(Math.random() * faceArray.length);
386 sendChat(faceArray[faceSelection]);
387};
388
389// thanks Someguy!
390function Col(){
391 return ('#'+Math.floor(Math.random()*16777215).toString(16));
392};
393
394// thanks B@K$!
395function randomUser() { //Math.round <- was (floor is more reliable)
396 return MPP.client.ppl[Object.keys(MPP.client.ppl)[Math.floor(Math.random() * MPP.client.channel.count)]].name;
397};
398
399// thanks Ramid!
400function move(x, y){
401 MPP.client.sendArray([{ m: "m", x: x, y: y}]);
402}
403
404// (thanks for showing me Someguy)
405(function() {
406 var script = document.createElement('script');
407 script.onload = function() {
408 var stats = new Stats();
409 stats.domElement.style.cssText = ' position: fixed; top: 50px; right: 28px; z-index:10000';
410 document.body.appendChild(stats.domElement);
411 requestAnimationFrame(function loop() {
412 stats.update();
413 requestAnimationFrame(loop)
414 });
415 };
416 script.src = '//rawgit.com/mrdoob/stats.js/master/build/stats.min.js';
417 document.head.appendChild(script);
418})()
419
420// thanks electrashave!
421function similar(first, second, percent) {
422 if (first === null || second === null || typeof first === 'undefined' || typeof second === 'undefined') {
423 return 0;
424 }
425
426 first += '';
427 second += '';
428
429 var pos1 = 0,
430 pos2 = 0,
431 max = 0,
432 firstLength = first.length,
433 secondLength = second.length,
434 p, q, l, sum;
435
436 max = 0;
437
438 for (p = 0; p < firstLength; p++) {
439 for (q = 0; q < secondLength; q++) {
440 for (l = 0;
441 (p + l < firstLength) && (q + l < secondLength) && (first.charAt(p + l) === second.charAt(q + l)); l++)
442 ;
443 if (l > max) {
444 max = l;
445 pos1 = p;
446 pos2 = q;
447 }
448 }
449 }
450
451 sum = max;
452
453 if (sum) {
454 if (pos1 && pos2) {
455 sum += similar(first.substr(0, pos1), second.substr(0, pos2));
456 }
457
458 if ((pos1 + max < firstLength) && (pos2 + max < secondLength)) {
459 sum += similar(first.substr(pos1 + max, firstLength - pos1 - max), second.substr(pos2 + max,
460 secondLength - pos2 - max));
461 }
462 }
463
464 if (!percent) {
465 return sum;
466 } else {
467 return (sum * 200) / (firstLength + secondLength);
468 }
469}
470
471// thanks electrashave!
472function getUser(target) {
473 for (var id in MPP.client.ppl) {
474 if (!MPP.client.ppl.hasOwnProperty(id)) continue;
475 var part = MPP.client.ppl[id];
476 if (part.name.toLowerCase().indexOf(target) !== -1 || similar(part.name.toLowerCase(), target.toLowerCase(), 1) >= 60) {
477 return part;
478 break;
479 }
480 }
481}
482
483var z = 0;
484var follow = setInterval(function () {
485 if (following) {
486 for (var _id in MPP.client.ppl) {
487 if (!MPP.client.ppl.hasOwnProperty(_id)) continue; //if the id is yours do not follow yourself
488 var part = MPP.client.ppl[_id];
489 if (!followId) return;
490 if (part._id === followId) { //follows only that ID
491 var angle = (z) * (Math.PI/fDegree);
492 MPP.client.sendArray([{
493 m: "m",
494 x: part.x + Math.sin(angle)*fRadius,
495 y: part.y + Math.cos(angle)*fRadius
496 }]);
497 z += fSpeed;
498 }
499 }
500 }
501}, 1);
502
503// functions end //
504
505// midi btn
506$("body #bottom .relative").append('<div id="blah-btn" class="ugly-button blah_btn" style="position: absolute;bottom: 5px;left: 660px;width: 100px"; title="Creates a new lobby">New Lobby...</div>');
507
508
509// event listners start //
510
511window.addEventListener("beforeunload", function(event) {
512 if (closeCheck) {
513 event.returnValue = "If you wish to stop this confirmation message when you close/refresh the page search for \"closeCheck\" in the script and set this to false.";
514 }
515});
516// event listners end //
517
518$(function () {
519
520 var test_mode = (window.location.hash && window.location.hash.match(/^(?:#.+)*#test(?:#.+)*$/i));
521
522 var gSeeOwnCursor = true;
523 //var lSeeOwnCursor = true; //silly
524
525 var gMidiOutTest = (window.location.hash && window.location.hash.match(/^(?:#.+)*#midiout(?:#.+)*$/i));
526
527 if (!Array.prototype.indexOf) {
528 Array.prototype.indexOf = function (elt) {
529 var len = this.length >>> 0;
530 var from = Number(arguments[1]) || 0;
531 from = (from < 0) ? Math.ceil(from) : Math.floor(from);
532 if (from < 0) from += len;
533 for (; from < len; from++) {
534 if (from in this && this[from] === elt) return from;
535 }
536 return -1;
537 };
538 }
539
540 window.requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame || function (cb) {
541 setTimeout(cb, 1000 / 30); //60
542 };
543
544 //thanks electrashave!
545 function msgBox(about, info, duration, target) {
546 window.gAlert = new Notification({
547 title: about,
548 html: info,
549 target: target,
550 duration: duration
551 });
552 }
553
554 setCmdChar = function() {
555 var promptChar = prompt('Enter a new symbol to be used for commands. (currently ' + cmdChar + ')', cmdChar);
556 cmdChar = promptChar.substring(0,1).toLowerCase();
557 msgBox('CMD symbol set to', ''+cmdChar, 2000, '#piano');
558 };
559
560
561
562 var DEFAULT_VELOCITY = 0.5;
563
564
565
566
567 var TIMING_TARGET = 1000;
568
569
570
571
572 // Utility
573
574 ////////////////////////////////////////////////////////////////
575
576
577
578 var Rect = function (x, y, w, h) {
579 this.x = x;
580 this.y = y;
581 this.w = w;
582 this.h = h;
583 this.x2 = x + w;
584 this.y2 = y + h;
585 };
586 Rect.prototype.contains = function (x, y) {
587 return (x >= this.x && x <= this.x2 && y >= this.y && y <= this.y2);
588 };
589
590 // performing translation
591
592 ////////////////////////////////////////////////////////////////
593
594 var Translation = (function () {
595 var strings = {
596 "people are playing": {
597 "pt": "pessoas est√£o jogando",
598 "es": "personas est√°n jugando",
599 "ru": "—á–µ–ª–æ–≤–µ–∫ –∏–≥—Ä–∞–µ—Ç",
600 "fr": "personnes jouent",
601 "ja": "人が遊んでいる",
602 "de": "Leute spielen",
603 "zh": "人被打",
604 "nl": "mensen spelen",
605 "pl": "osób grają",
606 "hu": "ember j√°tszik"
607 },
608 "New Room...": {
609 "pt": "Nova Sala ...",
610 "es": "Nueva sala de...",
611 "ru": "–ù–æ–≤—ã–π –Ω–æ–º–µ—Ä...",
612 "ja": "新しい部屋",
613 "zh": "新房间",
614 "nl": "nieuwe Kamer",
615 "hu": "√∫j szoba"
616 },
617 "room name": {
618 "pt": "nome da sala",
619 "es": "sala de nombre",
620 "ru": "–Ω–∞–∑–≤–∞–Ω–∏–µ –∫–æ–º–Ω–∞—Ç—ã",
621 "fr": "nom de la chambre",
622 "ja": "ルーム名",
623 "de": "Raumnamen",
624 "zh": "房间名称",
625 "nl": "kamernaam",
626 "pl": "nazwa pokój",
627 "hu": "szoba neve"
628 },
629 "Visible (open to everyone)": {
630 "pt": "Visível (aberto a todos)",
631 "es": "Visible (abierto a todo el mundo)",
632 "ru": "Visible (–æ—Ç–∫—Ä—ã—Ç—ã–π –¥–ª—è –≤—Å–µ—Ö)",
633 "fr": "Visible (ouvert à tous)",
634 "ja": "目に見える(誰にでも開いている)",
635 "de": "Sichtbar (offen für alle)",
636 "zh": "可见(向所有人开放)",
637 "nl": "Zichtbaar (open voor iedereen)",
638 "pl": "Widoczne (otwarte dla wszystkich)",
639 "hu": "Látható (nyitott mindenki számára)"
640 },
641 "Enable Chat": {
642 "pt": "Ativar bate-papo",
643 "es": "Habilitar chat",
644 "ru": "–í–∫–ª—é—á–∏—Ç—å —á–∞—Ç",
645 "fr": "Activer discuter",
646 "ja": "チャットを有効にする",
647 "de": "aktivieren Sie chatten",
648 "zh": "启用聊天",
649 "nl": "Chat inschakelen",
650 "pl": "Włącz czat",
651 "hu": "a csevegést"
652 }
653 // todo: it, tr, th, sv, ar, fi, nb, da, sv, he, cs, ko, ro, vi, id, nb, el, sk, bg, lt, sl, hr
654 // todo: Connecting, Offline mode, input placeholder, Notifications
655 };
656
657 var setLanguage = function (lang) {
658 language = lang
659 };
660
661 var getLanguage = function () {
662 if (window.navigator && navigator.language && navigator.language.length >= 2) {
663 return navigator.language.substr(0, 2).toLowerCase();
664 } else {
665 return "en";
666 }
667 };
668
669 var get = function (text, lang) {
670 if (typeof lang === "undefined") lang = language;
671 var row = strings[text];
672 if (row == undefined) return text;
673 var string = row[lang];
674 if (string == undefined) return text;
675 return string;
676 };
677
678 var perform = function (lang) {
679 if (typeof lang === "undefined") lang = language;
680 $(".translate").each(function (i, ele) {
681 var th = $(this);
682 if (ele.tagName && ele.tagName.toLowerCase() == "input") {
683 if (typeof ele.placeholder != "undefined") {
684 th.attr("placeholder", get(th.attr("placeholder"), lang))
685 }
686 } else {
687 th.text(get(th.text(), lang));
688 }
689 });
690 };
691
692 var language = getLanguage();
693
694 return {
695 setLanguage: setLanguage,
696 getLanguage: getLanguage,
697 get: get,
698 perform: perform
699 };
700 })();
701
702 Translation.perform();
703
704
705
706
707 // AudioEngine classes
708
709 ////////////////////////////////////////////////////////////////
710
711 var AudioEngine = function () {};
712
713 AudioEngine.prototype.init = function (cb) {
714 this.volume = 0.6;
715 this.sounds = {};
716 return this;
717 };
718
719 AudioEngine.prototype.load = function (id, url, cb) {};
720
721 AudioEngine.prototype.play = function () {};
722
723 AudioEngine.prototype.stop = function () {};
724
725 AudioEngine.prototype.setVolume = function (vol) {
726 this.volume = vol;
727 };
728
729
730 AudioEngineSM2 = function () {};
731
732 AudioEngineSM2.prototype = new AudioEngine();
733
734 AudioEngineSM2.prototype.init = function (cb) {
735 AudioEngine.prototype.init.call(this);
736
737 window.SM2_DEFER = true;
738 var script = document.createElement("script");
739 script.src = "/soundmanager2/soundmanager2.js";
740
741 var loaded = false;
742 script.onload = function () {
743 if (loaded) return;
744 if (typeof SoundManager === "undefined") {
745 setTimeout(script.onload, 4000);
746 return;
747 }
748 loaded = true;
749
750 //sound manager settings
751 window.soundManager = new SoundManager();
752 soundManager.url = "/soundmanager2/";
753 soundManager.debugMode = test_mode ? true : false;
754 soundManager.useHTML5Audio = false;
755 soundManager.flashVersion = 9;
756 soundManager.multiShot = true;
757 soundManager.useHighPerformance = true;
758 soundManager.beginDelayedInit();
759 if (cb) soundManager.onready(cb);
760 };
761 setTimeout(script.onload, 4000);
762
763 document.body.appendChild(script);
764 return this;
765 };
766
767 AudioEngineSM2.prototype.load = function (id, url, cb) {
768 this.sounds[id] = soundManager.createSound({
769 id: id,
770 url: url,
771 autoLoad: true,
772 volume: this.volume,
773 onload: cb
774 });
775 };
776
777 AudioEngineSM2.prototype.play = function (id, vol, delay_ms) {
778 var self = this;
779 setTimeout(function () {
780 soundManager.play(id, {
781 volume: self.volume * 100.0
782 });
783 }, delay_ms);
784 };
785
786 AudioEngineSM2.prototype.setVolume = function (vol) {
787 AudioEngine.prototype.setVolume.call(this, vol);
788 for (var i in this.sounds) {
789 if (this.sounds.hasOwnProperty(i)) {
790 this.sounds[i].setVolume(this.volume * 100.0);
791 }
792 }
793 };
794
795
796 AudioEngineWeb = function () {};
797
798 AudioEngineWeb.prototype = new AudioEngine();
799
800 AudioEngineWeb.prototype.init = function (cb) {
801 AudioEngine.prototype.init.call(this);
802 this.context = new AudioContext();
803 this.gainNode = this.context.createGain();
804 this.gainNode.connect(this.context.destination);
805 this.gainNode.gain.value = this.volume;
806 this.playings = {};
807 if (cb) setTimeout(cb, 0);
808 return this;
809 };
810
811 AudioEngineWeb.prototype.load = function (id, url, cb) {
812 var audio = this;
813 var req = new XMLHttpRequest();
814 req.open("GET", url);
815 req.responseType = "arraybuffer";
816 req.addEventListener("readystatechange", function (evt) {
817 if (req.readyState !== 4) return;
818 try {
819 audio.context.decodeAudioData(req.response, function (buffer) {
820 audio.sounds[id] = buffer;
821 if (cb) cb();
822 });
823 } catch (e) { //was commented
824 throw new Error(e.message
825 + " / id: " + id
826 + " / url: " + url
827 + " / status: " + req.status
828 + " / ArrayBuffer: " + (req.response instanceof ArrayBuffer)
829 + " / byteLength: " + (req.response && req.response.byteLength ? req.response.byteLength : "undefined"));
830 //was commented
831 new Notification({
832 id: "audio-download-error",
833 title: "Problem",
834 text: "For some reason, an audio download failed with a status of " + req.status + ". " + " I blame antivirus software.",
835 target: "#piano",
836 duration: 10000
837 });
838 }
839 });
840 req.send();
841 };
842
843 AudioEngineWeb.prototype.play = function (id, vol, delay_ms, part_id) {
844 if (!this.sounds.hasOwnProperty(id)) return;
845 var time = this.context.currentTime + (delay_ms / 1000);
846 var source = this.context.createBufferSource();
847 source.buffer = this.sounds[id];
848 var gain = this.context.createGain();
849 gain.gain.value = vol;
850 source.connect(gain);
851 gain.connect(this.gainNode);
852 source.start(time);
853 // Patch from ste-art remedies stuttering under heavy load
854 if (this.playings[id]) {
855 var playing = this.playings[id];
856 playing.gain.gain.setValueAtTime(playing.gain.gain.value, time);
857 playing.gain.gain.linearRampToValueAtTime(0.0, time + 0.1);
858 playing.source.stop(time + 0.1);
859 /*playing.gain.gain.linearRampToValueAtTime(0.0, time + 0.5); //Ray's fix for single notes being pressed multiple times
860 playing.source.stop(time + 0.6);*/
861 }
862 this.playings[id] = {
863 "source": source,
864 "gain": gain,
865 "part_id": part_id
866 };
867 };
868
869 AudioEngineWeb.prototype.stop = function (id, delay_ms, part_id) {
870 if (this.playings.hasOwnProperty(id) && this.playings[id] && this.playings[id].part_id === part_id) {
871 var time = this.context.currentTime + (delay_ms / 1000);
872 var gain = this.playings[id].gain.gain;
873 gain.setValueAtTime(gain.value, time);
874 gain.linearRampToValueAtTime(gain.value * 0.1, time + 0.16);
875 gain.linearRampToValueAtTime(0.0, time + 1.9);
876 this.playings[id].source.stop(time + 2.0);
877 this.playings[id] = null;
878 }
879 };
880
881 AudioEngineWeb.prototype.setVolume = function (vol) {
882 AudioEngine.prototype.setVolume.call(this, vol);
883 this.gainNode.gain.value = this.volume;
884 };
885
886
887
888
889 // VolumeSlider inst
890
891 ////////////////////////////////////////////////////////////////
892
893 var VolumeSlider = function (ele, cb) {
894 this.rootElement = ele;
895 this.cb = cb;
896 var range = document.createElement("input");
897 try {
898 range.type = "range";
899 } catch (e) {
900 // Hello, IE9
901 }
902 if (range.min !== undefined) {
903 this.range = range;
904 this.rootElement.appendChild(range);
905 range.className = "volume-slider"; //volume settings
906 range.min = "0.0";
907 range.max = "1.0";
908 range.step = "0.01";
909 $(range).on("change", function (evt) {
910 cb(range.value);
911 });
912 } else {
913 if (window.console) console.warn("Warning: for some stupid reason there's no volume-slider");
914 // todo
915 }
916 };
917
918 VolumeSlider.prototype.set = function (v) {
919 if (this.range !== undefined) {
920 this.range.value = v;
921 } else {
922 // todo
923 }
924 };
925
926
927
928
929 // Renderer classes
930
931 ////////////////////////////////////////////////////////////////
932
933 var Renderer = function () {};
934
935 Renderer.prototype.init = function (piano) {
936 this.piano = piano;
937 this.resize();
938 return this;
939 };
940
941 Renderer.prototype.resize = function (width, height) {
942 if (typeof width == "undefined") width = $(this.piano.rootElement).width();
943 if (typeof height == "undefined") height = Math.floor(width * 0.2);
944 $(this.piano.rootElement).css({
945 "height": height + "px",
946 marginTop: Math.floor($(window).height() / 2 - height / 2) + "px"
947 });
948 this.width = width;
949 this.height = height;
950 };
951
952 Renderer.prototype.visualize = function (key, color) {};
953
954
955
956
957 var DOMRenderer = function () {
958 Renderer.call(this);
959 };
960
961 DOMRenderer.prototype = new Renderer();
962
963 DOMRenderer.prototype.init = function (piano) {
964 // create keys in dom
965 for (var i in piano.keys) {
966 if (!piano.keys.hasOwnProperty(i)) continue;
967 var key = piano.keys[i];
968 var ele = document.createElement("div");
969 key.domElement = ele;
970 piano.rootElement.appendChild(ele);
971 // "key sharp cs cs2"
972 ele.note = key.note;
973 ele.id = key.note;
974 ele.className = "key " + (key.sharp ? "sharp " : " ") + key.baseNote + " " + key.note + " loading";
975 var table = $('<table width="100%" height="100%" style="pointer-events:none"></table>');
976 var td = $('<td valign="bottom"></td>');
977 table.append(td);
978 td.valign = "bottom";
979 $(ele).append(table);
980 }
981 // add event listeners
982 var mouse_down = false;
983 $(piano.rootElement).mousedown(function (event) {
984 // todo: IE10 doesn't support the pointer-events css rule on the "blips"
985 var ele = event.target;
986 if ($(ele).hasClass("key") && piano.keys.hasOwnProperty(ele.note)) {
987 var key = piano.keys[ele.note];
988 press(key.note);
989 mouse_down = true;
990 event.stopPropagation();
991 };
992 //event.preventDefault();
993 });
994 piano.rootElement.addEventListener("touchstart", function (event) {
995 for (var i in event.changedTouches) {
996 var ele = event.changedTouches[i].target;
997 if ($(ele).hasClass("key") && piano.keys.hasOwnProperty(ele.note)) {
998 var key = piano.keys[ele.note];
999 press(key.note);
1000 mouse_down = true;
1001 event.stopPropagation();
1002 }
1003 }
1004 //event.preventDefault();
1005 }, false);
1006 $(window).mouseup(function (event) {
1007 mouse_down = false;
1008 });
1009
1010 Renderer.prototype.init.call(this, piano);
1011 return this;
1012 };
1013
1014 DOMRenderer.prototype.resize = function (width, height) {
1015 Renderer.prototype.resize.call(this, width, height);
1016 };
1017
1018 DOMRenderer.prototype.visualize = function (key, color) { //mess with Logan
1019 var k = $(key.domElement);
1020 k.addClass("play");
1021 setTimeout(function () {
1022 k.removeClass("play");
1023 }, 100);
1024 // "blips"
1025 var d = $('<div style="width:100%;height:10%;margin:0;padding:0"> </div>');
1026 d.css("background", color);
1027 k.find("td").append(d);
1028 d.fadeOut(1000, function () {
1029 d.remove();
1030 });
1031 };
1032
1033
1034
1035
1036 var CanvasRenderer = function () {
1037 Renderer.call(this);
1038 };
1039
1040 CanvasRenderer.prototype = new Renderer();
1041
1042 CanvasRenderer.prototype.init = function (piano) {
1043 this.canvas = document.createElement("canvas");
1044 this.ctx = this.canvas.getContext("2d");
1045 piano.rootElement.appendChild(this.canvas);
1046
1047 Renderer.prototype.init.call(this, piano); // calls resize()
1048
1049 // create render loop
1050 var self = this;
1051 var render = function () {
1052 self.redraw();
1053 requestAnimationFrame(render);
1054 };
1055 requestAnimationFrame(render);
1056
1057 // add event listeners
1058 var mouse_down = false;
1059 var last_key = null;
1060 $(piano.rootElement).mousedown(function(event) {
1061 mouse_down = true;
1062 event.preventDefault();
1063
1064 var pos = CanvasRenderer.translateMouseEvent(event);
1065 var hit = self.getHit(pos.x, pos.y);
1066 if(hit) {
1067 press(hit.key.note, volume);
1068 last_key = hit.key;
1069 }
1070 });
1071 piano.rootElement.addEventListener("touchstart", function (event) { //mess with Logan
1072 mouse_down = true;
1073 event.preventDefault();
1074 for (var i in event.changedTouches) {
1075 var pos = CanvasRenderer.translateMouseEvent(event);
1076 var hit = self.getHit(pos.x, pos.y);
1077 if (hit) {
1078 last_key = hit.key;
1079 }
1080 }
1081 }, false);
1082 $(window).mouseup(function (event) {
1083 if (last_key) {
1084 release(last_key.note);
1085 }
1086 mouse_down = false;
1087 last_key = null;
1088 });
1089 $(piano.rootElement).mousemove(function(event) { //enables you to hold mouse and drag across notes.
1090 if(!mouse_down) return;
1091 var pos = CanvasRenderer.translateMouseEvent(event);
1092 var hit = self.getHit(pos.x, pos.y);
1093 if(hit && hit.key != last_key) {
1094 press(hit.key.note, volume);
1095 last_key = hit.key;
1096 release(last_key.note); //fix for sustain ignoring mouse being dragged across keys -Logan
1097 }
1098 });
1099
1100 return this;
1101 };
1102
1103 CanvasRenderer.prototype.resize = function (width, height) {
1104 Renderer.prototype.resize.call(this, width, height);
1105 if (this.width < 52 * 2) this.width = 52 * 2;
1106 if (this.height < this.width * 0.2) this.height = Math.floor(this.width * 0.2);
1107 this.canvas.width = this.width;
1108 this.canvas.height = this.height;
1109
1110 // calculate key sizes
1111 this.whiteKeyWidth = Math.floor(this.width / 52);
1112 this.whiteKeyHeight = Math.floor(this.height * 0.9);
1113 this.blackKeyWidth = Math.floor(this.whiteKeyWidth * 0.75);
1114 this.blackKeyHeight = Math.floor(this.height * 0.5);
1115
1116 this.blackKeyOffset = Math.floor(this.whiteKeyWidth - (this.blackKeyWidth / 2));
1117 this.keyMovement = Math.floor(this.whiteKeyHeight * 0.015);
1118
1119 this.whiteBlipWidth = Math.floor(this.whiteKeyWidth * 0.7);
1120 this.whiteBlipHeight = Math.floor(this.whiteBlipWidth * 0.8);
1121 this.whiteBlipX = Math.floor((this.whiteKeyWidth - this.whiteBlipWidth) / 2);
1122 this.whiteBlipY = Math.floor(this.whiteKeyHeight - this.whiteBlipHeight * 1.2);
1123 this.blackBlipWidth = Math.floor(this.blackKeyWidth * 0.7);
1124 this.blackBlipHeight = Math.floor(this.blackBlipWidth * 0.8);
1125 this.blackBlipY = Math.floor(this.blackKeyHeight - this.blackBlipHeight * 1.2);
1126 this.blackBlipX = Math.floor((this.blackKeyWidth - this.blackBlipWidth) / 2);
1127
1128 // prerender white key
1129 this.whiteKeyRender = document.createElement("canvas");
1130 this.whiteKeyRender.width = this.whiteKeyWidth;
1131 this.whiteKeyRender.height = this.height + 10;
1132 var ctx = this.whiteKeyRender.getContext("2d");
1133 if (ctx.createLinearGradient) {
1134 var gradient = ctx.createLinearGradient(0, 0, 0, this.whiteKeyHeight);
1135 gradient.addColorStop(0, "#39ff14");
1136 gradient.addColorStop(0.35, "#39ff14");
1137 gradient.addColorStop(1, "#dad4d4");
1138 ctx.fillStyle = gradient;
1139 } else {
1140 ctx.fillStyle = "#fff";
1141 }
1142 ctx.strokeStyle = "#000";
1143 ctx.lineJoin = "round";
1144 ctx.lineCap = "round";
1145 ctx.lineWidth = 10;
1146 ctx.strokeRect(ctx.lineWidth / 2, ctx.lineWidth / 2, this.whiteKeyWidth - ctx.lineWidth, this.whiteKeyHeight - ctx.lineWidth);
1147 ctx.lineWidth = 2.5; //4 - shadow between the white keys
1148 ctx.fillRect(ctx.lineWidth / 2, ctx.lineWidth / 2, this.whiteKeyWidth - ctx.lineWidth, this.whiteKeyHeight - ctx.lineWidth);
1149
1150 // prerender black key
1151 this.blackKeyRender = document.createElement("canvas");
1152 this.blackKeyRender.width = this.blackKeyWidth + 10;
1153 this.blackKeyRender.height = this.blackKeyHeight + 10;
1154 var ctx = this.blackKeyRender.getContext("2d");
1155 if (ctx.createLinearGradient) {
1156 var gradient = ctx.createLinearGradient(0, 0, 0, this.blackKeyHeight);
1157 gradient.addColorStop(0, "#000");
1158 gradient.addColorStop(1, "#444");
1159 ctx.fillStyle = gradient;
1160 } else {
1161 ctx.fillStyle = "#000";
1162 }
1163 ctx.strokeStyle = "#222";
1164 ctx.lineJoin = "round";
1165 ctx.lineCap = "round";
1166 ctx.lineWidth = 8;
1167 ctx.strokeRect(ctx.lineWidth / 2, ctx.lineWidth / 2, this.blackKeyWidth - ctx.lineWidth, this.blackKeyHeight - ctx.lineWidth);
1168 ctx.lineWidth = 4;
1169 ctx.fillRect(ctx.lineWidth / 2, ctx.lineWidth / 2, this.blackKeyWidth - ctx.lineWidth, this.blackKeyHeight - ctx.lineWidth);
1170
1171 // prerender shadows
1172 this.shadowRender = [];
1173 var y = -this.canvas.height * 2;
1174 for (var j = 0; j < 2; j++) {
1175 var canvas = document.createElement("canvas");
1176 this.shadowRender[j] = canvas;
1177 canvas.width = this.canvas.width;
1178 canvas.height = this.canvas.height;
1179 var ctx = canvas.getContext("2d");
1180 var sharp = j ? true : false;
1181 ctx.lineJoin = "round";
1182 ctx.lineCap = "round";
1183 ctx.lineWidth = 1;
1184 ctx.shadowColor = "rgba(0, 0, 0, 0.5)";
1185 ctx.shadowBlur = this.keyMovement * 3;
1186 ctx.shadowOffsetY = -y + this.keyMovement;
1187 if (sharp) {
1188 ctx.shadowOffsetX = this.keyMovement;
1189 } else {
1190 ctx.shadowOffsetX = 0;
1191 ctx.shadowOffsetY = -y + this.keyMovement;
1192 }
1193 for (var i in this.piano.keys) {
1194 if (!this.piano.keys.hasOwnProperty(i)) continue;
1195 var key = this.piano.keys[i];
1196 if (key.sharp != sharp) continue;
1197
1198 if (key.sharp) {
1199 ctx.fillRect(this.blackKeyOffset + this.whiteKeyWidth * key.spatial + ctx.lineWidth / 2,
1200 y + ctx.lineWidth / 2,
1201 this.blackKeyWidth - ctx.lineWidth, this.blackKeyHeight - ctx.lineWidth);
1202 } else {
1203 ctx.fillRect(this.whiteKeyWidth * key.spatial + ctx.lineWidth / 2,
1204 y + ctx.lineWidth / 2,
1205 this.whiteKeyWidth - ctx.lineWidth, this.whiteKeyHeight - ctx.lineWidth);
1206 }
1207 }
1208 }
1209
1210 // update key rects
1211 for (var i in this.piano.keys) {
1212 if (!this.piano.keys.hasOwnProperty(i)) continue;
1213 var key = this.piano.keys[i];
1214 if (key.sharp) {
1215 key.rect = new Rect(this.blackKeyOffset + this.whiteKeyWidth * key.spatial, 0,
1216 this.blackKeyWidth, this.blackKeyHeight);
1217 } else {
1218 key.rect = new Rect(this.whiteKeyWidth * key.spatial, 0,
1219 this.whiteKeyWidth, this.whiteKeyHeight);
1220 }
1221 }
1222 };
1223
1224 CanvasRenderer.prototype.visualize = function (key, color) {
1225 key.timePlayed = Date.now();
1226 key.blips.push({
1227 "time": key.timePlayed,
1228 "color": color
1229 });
1230 };
1231
1232 CanvasRenderer.prototype.redraw = function () {
1233 var now = Date.now();
1234 var timeLoadedEnd = now - 1000;
1235 var timePlayedEnd = now - 100;
1236 var timeBlipEnd = now - 1000;
1237
1238 this.ctx.save();
1239 this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
1240 // draw all keys
1241 for (var j = 0; j < 2; j++) {
1242 this.ctx.globalAlpha = 1.0; //unloaded keys colour
1243 this.ctx.drawImage(this.shadowRender[j], 0, 0);
1244 var sharp = j ? true : false;
1245 for (var i in this.piano.keys) {
1246 if (!this.piano.keys.hasOwnProperty(i)) continue;
1247 var key = this.piano.keys[i];
1248 if (key.sharp != sharp) continue;
1249
1250 if (!key.loaded) {
1251 this.ctx.globalAlpha = 0.2;
1252 } else if (key.timeLoaded > timeLoadedEnd) {
1253 this.ctx.globalAlpha = ((now - key.timeLoaded) / 1000) * 0.8 + 0.2;
1254 } else {
1255 this.ctx.globalAlpha = 1.0;
1256 }
1257 var y = 0;
1258 if (key.timePlayed > timePlayedEnd) {
1259 y = Math.floor(this.keyMovement - (((now - key.timePlayed) / 100) * this.keyMovement));
1260 }
1261 var x = Math.floor(key.sharp ? this.blackKeyOffset + this.whiteKeyWidth * key.spatial : this.whiteKeyWidth * key.spatial);
1262 var image = key.sharp ? this.blackKeyRender : this.whiteKeyRender;
1263 this.ctx.drawImage(image, x, y);
1264
1265 // render blips
1266 if (key.blips.length) {
1267 var alpha = this.ctx.globalAlpha;
1268 var w, h;
1269 if (key.sharp) {
1270 x += this.blackBlipX;
1271 y = this.blackBlipY;
1272 w = this.blackBlipWidth;
1273 h = this.blackBlipHeight;
1274 } else {
1275 x += this.whiteBlipX;
1276 y = this.whiteBlipY;
1277 w = this.whiteBlipWidth;
1278 h = this.whiteBlipHeight;
1279 }
1280 for (var b = 0; b < key.blips.length; b++) {
1281 var blip = key.blips[b];
1282 if (blip.time > timeBlipEnd) {
1283 this.ctx.fillStyle = blip.color;
1284 this.ctx.globalAlpha = alpha - ((now - blip.time) / 1000);
1285 this.ctx.fillRect(x, y, w, h);
1286 } else {
1287 key.blips.splice(b, 1);
1288 --b;
1289 }
1290 y -= Math.floor(h * 1.1); //blips space apart
1291 }
1292 }
1293 }
1294 }
1295 this.ctx.restore();
1296 };
1297
1298 CanvasRenderer.prototype.getHit = function (x, y) {
1299 for (var j = 0; j < 2; j++) {
1300 var sharp = j ? false : true; // black keys first
1301 for (var i in this.piano.keys) {
1302 if (!this.piano.keys.hasOwnProperty(i)) continue;
1303 var key = this.piano.keys[i];
1304 if (key.sharp != sharp) continue;
1305 if (key.rect.contains(x, y)) {
1306 var v = y / (key.sharp ? this.blackKeyHeight : this.whiteKeyHeight);
1307 v += 0.25;
1308 v *= DEFAULT_VELOCITY;
1309 if (v > 1.0) v = 1.0;
1310 return {
1311 "key": key,
1312 "v": v
1313 };
1314 }
1315 }
1316 }
1317 return null;
1318 };
1319
1320
1321 CanvasRenderer.isSupported = function () {
1322 var canvas = document.createElement("canvas");
1323 return !!(canvas.getContext && canvas.getContext("2d"));
1324 };
1325
1326 CanvasRenderer.translateMouseEvent = function (evt) {
1327 var element = evt.target;
1328 var offx = 0;
1329 var offy = 0;
1330 do {
1331 offx += element.offsetLeft;
1332 offy += element.offsetTop;
1333 } while (element = element.offsetParent);
1334 return {
1335 x: evt.pageX - offx,
1336 y: evt.pageY - offy
1337 }
1338 };
1339
1340 // Soundpack Stuff by electrashave ♥
1341
1342////////////////////////////////////////////////////////////////
1343
1344 function SoundSelector(piano) {
1345 this.initialized = false;
1346 this.keys = piano.keys;
1347 this.loading = {};
1348 this.notification;
1349 this.packs = [];
1350 this.piano = piano;
1351 this.soundSelection = localStorage.soundSelection || "MPP Classic";
1352 this.addPack({name: "MPP Classic", keys: Object.keys(this.piano.keys), ext: ".mp3", url: "/sounds/mppclassic/"});
1353 }
1354
1355 SoundSelector.prototype.addPack = function(pack, load) {
1356 var self = this;
1357 self.loading[pack.url || pack] = true;
1358 function add(obj) {
1359 var added = false;
1360 for (var i = 0; self.packs.length > i; i++) {
1361 if (obj.name == self.packs[i].name) {
1362 added = true;
1363 break;
1364 }
1365 }
1366
1367 if (added) return console.warn("Sounds already added!!"); //no adding soundpacks twice D:<
1368
1369 if (obj.url.substr(obj.url.length-1) != "/") obj.url = obj.url + "/";
1370 var html = document.createElement("li");
1371 html.classList = "pack";
1372 html.innerText = obj.name + " (" + obj.keys.length + " keys)";
1373 html.onclick = function() {
1374 self.loadPack(obj.name);
1375 self.notification.close();
1376 };
1377 obj.html = html;
1378 self.packs.push(obj);
1379 self.packs.sort(function(a, b) {
1380 if(a.name < b.name) return -1;
1381 if(a.name > b.name) return 1;
1382 return 0;
1383 });
1384 if (load) self.loadPack(obj.name);
1385 delete self.loading[obj.url];
1386 }
1387
1388 if (typeof pack == "string") {
1389 $.getJSON(pack + "/info.json").done(function(json) {
1390 json.url = pack;
1391 add(json);
1392 });
1393 } else add(pack); //validate packs??
1394 };
1395
1396 SoundSelector.prototype.addPacks = function(packs) {
1397 for (var i = 0; packs.length > i; i++) this.addPack(packs[i]);
1398 };
1399
1400 SoundSelector.prototype.init = function() {
1401 var self = this;
1402 if (self.initialized) return console.warn("Sound selector already initialized!");
1403
1404 if (!!Object.keys(self.loading).length) return setTimeout(function() {
1405 self.init();
1406 }, 250);
1407
1408 $("#sound-btn").on("click", function() {
1409 if (document.getElementById("Notification-Sound-Selector") != null) return self.notification.close();
1410 var html = document.createElement("ul");
1411 $(html).append("<h1>Current Sound: " + self.soundSelection + "</h1>");
1412
1413 for (var i = 0; self.packs.length > i; i++) {
1414 var pack = self.packs[i];
1415 if (pack.name == self.soundSelection) pack.html.classList = "pack enabled";
1416 else pack.html.classList = "pack";
1417 html.appendChild(pack.html);
1418 }
1419 self.notification = new Notification({title: "Sound Selector:", html: html, id: "Sound-Selector", duration: -1, target: "#sound-btn"});
1420 });
1421 self.initialized = true;
1422 self.loadPack(self.soundSelection, true);
1423 };
1424
1425 SoundSelector.prototype.loadPack = function(pack, f) {
1426 for (var i = 0; this.packs.length > i; i++) {
1427 var p = this.packs[i];
1428 if (p.name == pack) {
1429 pack = p;
1430 break;
1431 }
1432 }
1433 if (typeof pack == "string") {
1434 console.warn("Sound pack does not exist! Loading default pack...");
1435 return this.loadPack("MPP Classic");
1436 }
1437
1438 if (pack.name == this.soundSelection && !f) return;
1439 if (pack.keys.length != Object.keys(this.piano.keys).length) {
1440 this.piano.keys = {};
1441 for (var i = 0; pack.keys.length > i; i++) this.piano.keys[pack.keys[i]] = this.keys[pack.keys[i]];
1442 this.piano.renderer.resize();
1443 }
1444
1445 var self = this;
1446 for (var i in this.piano.keys) {
1447 if (!this.piano.keys.hasOwnProperty(i)) continue;
1448 (function() {
1449 var key = self.piano.keys[i];
1450 key.loaded = false;
1451 self.piano.audio.load(key.note, pack.url + key.note + pack.ext, function() {
1452 key.loaded = true;
1453 key.timeLoaded = Date.now();
1454 });
1455 })();
1456 }
1457 localStorage.soundSelection = pack.name;
1458 this.soundSelection = pack.name;
1459 };
1460
1461 SoundSelector.prototype.removePack = function(name) {
1462 var found = false;
1463 for (var i = 0; this.packs.length > i; i++) {
1464 var pack = this.packs[i];
1465 if (pack.name == name) {
1466 this.packs.splice(i, 1);
1467 if (pack.name == this.soundSelection) this.loadPack(this.packs[0].name); //add mpp default if none?
1468 break;
1469 }
1470 }
1471 if (!found) console.warn("Sound pack not found!");
1472 };
1473
1474
1475
1476 // Pianoctor
1477
1478 ////////////////////////////////////////////////////////////////
1479
1480 var PianoKey = function(note, octave, num) {
1481 this.note = note + octave;
1482 this.baseNote = note;
1483 this.octave = octave;
1484 this.sharp = note.indexOf("s") != -1;
1485 this.loaded = false;
1486 this.timeLoaded = 0;
1487 this.domElement = null;
1488 this.timePlayed = 0;
1489 this.blips = [];
1490 this.num = num; //Ltranspose
1491 };
1492
1493 var Piano = function (rootElement) {
1494
1495 var piano = this;
1496 piano.rootElement = rootElement;
1497 piano.keys = {};
1498
1499 var white_spatial = 0;
1500 var black_spatial = 0;
1501 var black_it = 0;
1502 var black_lut = [2, 1, 2, 1, 1];
1503 var addKey = function(note, octave, num) {
1504 var key = new PianoKey(note, octave, num);
1505 piano.keys[key.note] = key;
1506 if (key.sharp) {
1507 key.spatial = black_spatial;
1508 black_spatial += black_lut[black_it % 5];
1509 ++black_it;
1510 } else {
1511 key.spatial = white_spatial;
1512 ++white_spatial;
1513 }
1514 }
1515 if (test_mode) { //Logan check!
1516 addKey("c", 2);
1517
1518 } else {
1519 addKey("a", -1, 1);
1520 addKey("as", -1, 2);
1521 addKey("b", -1, 3);
1522 var notes = "c cs d ds e f fs g gs a as b".split(" ");
1523 var count = 4;
1524
1525 for(var oct = 0; oct < 7; oct++) {
1526 for(var i in notes) {
1527 addKey(notes[i], oct, count);
1528 count++;
1529 }
1530 }
1531 addKey("c", 7); //default key
1532 addKey("cs", 7); //extra key
1533 addKey("d", 7); //extra key
1534 addKey("ds", 7); //extra key
1535 addKey("e", 7); //extra key
1536
1537 }
1538
1539
1540 var render_engine = CanvasRenderer.isSupported() ? CanvasRenderer : DOMRenderer;
1541 this.renderer = new render_engine().init(this);
1542
1543 $(window).resize(function () {
1544 piano.renderer.resize();
1545 });
1546
1547
1548 window.AudioContext = window.AudioContext || window.webkitAudioContext || undefined;
1549 var audio_engine = (window.AudioContext === undefined) ? AudioEngineSM2 : AudioEngineWeb;
1550
1551 // Firefox 25 supports WebAudio, but a decodeAudioData issue is blocking until 26
1552 // https://bugzilla.mozilla.org/show_bug.cgi?id=865553
1553 var search_str = " Firefox/";
1554 var idx = navigator.userAgent.indexOf(search_str);
1555 if (idx !== -1) {
1556 var version = parseFloat(navigator.userAgent.substring(idx + search_str.length));
1557 if (isNaN(version) || version < 26.0) {
1558 audio_engine = AudioEngineSM2;
1559 }
1560 }
1561
1562 this.audio = new audio_engine().init();
1563 };
1564
1565 Piano.prototype.play = function(note, vol, participant, delay_ms) {
1566 if(!this.keys.hasOwnProperty(note)) return;
1567 var key = this.keys[note];
1568 if(key.loaded) this.audio.play(key.note, vol, delay_ms, participant.id);
1569 if(typeof gMidiOutTest === "function") gMidiOutTest(key.note, vol * 100, delay_ms);
1570 var self = this;
1571 var jq_namediv = $(typeof participant == "undefined" ? null : participant.nameDiv);
1572 if(jq_namediv) {
1573 setTimeout(function() {
1574 self.renderer.visualize(key, typeof participant == "undefined" ? "yellow" : (participant.color || "#777"));
1575 jq_namediv.addClass("play");
1576 setTimeout(function() {
1577 jq_namediv.removeClass("play");
1578 }, 30);
1579 }, delay_ms);
1580 }
1581 };
1582
1583 Piano.prototype.stop = function(note, participant, delay_ms) {
1584 if(!this.keys.hasOwnProperty(note)) return;
1585 var key = this.keys[note];
1586 if(key.loaded) this.audio.stop(key.note, delay_ms, participant.id);
1587 if(typeof gMidiOutTest === "function") gMidiOutTest(key.note, 0, delay_ms);
1588 };
1589
1590 var gPiano = new Piano(document.getElementById("piano"));
1591
1592 var gSoundSelector = new SoundSelector(gPiano);
1593 gSoundSelector.addPacks(["/sounds/Emotional_2.0/", "/sounds/Harp/", "/sounds/Music_Box/", "/sounds/Vintage_Upright/", "/sounds/Steinway_Grand/", "/sounds/Emotional/", "/sounds/Untitled/"]);
1594 gSoundSelector.init();
1595
1596 var gAutoSustain = true;
1597 var gSustain = false;
1598
1599 var gHeldNotes = {};
1600 var gSustainedNotes = {};
1601
1602 // roll
1603 function roll(id, vol, i) {
1604 if (octTemp == 1) { //check Logan
1605 gPiano.play(id, vol !== undefined ? vol : DEFAULT_VELOCITY, gClient.getOwnParticipant(), 0);
1606 gClient.startNote(id, vol);
1607 return;
1608 }
1609 setTimeout(function() {
1610 gPiano.play(id, vol !== undefined ? vol : DEFAULT_VELOCITY, gClient.getOwnParticipant(), 0);
1611 gClient.startNote(id, vol);
1612 }, delays + (delays * i));
1613 }
1614 // pressing
1615 function pressing(id, vol) {
1616 if (ouch) {
1617 for (i=0; i <= ouchN; i++) {
1618 setTimeout( function() { gPiano.play(id, vol !== undefined ? vol : DEFAULT_VELOCITY, gClient.getOwnParticipant(), 0);}, ouchD * i);
1619 if (!politePlay) {
1620 setTimeout( function() { gClient.startNote(id, vol);}, ouchD * i)
1621 }
1622 }
1623
1624 } else {
1625 gPiano.play(id, vol !== undefined ? vol : DEFAULT_VELOCITY, gClient.getOwnParticipant(), 0);
1626 if (!politePlay) {
1627 gClient.startNote(id, vol);
1628 }
1629 }
1630 }
1631
1632 // press
1633 function press(id, vol) {
1634 //thanks electrashave!
1635 var pKey = gPiano.keys[id];
1636 for (as in MPP.piano.keys) {
1637 var key = MPP.piano.keys[as];
1638 if (key.num == (pKey.num + transLvl)) {
1639 id = key.note
1640 }
1641 }
1642
1643 if (mouseNote) {
1644 // thanks Chacha!
1645 try {
1646 var rect = gPiano.keys[id].rect;
1647 var t = 900; // 900
1648 var x = (rect.x + rect.x2) / 2; // Position within piano
1649 x /= gPiano.renderer.width; // Position within renderer
1650 x *= 95; // 100% minus left offset (3%) minus right offset (2%)
1651 x += 3; // Left offset of 3%, gives position within window
1652 var y = rect.h; // === rect.y2 - rect.y
1653 y -= gPiano.renderer.height * 0.75; // Center around midpoint between black and white keys.
1654 y /= 10; // Scale to fit the keys. (This is arbitrary since the height of the keys will vary between users anyway.)
1655 y += 50; // Center on middle of screen
1656 x += (Math.random()+Math.random()-1)*0.5; // Alters x slightly each press
1657 y += (Math.random()+Math.random()+Math.random()+Math.random()-2)*2.5; // Alters y slightly each press
1658 setTimeout(()=>gClient.sendArray([{ m: "m", x: x, y: y }]), t); // Wait for t before
1659 } catch (e) {console.log("mouseNote err: " + e)} // If there's an error log it
1660 }
1661
1662 var me = gClient.getOwnParticipant();
1663
1664 if (randNoteColour && !ignoreNotes && !politePlay) {
1665 me = gClient.getOwnParticipant();
1666 me.color = Col();
1667
1668 } else if (ignoreNotes && politePlay) {
1669 randNoteColour = true;
1670 me = gClient.getOwnParticipant();
1671 me.color = "purple";
1672
1673 } else if (ignoreNotes) {
1674 randNoteColour = true;
1675 me = gClient.getOwnParticipant();
1676 me.color = "red";
1677
1678 } else if (politePlay) {
1679 randNoteColour = true;
1680 me = gClient.getOwnParticipant();
1681 me.color = "blue";
1682 }
1683
1684
1685 if (delPlay) {
1686 setTimeout(function() {
1687 gPiano.play(id, vol !== undefined ? vol : DEFAULT_VELOCITY, gClient.getOwnParticipant(), 0);
1688 gClient.startNote(id, vol);
1689 }, delTime);
1690 }
1691
1692 var note = id.replace(/[0-9]/g, '').replace("-", "");
1693 var octave = parseInt(id.replace(/[^\d.]/, '').replace('s', ''));
1694 if (octTemp >= 3) {
1695 if (octTemp > 4) {
1696 octave = octave - 2;
1697 } else {
1698 octave = octave - 1;
1699 }
1700 }
1701 for (i = 0; i < octTemp; i++) {
1702 if (rollTemp) {
1703 roll(note + (octave + i), vol, i);
1704 } else {
1705 pressing(note + (octave + i), vol);
1706 }
1707 }
1708 gHeldNotes[id] = true;
1709 gSustainedNotes[id] = true;
1710
1711 }
1712 // release roll
1713 function releaseRoll(id, i) {
1714 setTimeout(function() {
1715 gPiano.stop(id, gClient.getOwnParticipant(), 0);
1716 gClient.stopNote(id);
1717 gSustainedNotes[id] = false;
1718 }, delays + (delays * i));
1719 }
1720
1721 // releasing
1722 function releasing(id) {
1723 gPiano.stop(id, gClient.getOwnParticipant(), 0);
1724 gClient.stopNote(id);
1725 gSustainedNotes[id] = false;
1726 }
1727
1728 // release
1729 function release(id) {
1730 if (gHeldNotes[id]) {
1731 gHeldNotes[id] = false;
1732 if (gAutoSustain || gSustain) {
1733 gSustainedNotes[id] = true;
1734 } else {
1735 if (gNoteQuota.spend(1)) {
1736 var octave = parseInt(id.replace(/[^\d.]/, '').replace('s', ''));
1737 var note = id.replace(/[0-9]/g, '').replace("-", "");
1738 if (octTemp >= 3) {
1739 if (octTemp > 4) {
1740 octave = octave - 2;
1741 } else {
1742 octave = octave - 1;
1743 }
1744 }
1745 for (i = 0; i < octTemp; i++) {
1746 if (rollTemp) {
1747 releaseRoll(note + (octave + i), i);
1748 } else {
1749 releasing(note + (octave + i));
1750 }
1751 }
1752 }
1753 }
1754 }
1755 }
1756
1757 function pressSustain() {
1758 gSustain = true;
1759 }
1760
1761 function releaseSustain() {
1762 gSustain = false;
1763 if (!gAutoSustain) {
1764 for (var id in gSustainedNotes) {
1765 if (gSustainedNotes.hasOwnProperty(id) && gSustainedNotes[id] && !gHeldNotes[id]) {
1766 if (gNoteQuota.spend(0)) {
1767 gPiano.stop(id, gClient.getOwnParticipant(), 0);
1768 gClient.stopNote(id);
1769 }
1770 }
1771 }
1772 }
1773 }
1774
1775
1776
1777
1778 // internet science
1779
1780 ////////////////////////////////////////////////////////////////
1781
1782 var channel_id = decodeURIComponent(window.location.pathname);
1783 if(channel_id.substr(0, 1) == "/") channel_id = channel_id.substr(1);
1784 if(channel_id == "") channel_id = "lolwutsecretlobbybackdoor"; //lobby
1785
1786 //FIX FOR HANDSHAKE ERROR
1787 var gClient = new Client("ws://" + window.location.hostname + ":443"); //FIX FOR HANDSHAKE ERROR
1788 //FIX FOR HANDSHAKE ERROR
1789
1790 //worker
1791 worker.onmessage = function(event) { if(event.data.args) if(event.data.args.action==0) { gClient.sendArray([{m:"m", x:event.data.args.x, y:event.data.args.y}]); } }
1792 gClient.setChannel(channel_id);
1793 gClient.start();
1794
1795 // Setting status
1796 (function () {
1797 gClient.on("count", function (status) {
1798 $("#status").text(status);
1799 });
1800 gClient.on("count", function (count) {
1801 if (count > 0) {
1802 $("#status").html('<span class="number">' + count + '</span> ' + (count == 1 ? 'player' : 'players'));
1803 document.title = "Relyks' Bot [v" + botVersion + "] (" + count + ")";
1804 } else {
1805 document.title = "Relyks' Bot [v" + botVersion + "]";
1806 }
1807 });
1808 })();
1809
1810 // Handle changes to participants
1811 (function () {
1812 gClient.on("participant added", function (part) {
1813
1814 part.displayX = 0.75; //150
1815 part.displayY = 25; //50
1816
1817 // add nameDiv
1818 var div = document.createElement("div");
1819 div.className = "name";
1820 div.participantId = part.id;
1821 div.textContent = part.name || selfName; // ""
1822 div.style.backgroundColor = part.color || "#000000";
1823 if (gClient.participantId === part.id) {
1824 $(div).addClass("me");
1825 }
1826 if (gClient.channel && gClient.channel.crown && gClient.channel.crown.participantId === part.id) {
1827 $(div).addClass("owner");
1828 }
1829 if (gPianoMutes.indexOf(part._id) !== -1) {
1830 $(part.nameDiv).addClass("muted-notes");
1831 }
1832 if (gChatMutes.indexOf(part._id) !== -1) {
1833 $(part.nameDiv).addClass("muted-chat");
1834 }
1835 div.style.display = "none";
1836 part.nameDiv = $("#names")[0].appendChild(div);
1837 $(part.nameDiv).fadeIn(500); //2000
1838
1839 // sort names
1840 var arr = $("#names .name");
1841 arr.sort(function (a, b) {
1842 a = a.style.backgroundColor; // todo: sort based on user id instead
1843 b = b.style.backgroundColor;
1844 if (a > b) return 1;
1845 else if (a < b) return -1;
1846 else return 0;
1847 });
1848 $("#names").html(arr);
1849
1850 // add cursorDiv //gSeeOwnCursor
1851 if (gClient.participantId !== part.id || showOwnMouse) {
1852 var div = document.createElement("div");
1853 div.className = "cursor";
1854 div.style.display = "none";
1855 part.cursorDiv = $("#cursors")[0].appendChild(div);
1856 $(part.cursorDiv).fadeIn(500); //2000
1857
1858 //sets mouse position on join (thanks Josh)
1859 part.cursorDiv.style.left = 46.73 + "%";
1860 part.cursorDiv.style.top = 19.60 + "%";
1861
1862 var div = document.createElement("div");
1863 div.className = "name";
1864 div.style.backgroundColor = part.color || "#000000"
1865 div.textContent = part.name || selfName; // ""
1866 part.cursorDiv.appendChild(div);
1867
1868 } else {
1869 part.cursorDiv = undefined;
1870 }
1871 });
1872 gClient.on("participant removed", function (part) { //when the participant leaves
1873 // remove nameDiv
1874 var nd = $(part.nameDiv);
1875 var cd = $(part.cursorDiv);
1876 cd.fadeOut(500); //2000
1877 nd.fadeOut(450, function () { //2000
1878 nd.remove();
1879 cd.remove();
1880 part.nameDiv = undefined;
1881 part.cursorDiv = undefined;
1882 });
1883 });
1884 gClient.on("participant update", function (part) {
1885 var name = part.name || "";
1886 var color = part.color || "#777";
1887 part.nameDiv.style.backgroundColor = color;
1888 part.nameDiv.textContent = name;
1889 $(part.cursorDiv)
1890 .find(".name")
1891 .text(name)
1892 .css("background-color", color);
1893 });
1894 gClient.on("ch", function (msg) {
1895 for (var id in gClient.ppl) {
1896 if (gClient.ppl.hasOwnProperty(id)) {
1897 var part = gClient.ppl[id];
1898 if (part.id === gClient.participantId) {
1899 $(part.nameDiv).addClass("me");
1900 } else {
1901 $(part.nameDiv).removeClass("me");
1902 }
1903 if (msg.ch.crown && msg.ch.crown.participantId === part.id) {
1904 $(part.nameDiv).addClass("owner");
1905 $(part.cursorDiv).addClass("owner");
1906 } else {
1907 $(part.nameDiv).removeClass("owner");
1908 $(part.cursorDiv).removeClass("owner");
1909 }
1910 if (gPianoMutes.indexOf(part._id) !== -1) {
1911 $(part.nameDiv).addClass("muted-notes");
1912 } else {
1913 $(part.nameDiv).removeClass("muted-notes");
1914 }
1915 if (gChatMutes.indexOf(part._id) !== -1) {
1916 $(part.nameDiv).addClass("muted-chat");
1917 } else {
1918 $(part.nameDiv).removeClass("muted-chat");
1919 }
1920 }
1921 }
1922 });
1923
1924 function updateCursor(msg) {
1925 const part = gClient.ppl[msg.id];
1926 if (part && part.cursorDiv) {
1927 part.cursorDiv.style.left = msg.x + "%";
1928 part.cursorDiv.style.top = msg.y + "%";
1929 }
1930 }
1931
1932 gClient.on("m", updateCursor);
1933 gClient.on("participant added", updateCursor);
1934
1935 })();
1936
1937
1938
1939
1940
1941
1942 // Handle changes to crown
1943 (function () {
1944 var jqcrown = $('<div id="crown"></div>').appendTo(document.body).hide();
1945 var jqcountdown = $('<span></span>').appendTo(jqcrown);
1946 var countdown_interval;
1947 jqcrown.click(function () {
1948 gClient.sendArray([{
1949 m: "chown",
1950 id: gClient.participantId
1951 }]);
1952 });
1953 gClient.on("ch", function (msg) {
1954 if (msg.ch.crown) {
1955 var crown = msg.ch.crown;
1956 if (!crown.participantId || !gClient.ppl[crown.participantId]) {
1957 var land_time = crown.time + 2000 - gClient.serverTimeOffset;
1958 var avail_time = crown.time + 15000 - gClient.serverTimeOffset;
1959 jqcountdown.text("");
1960 jqcrown.show();
1961 if (land_time - Date.now() <= 0) {
1962 jqcrown.css({
1963 "left": crown.endPos.x + "%",
1964 "top": crown.endPos.y + "%"
1965 });
1966 } else {
1967 jqcrown.css({
1968 "left": crown.startPos.x + "%",
1969 "top": crown.startPos.y + "%"
1970 });
1971 jqcrown.addClass("spin");
1972 jqcrown.animate({
1973 "left": crown.endPos.x + "%",
1974 "top": crown.endPos.y + "%"
1975 }, 2000, "linear", function () {
1976 jqcrown.removeClass("spin");
1977 });
1978 }
1979 clearInterval(countdown_interval);
1980 countdown_interval = setInterval(function () {
1981 var time = Date.now();
1982 if (time >= land_time) {
1983 var ms = avail_time - time;
1984 if (ms > 0) {
1985 jqcountdown.text(Math.ceil(ms / 1000) + "s");
1986 } else {
1987 jqcountdown.text("");
1988 clearInterval(countdown_interval);
1989 }
1990 }
1991 }, 1000);
1992 } else {
1993 jqcrown.hide();
1994 }
1995 } else {
1996 jqcrown.hide();
1997 }
1998 });
1999 gClient.on("disconnect", function () {
2000 jqcrown.fadeOut(2000);
2001 });
2002 })();
2003
2004
2005// Josh's playThing
2006 function playThing(notes, veloc, delay, times) {
2007 setTimeout(function() {
2008 gClient.sendArray([{
2009 m: "n",
2010 t: times,
2011 n: [{
2012 n: notes,
2013 v: veloc
2014 }]
2015 }]);
2016 }, delay);
2017 //console.log(notes);
2018 }
2019
2020
2021// Playing notes
2022 gClient.on("n", function(msg) {
2023 var t = msg.t - gClient.serverTimeOffset + TIMING_TARGET - Date.now();
2024 var participant = gClient.findParticipantById(msg.p);
2025 if (gPianoMutes.indexOf(participant._id) !== -1)
2026 return;
2027 for (var i = 0; i < msg.n.length; i++) {
2028 var note = msg.n[i];
2029 var octave = parseInt(note.n.replace( /[^\d.]/, '').replace('s', ''));
2030 if (octave > 7) {
2031 return;
2032 }
2033 var ms = t + (note.d || 0);
2034 if (ms < 0) {
2035 ms = 0;
2036 } else if (ms > 10000) continue;
2037 if (ignoreNotes) {
2038 if (participant.id == gClient.participantId) {
2039 if (note.s) {
2040 gPiano.stop(note.n, participant, ms);
2041 } else {
2042 var vel = (typeof note.v !== "undefined") ? parseFloat(note.v) : DEFAULT_VELOCITY;
2043 if (vel < 0) vel = 0;
2044 else if (vel > 1) vel = 1;
2045 gPiano.play(note.n, vel, participant, ms);
2046 }
2047 }
2048 } else {
2049 if (note.s) {
2050 gPiano.stop(note.n, participant, ms);
2051 } else {
2052 var vel = (typeof note.v !== "undefined") ? parseFloat(note.v) : DEFAULT_VELOCITY;
2053 if (vel < 0) vel = 0;
2054 else if (vel > 1) vel = 1;
2055 gPiano.play(note.n, vel, participant, ms);
2056 if (copyNotes){
2057 playThing(note.n,vel,note.d||0, t);
2058 }
2059 }
2060 }
2061 }
2062 });
2063
2064 // Send cursor updates
2065 // mouse optimizations by Alex
2066 var mx = 0,
2067 last_mx = -10,
2068 my = 0,
2069 last_my = -10;
2070
2071 setInterval(function() {
2072 if (Math.abs(mx - last_mx) > 0.1 || Math.abs(my - last_my) > 0.1) {
2073 last_mx = mx;
2074 last_my = my;
2075 gClient.sendArray([{
2076 m: "m",
2077 x: mx,
2078 y: my
2079 }]);
2080 if (gSeeOwnCursor) {
2081
2082
2083 gClient.emit("m", {
2084 m: "m",
2085 id: gClient.participantId,
2086 x: mx,
2087 y: my
2088 });
2089 }
2090
2091 var part = gClient.getOwnParticipant();
2092 if (part) {
2093 part.x = mx;
2094 part.y = my;
2095 }
2096 }
2097
2098 }, 60);
2099
2100 $(document).mousemove(function(event) {
2101 mx = ((event.pageX / $(window).width()) * 100).toFixed(2);
2102 my = ((event.pageY / $(window).height()) * 100).toFixed(2);
2103 });
2104
2105 // Room settings button
2106 (function () {
2107 gClient.on("ch", function (msg) {
2108 if (gClient.isOwner()) {
2109 $("#room-settings-btn").show();
2110 $("#room-settings-btn").animate({opacity:1.0},100); //animates it thanks B@K$
2111 } else {
2112 $("#room-settings-btn").css("display","block"); //shows it
2113 $("#room-settings-btn").animate({opacity:0.7},100);
2114 }
2115 });
2116 $("#room-settings-btn").click(function (evt) { //room settings button
2117 if (gClient.channel && gClient.isOwner()) {
2118 var settings = gClient.channel.settings;
2119 openModal("#room-settings");
2120 setTimeout(function () {
2121 $("#room-settings .checkbox[name=visible]").prop("checked", settings.visible);
2122 $("#room-settings .checkbox[name=chat]").prop("checked", settings.chat);
2123 $("#room-settings .checkbox[name=crownsolo]").prop("checked", settings.crownsolo);
2124 }, 100);
2125 }
2126 });
2127 $("#room-settings .submit").click(function () {
2128 var settings = {
2129 visible: $("#room-settings .checkbox[name=visible]").is(":checked"),
2130 chat: $("#room-settings .checkbox[name=chat]").is(":checked"),
2131 crownsolo: $("#room-settings .checkbox[name=crownsolo]").is(":checked")
2132 };
2133 gClient.sendArray([{
2134 m: "chset",
2135 set: settings
2136 }]);
2137 closeModal();
2138 });
2139 $("#room-settings .drop-crown").click(function () {
2140 gClient.sendArray([{
2141 m: "chown"
2142 }]);
2143 closeModal();
2144 });
2145 })();
2146
2147 // Handle notifications
2148 gClient.on("notification", function (msg) {
2149 new Notification(msg);
2150 });
2151
2152 //cursor float
2153 /*gClient.on("ch", function (msg) {
2154 var chidlo = msg.ch._id.toLowerCase();
2155 if (chidlo === "a" || chidlo.substr() === "a") {
2156 $(".cursor").addClass("floating");
2157 } else {
2158
2159 $(".cursor").addClass("floating");
2160
2161 }
2162 });*/
2163
2164 // Don't forget spin
2165 /*gClient.on("ch", function (msg) {
2166 var chidlo = msg.ch._id.toLowerCase();
2167 if (chidlo === "spin" || chidlo.substr(-5) === "/spin") {
2168 $("#piano").addClass("spin");
2169 } else {
2170 $("#piano").removeClass("spin");
2171 }
2172 });*/
2173
2174 // Crownsolo notice
2175 gClient.on("ch", function (msg) {
2176 if (msg.ch.settings.crownsolo) {
2177 if ($("#crownsolo-notice").length == 0) {
2178 $('<div id="crownsolo-notice">').text('Only owner can play mode').appendTo("body").fadeIn(500);
2179 }
2180 } else {
2181 $("#crownsolo-notice").remove();
2182 }
2183 });
2184 gClient.on("disconnect", function () {
2185 $("#crownsolo-notice").remove();
2186 $("#nochat-notice").remove();
2187 });
2188
2189
2190
2191 var gPianoMutes = ["3ed152147e36d229cf5b7cba", "9b8df25492874a938ce9fb74"];
2192
2193 var gChatMutes = [];
2194
2195 //animated name stuff
2196 if (animName) {
2197 setInterval(function() {
2198 if (heyThereKitty == MPP.client.getOwnParticipant().name) return;
2199 updateName(heyThereKitty); //name to print
2200 if (followId == heyThereKittyId) return;
2201 followId = heyThereKittyId;
2202 }, 2100);
2203 }
2204
2205 // thanks Kappa
2206 /*
2207 var i = 0;
2208 setInterval(function() {
2209 MPP.client.sendArray([{
2210 m: "userset"
2211 , set: {
2212 name: selfName.slice(i % selfName.length) + selfName.slice(0, i++ % selfName.length)
2213 }
2214 }]);
2215 }, 2100)
2216 */
2217
2218 var volume_slider = new VolumeSlider(document.getElementById("volume"), function (v) {
2219 gPiano.audio.setVolume(v);
2220 if (window.localStorage) localStorage.volume = v;
2221 });
2222 volume_slider.set(gPiano.audio.volume);
2223
2224 var Note = function (note, octave) {
2225 this.note = note;
2226 this.octave = octave || 0;
2227 };
2228
2229
2230
2231 var n = function (a, b) {
2232 return {
2233 note: new Note(a, b),
2234 held: false
2235 };
2236 };
2237 //Logan, these are the key bindings for on the piano
2238 var key_binding = {
2239 65: n("gs"),
2240 90: n("a"),
2241 83: n("as"),
2242 88: n("b"),
2243 67: n("c", 1),
2244 70: n("cs", 1),
2245 86: n("d", 1),
2246 71: n("ds", 1),
2247 66: n("e", 1),
2248 78: n("f", 1),
2249 74: n("fs", 1),
2250 77: n("g", 1),
2251 75: n("gs", 1),
2252 188: n("a", 1),
2253 76: n("as", 1),
2254 190: n("b", 1),
2255 191: n("c", 2),
2256 222: n("cs", 2),
2257
2258 49: n("gs", 1),
2259 81: n("a", 1),
2260 50: n("as", 1),
2261 87: n("b", 1),
2262 69: n("c", 2),
2263 52: n("cs", 2),
2264 82: n("d", 2),
2265 53: n("ds", 2),
2266 84: n("e", 2),
2267 89: n("f", 2),
2268 55: n("fs", 2),
2269 85: n("g", 2),
2270 56: n("gs", 2),
2271 73: n("a", 2),
2272 57: n("as", 2),
2273 79: n("b", 2),
2274 80: n("c", 3),
2275 189: n("cs", 3),
2276 219: n("d", 3),
2277 187: n("ds", 3),
2278 221: n("e", 3)
2279 };
2280
2281 var capsLockKey = false; //here are some settings, Logan
2282 var gSustain = false;
2283 var keys = [];
2284 var volTemp = 1;
2285
2286 function handleKeyDown(evt) {
2287 var key = evt.keyCode;
2288 keys[key] = true;
2289
2290 // volume changing
2291 if (keys[107]) {
2292 volume > 0.9 ? volume = 1 : volume += 0.1;
2293 msgBox('Note Volume', 'Volume: ' + parseFloat(volume.toFixed(2)), 1000, '#piano');
2294
2295 } else if (keys[109]) {
2296 volume < 0.1 ? volume = 0 : volume -= 0.1;
2297 msgBox('Note Volume', 'Volume: ' + parseFloat(volume.toFixed(2)), 1000, '#piano');
2298 }
2299 // multi-octave toggling
2300 if (keys[38]) {
2301 octTemp > 6 ? octTemp = 7 : ++octTemp;
2302 msgBox('Multi-octave', 'Level ' + octTemp, 1000, '#piano');
2303
2304 } else if (keys[40]) {
2305 octTemp < 2 ? octTemp = 1 : --octTemp;
2306 msgBox('Multi-octave', 'Level ' + octTemp, 1000, '#piano');
2307 }
2308
2309 // roll toggling
2310 if (keys[35] && rollTemp) {
2311 rollTemp = false;
2312 msgBox('Roll', 'Disabled', 1000, '#piano');
2313
2314 } else if (keys[35] && !rollTemp) {
2315 rollTemp = true;
2316 msgBox('Roll', 'Enabled', 1000, '#piano');
2317 }
2318
2319 // sustain toggling
2320 //Backspace key
2321 if (keys[8] && !susTemp) {
2322 msgBox('Sustain', 'Enabled', 1000, '#piano');
2323 susTemp = true;
2324
2325 } else if (keys[8] && susTemp) {
2326 msgBox('Sustain', 'Disabled', 1000, '#piano');
2327 susTemp = false;
2328 }
2329 if (!susTemp) {
2330 gAutoSustain = false;
2331 } else if (susTemp) {
2332 gAutoSustain = true;
2333 }
2334
2335 var code = parseInt(evt.keyCode); //move up and make use of more Logan
2336
2337 //numpad5
2338 if (code == 101 || code == 12) { //delay
2339 delPlay = !delPlay; //swaps it
2340 if (!delPlay) {
2341 msgBox('Delay', 'Disabled', 1000, '#piano');
2342 } else {
2343 msgBox('Delay', 'Enabled', 1000, '#piano');
2344 }
2345 //Pagedown
2346 } else if (code == 34) { //ignore
2347 ignoreNotes = !ignoreNotes;
2348 if (!ignoreNotes) {
2349 msgBox('Ignore Notes', 'Disabled', 1000, '#piano');
2350 } else {
2351 msgBox('Ignore Notes', 'Enabled', 1000, '#piano');
2352 }
2353 //Pageup
2354 } else if (code == 33) { //bot on/off [clean this logan]
2355 if (bot == 2) {
2356 bot = 0;
2357 msgBox('Commands', 'Disabled', 1000, '#piano');
2358 } else if (bot == 0) {
2359 bot = 1;
2360 msgBox('Commands', 'For everyone', 1000, '#piano');
2361 } else if (bot == 1) {
2362 bot = 2;
2363 msgBox('Commands', 'Only for you', 1000, '#piano');
2364 }
2365
2366 //numpad *
2367 } else if (code == 106) { //bot on/off //♥ REMOVE AND JUST MAKE NUMPAD - GO TO 0 ♥//
2368 if (timeStamp) {
2369 timeStamp = false;
2370 msgBox('Timestamps', 'Off', 1000, '#piano');
2371 } else {
2372 timeStamp = true;
2373 msgBox('Timestamps', 'On', 1000, '#piano');
2374 }
2375
2376 //numpad 0
2377 } else if (code == 96) { //reconnect
2378 MPP.client.stop();
2379 MPP.client.start();
2380 msgBox('Reconnecting...', '', 2000, '#piano');
2381
2382 //numpad 1
2383 } else if (code == 97) { //private room
2384 var room_name = randStr(28);
2385 changeRoom(room_name, "right", {
2386 "visible": false,
2387 "chat": true,
2388 "crownsolo": false,
2389 "lobby": false
2390 });
2391 //numpad 2
2392 } else if (code == 98) { //illuminati hotkey (until I find a better use)
2393 if (autoFollow) {
2394 autoFollow = false;
2395 following = false;
2396 followId = null;
2397 msgBox('Auto Follow', 'Off', 2000, '#blah-btn');
2398 } else {
2399 autoFollow = true;
2400 following = true;
2401 msgBox('Auto Follow', 'On', 2000, '#blah-btn');
2402 }
2403 //tab
2404 } else if (code == 9) { //hotkeymsg
2405 tab(); //ring ring..
2406
2407 //ctrl
2408 } else if (code == 17) { //drop crown
2409 gClient.sendArray([{
2410 m: "chown"
2411 }]);
2412 msgBox('Dropping crown', '', 1000, '#piano');
2413
2414 //H
2415 } else if (code == 72) { //display help
2416 new Notification({id: "volume", title: "Hotkeys (Redesigned by Relyks)", html: '\
2417 <h3>๖ۣۜHold to display binds and hotkeys...</h3>\
2418 <font color="#FF0000 ">Page Up:</font>Turns on/off chat commands <br />\
2419 <font color="#FF4300">Page Down</font> Ignores everyone elses notes<br />\
2420 <font color="#FF8C00 ">End</font> Toggles rolling on multi-octaves<br />\
2421 <font color="#FFC000">Up/Down Arrows</font> Increases and decreases amount of octaves played<br />\
2422 <font color="#FFF400">Left/Right Arrows</font> Changes Key<br />\
2423 <font color="#AAFF00">backspace</font> Toggles sustain <br />\
2424 <font color="#4AFF00">Alt\</font> Goes one octave higher then Shift <br />\
2425 <font color="#00FF60">Spacebar</font> Plays low notes while held<br />\
2426 <font color="#00FF60">Insert</font> Toggles owner only mode (need crown)<br />\
2427 <font color="#00FFF4">6</font> Toggles room visibility (need crown)<br />\
2428 <font color="#00B9FF">Fn + / or ; </font> Change note volume<br />\
2429 <font color="#006FFF">Fn P</font> Toggles timestamps in chat<br />\
2430 <font color="#0000FF">Fn + L</font> Lenny<br />\
2431 <font color="#9B00FF">Fn U</font> Toggles Bunny<br />\
2432 <font color="#ED00FF">Fn + I</font> Toggles delay<br />\
2433 <font color="#FF00B9">Fn + O</font> Toggles Pong<br />\
2434 <font color="#FF0060">Fn + 8</font> Toggles SomeGuy\'s incognito<br />\
2435 <font color="#FF0000">H</font> Displays displays Hotkeys again<br />\
2436 <font color="#FFFFFF">!lhelp</font> Displays local commands in chat<br />\
2437 To stop this message displaying every time you start the script search for <font color="#1A0BFF">i_know_how_to_use_this_bot</font> and change <font color="#FF0000">false</font> to <font color="#4AFF00">true</font>.<br />\
2438 ', target: "#blah-btn", duration: 600});
2439
2440//--TEST--TEST--TEST////--TEST--TEST--TEST////--TEST--TEST--TEST//
2441 //numpad .
2442 } else if (code == 110) { //hotkey test
2443 if (meow) {
2444 meow = false;
2445 msgBox('Cat Mode', 'Off', 1000, '#blah-btn');
2446 } else {
2447 meow = true;
2448 msgBox('Cat Mode', 'On', 1000, '#blah-btn');
2449 }
2450
2451
2452//--TEST--TEST--TEST////--TEST--TEST--TEST////--TEST--TEST--TEST//
2453
2454
2455 // ♥ Thanks Josh ♥ //
2456
2457
2458 //numpad 7
2459 } else if (code == 103) { //speech toggle
2460 if (speechStatus) {
2461 speechStatus = false;
2462 speechSynthesis.cancel();
2463 msgBox('Text to Speech', 'Off', 1000, '#blah-btn');
2464 } else {
2465 speechStatus = true;
2466 msgBox('Text to Speech', 'On', 1000, '#blah-btn');
2467 }
2468
2469 //home
2470 } else if (code == 36) { //politePlay
2471 if (politePlay) {
2472 politePlay = false;
2473 msgBox('Polite Play', 'Off', 1000, '#blah-btn');
2474 } else {
2475 politePlay = true;
2476 msgBox('Polite Play', 'On (others cannot hear your notes)', 1000, '#blah-btn');
2477 }
2478
2479 // Insert key
2480 } else if (code == 45) { //owner only
2481 if (crownSoloToggle) {
2482 crownSoloToggle = false;
2483 MPP.client.sendArray([{m: "chset", set: {crownsolo: false}}]);
2484 msgBox('Owner Only', 'Off', 1000, '#blah-btn');
2485 } else {
2486 crownSoloToggle = true;
2487 MPP.client.sendArray([{m: "chset", set: {crownsolo: true}}]);
2488 msgBox('Owner Only', 'On', 1000, '#blah-btn');
2489 }
2490 // Delete key
2491 } else if (code == 46) { //hide room
2492 if (roomVisibleToggle) {
2493 roomVisibleToggle = false;
2494 MPP.client.sendArray([{m: "chset", set: {visible: false}}]);
2495 msgBox('Room Visible', 'No', 1000, '#blah-btn');
2496 } else {
2497 roomVisibleToggle = true;
2498 MPP.client.sendArray([{m: "chset", set: {visible: true}}]);
2499 msgBox('Room Visible', 'Yes', 1000, '#blah-btn');
2500 }
2501
2502 // \ key
2503 } else if (code == 220) { //mouse updates
2504 if (incognito) {
2505 incognito = false;
2506 msgBox('Incognito', 'Off', 1000, '#blah-btn');
2507 } else {
2508 incognito = true;
2509 msgBox('Incognito', 'On', 1000, '#blah-btn');
2510 }
2511
2512 } else if (code == 105) { //copy notes
2513 if (copyNotes) {
2514 copyNotes = false;
2515 msgBox('Copy Notes', 'Off', 1000, '#blah-btn');
2516 } else {
2517 copyNotes = true;
2518 msgBox('Copy Notes', 'On', 1000, '#blah-btn');
2519 }
2520
2521 } else if (code == 100) { //cursor bunny
2522 testflipB = !testflipB;
2523 if (!testflipB) {
2524 msgBox('Bunny', 'Off', 1000, '#blah-btn');
2525 } else {
2526 setTimeout(function () {
2527 client = MPP.client;
2528 var bunny = new Bunny(client);
2529 worker.onmessage = function(event)
2530 {
2531 if(event.data.args)
2532 if(event.data.args.action==0){
2533 if(testflipB){ bunny.tick(); }
2534 }
2535 }
2536 worker.postMessage({delay:120,args:{action:0}});
2537 }, 120);
2538
2539
2540 var Bunny = function (client) {
2541 this.client = client;
2542
2543 this.vx = 1.5;
2544 this.vy = 2.2;
2545
2546 var self = this;
2547 self.part = self.client.ppl[self.client.participantId];
2548 client.on("ch", function () {
2549 self.part = self.client.ppl[self.client.participantId];
2550 });
2551 }
2552
2553 Bunny.prototype.tick = function () {
2554 if (!this.client.isConnected() || !this.part) return;
2555 this.part.x += this.vx;
2556 this.part.y += this.vy;
2557 if (this.part.x < 0) {
2558 this.vx = -this.vx;
2559 } else if (this.part.x > 100) {
2560 this.vx = -this.vx;
2561 }
2562 if (this.part.y < 0) {
2563 this.vy = -this.vy;
2564 } else if (this.part.y > 0) { //0 makes the ceiling which it bounces off
2565 this.vy = -this.vy;
2566 }
2567 this.client.sendArray([{
2568 m: "m",
2569 x: this.part.x,
2570 y: this.part.y
2571 }]);
2572 this.client.sendArray([{
2573 m: "m",
2574 x: this.part.x,
2575 y: this.part.y
2576 }]);
2577 worker.postMessage({delay:120,args:{action:0}});
2578 };
2579 msgBox('Bunny', 'On', 1000, '#blah-btn');
2580 }
2581
2582 //msgBox('Pong', 'Off', 1000, '#blah-btn');
2583
2584 } else if (code == 102) { //cursor pong
2585 testflipP = !testflipP;
2586 if (!testflipP) {
2587 msgBox('Pong', 'Off', 1000, '#blah-btn');
2588
2589 } else {
2590 //on
2591 setTimeout(function() {
2592 client = MPP.client;
2593 var pong = new Pong(client);
2594 worker.onmessage = function(event) {
2595 if (event.data.args)
2596 if (event.data.args.action == 0) {
2597 if (testflipP) {
2598 pong.tick();
2599 }
2600 }
2601 }
2602 worker.postMessage({
2603 delay: 60
2604 , args: {
2605 action: 0
2606 }
2607 });
2608 }, 60);
2609
2610
2611 var Pong = function(client) {
2612 this.client = client;
2613
2614 this.vx = 0.1875; //0.75
2615 this.vy = 0.275; //1.1
2616
2617 var self = this;
2618 self.part = self.client.ppl[self.client.participantId];
2619 client.on("ch", function() {
2620 self.part = self.client.ppl[self.client.participantId];
2621 });
2622 }
2623
2624 Pong.prototype.tick = function() {
2625 if (!this.client.isConnected() || !this.part) return;
2626 this.part.x += this.vx;
2627 this.part.y += this.vy;
2628 if (this.part.x < 0) {
2629 this.vx = -this.vx;
2630 } else if (this.part.x > 100) {
2631 this.vx = -this.vx;
2632 }
2633 if (this.part.y < 0) {
2634 this.vy = -this.vy;
2635 } else if (this.part.y > 100) {
2636 this.vy = -this.vy;
2637 }
2638
2639 //x is <--> 100 is --> 0 is <--
2640 //y is ^v 0 is ^ 100 is v
2641
2642 this.vx += Math.random() * 0.1 - 0.05;
2643 this.vy += Math.random() * 0.1 - 0.05;
2644 this.client.sendArray([{ //were two of these
2645 m: "m"
2646 , x: this.part.x
2647 , y: this.part.y
2648 }]);
2649 if (this.part.x < -10 || this.part.y < -10 || this.part.x > 110 || this.part.y > 110) {
2650 this.part.x = 50;
2651 this.part.y = 50;
2652 //resets the velocity when setting position
2653 this.vx = -this.vx;
2654 this.vy = -this.vy;
2655 }
2656 worker.postMessage({
2657 delay: 60
2658 , args: {
2659 action: 0
2660 }
2661 });
2662 };
2663 msgBox('Pong', 'On', 1000, '#blah-btn');
2664 }
2665
2666 } else if (code == 99) { //lenny
2667 var msgTmp = $("input").val(); //retain old text
2668 $("body #chat input").val(msgTmp + " Hello everyone! Type in (!help) to get my commands! Remember to stay cool ( ͡◕ ͜ʖ ͡◕)");
2669
2670 //numpad /
2671 } else if (code == 111) { //hotkey spam
2672 for(var key in MPP.piano.keys) MPP.press(key, volume);
2673
2674 //thanks electrashave!
2675 } else if (code == 39) {
2676 transLvl++;
2677 msgBox('Transposing (by electrashave)', 'Transpose level: ' + transLvl, 1000, '#blah-btn');
2678
2679 //thanks electrashave!
2680 } else if (code == 37) {
2681 transLvl--;
2682 msgBox('Transposing (by electrashave)', 'Transpose level: ' + transLvl, 1000, '#blah-btn');
2683 }
2684
2685 if (key_binding[code] !== undefined) {
2686 var binding = key_binding[code];
2687 if (!binding.held) {
2688 binding.held = true;
2689 if (gNoteQuota.spend(0)) {
2690 var note = binding.note;
2691 var octave = 1 + note.octave;
2692 // extra octaves
2693 if (keys[16])++octave;
2694 else if (keys[32])--octave == --octave + -octave;
2695 else if (keys[18])++octave == ++octave + +octave;
2696 else if (keys[192])++octave == ++octave + ++octave;
2697 else if (capsLockKey)--octave;
2698 var note = note.note;
2699 var vol = volume;
2700
2701 if (volume > 5) {
2702 volume = 5;
2703 }
2704 press(note + octave, vol);
2705 }
2706 }
2707
2708 if (++gKeyboardSeq == 3) {
2709 gKnowsYouCanUseKeyboard = true;
2710 if (window.gKnowsYouCanUseKeyboardTimeout) clearTimeout(gKnowsYouCanUseKeyboardTimeout);
2711 if (localStorage) localStorage.knowsYouCanUseKeyboard = true;
2712 if (window.gKnowsYouCanUseKeyboardNotification) gKnowsYouCanUseKeyboardNotification.close();
2713 }
2714
2715 evt.preventDefault();
2716 evt.stopPropagation();
2717 return false;
2718 } else if (code == 20) { // Caps Lock
2719 capsLockKey = true;
2720 evt.preventDefault();
2721 } else if (code === 0x20) { // Space Bar
2722 evt.preventDefault();
2723 } else if (code == 9) { // Tab (don't tab away from the piano)
2724 evt.preventDefault();
2725 } else if (code == 8) { // Backspace (don't navigate Back)
2726 evt.preventDefault();
2727 }
2728 };
2729
2730 //FIX BELOW MESS
2731
2732 var keys = [];
2733
2734 function handleKeyUp(evt) {
2735 var key = evt.keyCode;
2736 keys[key] = false;
2737 var code = parseInt(evt.keyCode);
2738 if (key_binding[code] !== undefined) {
2739 var binding = key_binding[code];
2740 if (binding.held) {
2741 keys[key] = false;
2742 binding.held = false;
2743
2744 if (!gAutoSustain && !gSustain) {
2745 if (gNoteQuota.spend(octTemp)) {
2746 var note = binding.note;
2747 var octave = 1 + note.octave;
2748 // extra octaves
2749 if (keys[16])++octave;
2750 else if (keys[32])--octave == --octave + -octave;
2751 else if (keys[18])++octave == ++octave + +octave;
2752 else if (keys[192])++octave == ++octave + ++octave;
2753 else if (capsLockKey)--octave;
2754 var note = note.note;
2755 release(note + octave); //was missing octave which didn't stop the note - Logan
2756 }
2757 }
2758 }
2759
2760 evt.preventDefault();
2761 evt.stopPropagation();
2762 return false;
2763 } else if (code == 20) { // Caps Lock
2764 capsLockKey = false;
2765 evt.preventDefault();
2766 } else if (code === 0x20) { // Space Bar
2767 evt.preventDefault();
2768 } else if (code == 8) { // Backspace (don't navigate Back)
2769 evt.preventDefault();
2770 }
2771 };
2772
2773 function handleKeyPress(evt) {
2774 evt.preventDefault();
2775 evt.stopPropagation();
2776 if (evt.keyCode == 27 || evt.keyCode == 13) {
2777 //add some stuff here Logan
2778 }
2779 return false;
2780 };
2781
2782 var recapListener = function (evt) {
2783 captureKeyboard();
2784 };
2785
2786 function captureKeyboard() {
2787 $("#piano").off("mousedown", recapListener);
2788 $("#piano").off("touchstart", recapListener);
2789 $(document).on("keydown", handleKeyDown);
2790 $(document).on("keyup", handleKeyUp);
2791 $(window).on("keypress", handleKeyPress);
2792 };
2793
2794 function releaseKeyboard() {
2795 $(document).off("keydown", handleKeyDown);
2796 $(document).off("keyup", handleKeyUp);
2797 $(window).off("keypress", handleKeyPress);
2798 $("#piano").on("mousedown", recapListener);
2799 $("#piano").on("touchstart", recapListener);
2800 };
2801
2802 captureKeyboard();
2803
2804
2805 var velocityFromMouseY = function () {
2806 return 0.1 + (my / 100) * 0.6;
2807 };
2808
2809
2810
2811
2812 // NoteQuota
2813 var gNoteQuota = (function () {
2814 var last_rat = 0;
2815 var nqjq = $("#quota .value");
2816 setInterval(function () {
2817 gNoteQuota.tick();
2818 }, 2000);
2819 return new NoteQuota(function (points) {
2820 // update UI
2821 var rat = (points / this.max) * 100; // 100
2822 if (rat <= last_rat)
2823 nqjq.stop(true, true).css("width", rat.toFixed(0) + "%");
2824 else
2825 nqjq.stop(true, true).animate({
2826 "width": rat.toFixed(0) + "%"
2827 }, 2000, "linear");
2828 last_rat = rat;
2829 });
2830 })();
2831 gClient.on("nq", function (nq_params) {
2832 gNoteQuota.setParams(nq_params);
2833 });
2834 gClient.on("disconnect", function () {
2835 gNoteQuota.setParams(NoteQuota.PARAMS_OFFLINE);
2836 });
2837
2838
2839
2840 // click participant names
2841 (function () {
2842 var ele = document.getElementById("names");
2843 var touchhandler = function (e) {
2844 var target_jq = $(e.target);
2845 if (target_jq.hasClass("name")) {
2846 target_jq.addClass("play");
2847 if (e.target.participantId == gClient.participantId) {
2848 var id = e.target.participantId;
2849 var part = gClient.ppl[id] || null;
2850 if (part) {
2851 participantMenu(part);
2852 e.stopPropagation();
2853 }
2854 } else if (e.target.participantId) {
2855 var id = e.target.participantId;
2856 var part = gClient.ppl[id] || null;
2857 if (part) {
2858 participantMenu(part);
2859 e.stopPropagation();
2860 }
2861 }
2862 }
2863 };
2864 ele.addEventListener("mousedown", touchhandler);
2865 ele.addEventListener("touchstart", touchhandler);
2866 var releasehandler = function (e) {
2867 $("#names .name").removeClass("play");
2868 };
2869 document.body.addEventListener("mouseup", releasehandler);
2870 document.body.addEventListener("touchend", releasehandler);
2871
2872 var removeParticipantMenus = function () {
2873 $(".participant-menu").fadeOut(500);
2874 $(".participantSpotlight").hide(); //what is this?
2875 document.removeEventListener("mousedown", removeParticipantMenus);
2876 document.removeEventListener("touchstart", removeParticipantMenus);
2877 };
2878
2879 var participantMenu = function (part) {
2880 if (!part) return;
2881 removeParticipantMenus();
2882 document.addEventListener("mousedown", removeParticipantMenus);
2883 document.addEventListener("touchstart", removeParticipantMenus);
2884 $("#" + part.id).find(".enemySpotlight").show(); //what is this D:
2885 var menu = $('<div class="participant-menu"></div>');
2886 $("body").append(menu);
2887 // move menu to name position
2888 var jq_nd = $(part.nameDiv);
2889 var pos = jq_nd.position();
2890 menu.css({
2891 "top": pos.top + jq_nd.height() + 15,
2892 "left": pos.left + 6,
2893 "background": part.color || "black"
2894 });
2895 menu.on("mousedown touchstart", function (evt) {
2896 evt.stopPropagation();
2897 var target = $(evt.target);
2898 if (target.hasClass("menu-item")) {
2899 target.addClass("clicked"); //why is this needed?
2900 menu.fadeOut(500, function () {
2901 removeParticipantMenus();
2902 });
2903 }
2904 });
2905 // this spaces stuff out but also can be used for informational purposes
2906 $('<div class="info"></div>').appendTo(menu).text(part._id)
2907 .on("mousedown touchstart", function (evt) {
2908 //prompt("Press CTRL C to copy "+ part.name +"'s ID", part._id);
2909 prompt(part.name.endsWith("s") ? "Press CTRL C to copy "+ part.name +"' ID" : "Press CTRL C to copy "+ part.name +"'s ID", part._id);
2910 });
2911
2912 // added menu items
2913
2914 // rename
2915 if (part._id == gClient.getOwnParticipant()._id) {
2916 $('<div class="menu-item">• Rename</div>').appendTo(menu)
2917 .on("mousedown touchstart", function (evt) {
2918 openModal("#rename", "input[name=name]");
2919 setTimeout(function () {
2920 $("#rename input[name=name]").val(gClient.ppl[gClient.participantId].name);
2921 $("#rename input[name=color]").val(gClient.ppl[gClient.participantId].color);
2922 }, 100);
2923 });
2924 }
2925
2926
2927 // master and unmaster
2928 if (masters.indexOf(part._id) == -1) {
2929 $('<div class="menu-item">• Master</div>').appendTo(menu)
2930 .on("mousedown touchstart", function (evt) {
2931 masters.push(part._id);
2932 gClient.sendArray([{ m: "a", message: "Mastered " + part.name + "."}])
2933 });
2934 } else {
2935 $('<div class="menu-item">• Unmaster</div>').appendTo(menu)
2936 .on("mousedown touchstart", function (evt) {
2937 delete masters[masters.indexOf(part._id)];
2938 gClient.sendArray([{ m: "a", message: "Unmastered " + part.name + "."}])
2939 });
2940 }
2941
2942
2943 // op and deop
2944 if (ops.indexOf(part._id) == -1) {
2945 $('<div class="menu-item">• Op</div>').appendTo(menu)
2946 .on("mousedown touchstart", function (evt) {
2947 ops.push(part._id);
2948 gClient.sendArray([{ m: "a", message: "Opped " + part.name + "."}])
2949 });
2950 } else {
2951 $('<div class="menu-item">• Deop</div>').appendTo(menu)
2952 .on("mousedown touchstart", function (evt) {
2953 delete ops[ops.indexOf(part._id)];
2954 gClient.sendArray([{ m: "a", message: "deopped " + part.name + "."}])
2955 });
2956 }
2957
2958 if (part._id != gClient.getOwnParticipant()._id) {
2959
2960 // follow and rest
2961 if (!followId) {
2962 $('<div class="menu-item">• Follow >.<</div>').appendTo(menu)
2963 .on("mousedown touchstart", function (evt) {
2964 following = true;
2965 followId = part._id;
2966
2967 msgBox('Following', part.name, 2000, '#piano');
2968 });
2969 } else {
2970 $('<div class="menu-item">• Rest <.></div>').appendTo(menu)
2971 .on("mousedown touchstart", function (evt) {
2972 following = false;
2973 followId = null;
2974 msgBox('Stopping', 'Ok...', 2000, '#piano');
2975 });
2976 }
2977
2978 if (gPianoMutes.indexOf(part._id) == -1) {
2979 $('<div class="menu-item">• Mute Notes</div>').appendTo(menu)
2980 .on("mousedown touchstart", function (evt) {
2981 gPianoMutes.push(part._id);
2982 $(part.nameDiv).addClass("muted-notes");
2983 });
2984 } else {
2985 $('<div class="menu-item">• Unmute Notes</div>').appendTo(menu)
2986 .on("mousedown touchstart", function (evt) {
2987 var i;
2988 while ((i = gPianoMutes.indexOf(part._id)) != -1)
2989 gPianoMutes.splice(i, 1);
2990 $(part.nameDiv).removeClass("muted-notes");
2991 });
2992 }
2993 if (gChatMutes.indexOf(part._id) == -1) {
2994 $('<div class="menu-item">• Mute Chat</div>').appendTo(menu)
2995 .on("mousedown touchstart", function (evt) {
2996 gChatMutes.push(part._id);
2997 $(part.nameDiv).addClass("muted-chat");
2998 });
2999 } else {
3000 $('<div class="menu-item">• Unmute Chat</div>').appendTo(menu)
3001 .on("mousedown touchstart", function (evt) {
3002 var i;
3003 while ((i = gChatMutes.indexOf(part._id)) != -1)
3004 gChatMutes.splice(i, 1);
3005 $(part.nameDiv).removeClass("muted-chat");
3006 });
3007 }
3008 if (!(gPianoMutes.indexOf(part._id) >= 0) || !(gChatMutes.indexOf(part._id) >= 0)) {
3009 $('<div class="menu-item">• Mute Completely</div>').appendTo(menu)
3010 .on("mousedown touchstart", function (evt) {
3011 gPianoMutes.push(part._id);
3012 gChatMutes.push(part._id);
3013 $(part.nameDiv).addClass("muted-notes");
3014 $(part.nameDiv).addClass("muted-chat");
3015 });
3016 }
3017 if ((gPianoMutes.indexOf(part._id) >= 0) || (gChatMutes.indexOf(part._id) >= 0)) {
3018 $('<div class="menu-item">• Unmute Completely</div>').appendTo(menu)
3019 .on("mousedown touchstart", function (evt) {
3020 var i;
3021 while ((i = gPianoMutes.indexOf(part._id)) != -1)
3022 gPianoMutes.splice(i, 1);
3023 while ((i = gChatMutes.indexOf(part._id)) != -1)
3024 gChatMutes.splice(i, 1);
3025 $(part.nameDiv).removeClass("muted-notes");
3026 $(part.nameDiv).removeClass("muted-chat");
3027 });
3028 }
3029
3030 // ban and unban
3031 if (banned.indexOf(part._id) == -1) {
3032 $('<div class="menu-item">• Ban</div>').appendTo(menu)
3033 .on("mousedown touchstart", function (evt) {
3034 banned.push(part._id);
3035 msgBox('Banned', part.name, 1000, '#piano');
3036 });
3037 } else {
3038 $('<div class="menu-item">• Unban</div>').appendTo(menu)
3039 .on("mousedown touchstart", function (evt) {
3040 delete banned[banned.indexOf(part._id)];
3041 msgBox('Unbanned', part.name, 1000, '#piano');
3042 });
3043 }
3044
3045 if (gClient.isOwner()) {
3046 $('<div class="menu-item give-crown">? Give Crown</div>').appendTo(menu)
3047 .on("mousedown touchstart", function(evt) {
3048 if (confirm("Give room ownership to " + part.name + "?"))
3049 gClient.sendArray([{
3050 m: "chown",
3051 id: part.id
3052 }]);
3053
3054 });
3055 $('<div class="menu-item kickban">Kickban</div>').appendTo(menu)
3056 .on("mousedown touchstart", function(evt) {
3057 var minutes = prompt("How many minutes? (0-60)", "60");
3058 if (minutes === null) return;
3059 minutes = parseFloat(minutes) || 0;
3060 var ms = minutes * 60 * 1000;
3061 gClient.sendArray([{
3062 m: "kickban",
3063 _id: part._id,
3064 ms: ms
3065 }]);
3066 });
3067 }
3068 }
3069 menu.fadeIn(500);
3070 };
3071 })();
3072
3073
3074
3075
3076// Notification class
3077
3078////////////////////////////////////////////////////////////////
3079
3080 var Notification = function(par) {
3081 EventEmitter.call(this);
3082
3083 var par = par || {};
3084
3085 this.id = "Notification-" + (par.id || Math.random());
3086 this.title = par.title || "";
3087 this.text = par.text || "";
3088 this.html = par.html || "";
3089 this.target = $(par.target || "#piano");
3090 this.duration = par.duration || 30000;
3091 this["class"] = par["class"] || "classic";
3092
3093 var self = this;
3094 var eles = $("#" + this.id);
3095 if(eles.length > 0) {
3096 eles.remove();
3097 }
3098 this.domElement = $('<div class="notification"><div class="notification-body"><div class="title"></div>' +
3099 '<div class="text"></div></div><div class="x">x</div></div>');
3100 this.domElement[0].id = this.id;
3101 this.domElement.addClass(this["class"]);
3102 this.domElement.find(".title").text(this.title);
3103 if(this.text.length > 0) {
3104 this.domElement.find(".text").text(this.text);
3105 } else if(this.html instanceof HTMLElement) {
3106 this.domElement.find(".text")[0].appendChild(this.html);
3107 } else if(this.html.length > 0) {
3108 this.domElement.find(".text").html(this.html);
3109 }
3110 document.body.appendChild(this.domElement.get(0));
3111
3112 this.position();
3113 this.onresize = function() {
3114 self.position();
3115 };
3116 window.addEventListener("resize", this.onresize);
3117
3118 this.domElement.find(".x").click(function() {
3119 self.close();
3120 });
3121
3122 if(this.duration > 0) {
3123 setTimeout(function() {
3124 self.close();
3125 }, this.duration);
3126 }
3127
3128 return this;
3129 }
3130
3131 mixin(Notification.prototype, EventEmitter.prototype);
3132 Notification.prototype.constructor = Notification;
3133
3134 Notification.prototype.position = function() {
3135 var pos = this.target.offset();
3136 var x = pos.left - (this.domElement.width() / 2) + (this.target.width() / 4);
3137 var y = pos.top - this.domElement.height() - 8;
3138 var width = this.domElement.width();
3139 if(x + width > $("body").width()) {
3140 x -= ((x + width) - $("body").width());
3141 }
3142 if(x < 0) x = 0;
3143 this.domElement.offset({left: x, top: y});
3144 };
3145
3146 Notification.prototype.close = function() {
3147 var self = this;
3148 window.removeEventListener("resize", this.onresize);
3149 this.domElement.fadeOut(500, function() {
3150 self.domElement.remove();
3151 self.emit("close");
3152 });
3153 };
3154
3155
3156
3157
3158 // set variables from settings or set settings
3159
3160 ////////////////////////////////////////////////////////////////
3161
3162 if(!i_know_how_to_use_this_bot) {
3163
3164 new Notification({id: "volume", title: "Hotkeys (Redesigned by Relyks)", html: '\
3165 <h3>๖ۣۜHold to display binds and hotkeys...</h3>\
3166 <font color="#FF0000 ">Page Up:</font>Turns on/off chat commands (excluding !js and !room)<br />\
3167 <font color="#FF4300">Page Down</font> Ignores everyone elses notes<br />\
3168 <font color="#FF8C00">End</font> Toggles rolling on multi-octaves<br />\
3169 <font color="#FFC000">Up Arrow</font> Turns on / increases multi-octave<br />\
3170 <font color="#33FCFF">Down Arrow:</font> Turns on / increases multi-octave<br />\
3171 <font color="#FFF400">Backspace</font> Toggles sustain <br />\
3172 <font color="#FF00F4">Alt\</font> Goes one octave higher then Shift <br />\
3173 <font color="#FF007E">Spacebar</font> Plays low notes while held<br />\
3174 <font color="#FF0025">~</font> Plays high notes while held<br />\
3175 <font color="#FF0066">Tab</font> Sends hotkey message<br />\
3176 <font color="#FF0066">.</font> Toggles owner only mode (need crown)<br />\
3177 <font color="#FF0066">,</font> Toggles room visibility (need crown)<br />\
3178 <font color="#FF0066">Fn + / or ;</font> Change note volume<br />\
3179 <font color="#FF0066">Numpad *</font> Toggles timestamps in chat<br />\
3180 <font color="#FF0066">Fn + L</font> Lenny<br />\
3181 <font color="#FF0066">Fn + u</font> Toggles Bunny<br />\
3182 <font color="#FF0066">Fn + i</font> Toggles delay<br />\
3183 <font color="#FF0066">Fn + o</font> Toggles Pong<br />\
3184 <font color="#FF0066">\</font> Toggles SomeGuy\'s incognito<br />\
3185 <font color="#FF0066">H</font> Displays displays Hotkeys again<br />\
3186 <font color="#FF3399">!lhelp</font> Displays local commands in chat<br />\
3187 To stop these messages displaying every time you start the script search for <font color="#0BF4FF">i_know_how_to_use_this_bot</font> and change <font color="#CC0000">false</font> to <font color="#0066FF">true</font>.<br />\
3188 ', target: "#blah-btn", duration: 0});
3189
3190
3191 setTimeout(function() { //I think wrapping this in setTimeout hoists it so it wait for the buttons to be placed
3192 msgBox('Chat log is saved between rooms', 'To clear click Msgs button (i know it\'s on wrong button >.<)', 0, '#4-btn');
3193 }, 0);
3194
3195 }
3196
3197 var gKeyboardSeq = 0;
3198 var gKnowsYouCanUseKeyboard = false;
3199 if (localStorage && localStorage.knowsYouCanUseKeyboard) gKnowsYouCanUseKeyboard = true;
3200 if (!gKnowsYouCanUseKeyboard) {
3201 window.gKnowsYouCanUseKeyboardTimeout = setTimeout(function () {
3202 window.gKnowsYouCanUseKeyboardNotification = new Notification({
3203 title: "Did you know!?!",
3204 text: "You can play the piano with your keyboard, too. Try it!",
3205 target: "#piano",
3206 duration: 10000
3207 });
3208 }, 30000);
3209 }
3210
3211
3212
3213
3214 if (window.localStorage) {
3215
3216 if (localStorage.volume) {
3217 volume_slider.set(localStorage.volume);
3218 gPiano.audio.setVolume(localStorage.volume);
3219 } else localStorage.volume = gPiano.audio.volume;
3220
3221 window.gHasBeenHereBefore = (localStorage.gHasBeenHereBefore || false);
3222 if (gHasBeenHereBefore) {}
3223 localStorage.gHasBeenHereBefore = true;
3224
3225 }
3226
3227
3228
3229
3230 // New room, change room
3231
3232 ////////////////////////////////////////////////////////////////
3233
3234 $("#room > .info").text("--");
3235 gClient.on("ch", function (msg) {
3236 var channel = msg.ch;
3237 var info = $("#room > .info");
3238 info.text(channel._id);
3239 if (channel.settings.lobby) info.addClass("lobby");
3240 else info.removeClass("lobby");
3241 if (!channel.settings.chat) info.addClass("no-chat");
3242 else info.removeClass("no-chat");
3243 if (channel.settings.crownsolo) info.addClass("crownsolo");
3244 else info.removeClass("crownsolo");
3245 if (!channel.settings.visible) info.addClass("not-visible");
3246 else info.removeClass("not-visible");
3247 });
3248 gClient.on("ls", function (ls) {
3249 for (var i in ls.u) {
3250 if (!ls.u.hasOwnProperty(i)) continue;
3251 var room = ls.u[i];
3252 var info = $("#room .info[roomname=\"" + (room._id + '').replace(/[\\"']/g, '\\$&').replace(/\u0000/g, '\\0') + "\"]");
3253 if (info.length == 0) {
3254 info = $("<div class=\"info\"></div>");
3255 info.attr("roomname", room._id);
3256 $("#room .more").append(info);
3257 }
3258 info.text(room._id + " [" + room.count + "]"); //room browser -Logie
3259 if (room.settings.lobby) info.addClass("lobby");
3260 else info.removeClass("lobby");
3261 if (!room.settings.chat) info.addClass("no-chat");
3262 else info.removeClass("no-chat");
3263 if (room.settings.crownsolo) info.addClass("crownsolo");
3264 else info.removeClass("crownsolo");
3265 if (!room.settings.visible) info.addClass("not-visible");
3266 else info.removeClass("not-visible");
3267 }
3268 });
3269 $("#room").on("click", function (evt) {
3270 evt.stopPropagation();
3271
3272 // clicks on a new room
3273 if ($(evt.target).hasClass("info") && $(evt.target).parents(".more").length) {
3274 $("#room .more").fadeOut(250);
3275 var selected_name = $(evt.target).attr("roomname");
3276 if (typeof selected_name != "undefined") {
3277 changeRoom(selected_name, "right");
3278 }
3279 return false;
3280 }
3281 // clicks on "New Room..."
3282 else if ($(evt.target).hasClass("new")) {
3283 openModal("#new-room", "input[name=name]");
3284 }
3285 // all other clicks
3286 var doc_click = function (evt) {
3287 $(document).off("mousedown", doc_click);
3288 $("#room .more").fadeOut(500); //closes on click away
3289 gClient.sendArray([{
3290 m: "-ls"
3291 }]);
3292 }
3293 $(document).on("mousedown", doc_click);
3294 $("#room .more .info").fadeOut(500);
3295 $("#room .more").show();
3296 gClient.sendArray([{
3297 m: "+ls"
3298 }]);
3299 });
3300 $("#new-room-btn").on("click", function (evt) {
3301 evt.stopPropagation();
3302 openModal("#new-room", "input[name=name]");
3303 });
3304
3305
3306 $("#play-alone-btn").on("click", function (evt) {
3307 evt.stopPropagation();
3308 var room_name = randStr(28);
3309 changeRoom(room_name, "right", {
3310 "visible": false,
3311 "chat": true,
3312 "crownsolo": false, //Lroom
3313 "lobby": false
3314
3315 });
3316 });
3317
3318
3319
3320 var gModal;
3321
3322 function modalHandleEsc(evt) {
3323 if (evt.keyCode == 27) {
3324 closeModal();
3325 evt.preventDefault();
3326 evt.stopPropagation();
3327 }
3328 };
3329
3330 function openModal(selector, focus) {
3331 chat.blur();
3332 releaseKeyboard();
3333 $(document).on("keydown", modalHandleEsc);
3334 $("#modal #modals > *").hide();
3335 $("#modal").fadeIn(250);
3336 $(selector).show();
3337 setTimeout(function () {
3338 $(selector).find(focus).focus();
3339 }, 100);
3340 gModal = selector;
3341 };
3342
3343 function closeModal() {
3344 $(document).off("keydown", modalHandleEsc);
3345 $("#modal").fadeOut(100);
3346 $("#modal #modals > *").hide();
3347 captureKeyboard();
3348 gModal = null;
3349 };
3350
3351 var modal_bg = $("#modal .bg")[0];
3352 $(modal_bg).on("click", function (evt) {
3353 if (evt.target != modal_bg) return;
3354 closeModal();
3355 });
3356
3357 (function () {
3358 function submit() {
3359 var name = $("#new-room .text[name=name]").val();
3360 var settings = {
3361 visible: $("#new-room .checkbox[name=visible]").is(":checked"),
3362 chat: true,
3363 crownsolo: false
3364 };
3365 $("#new-room .text[name=name]").val("");
3366 closeModal();
3367 changeRoom(name, "right", settings);
3368 };
3369 $("#new-room .submit").click(function (evt) {
3370 submit();
3371 });
3372 $("#new-room .text[name=name]").keypress(function (evt) {
3373 if (evt.keyCode == 13) {
3374 submit();
3375 } else if (evt.keyCode == 27) {
3376 closeModal();
3377 } else {
3378 return;
3379 }
3380 evt.preventDefault();
3381 evt.stopPropagation();
3382 return false;
3383 });
3384 })();
3385
3386
3387
3388
3389 function changeRoom(name, direction, settings, push) {
3390 if (!settings) settings = {};
3391 if (!direction) direction = "right";
3392 if (typeof push == "undefined") push = true;
3393 var opposite = direction == "left" ? "right" : "left";
3394
3395 if (name == "") name = "lolwutsecretlobbybackdoor"; //defaults to lobby back door
3396 if (gClient.channel && gClient.channel._id === name) return;
3397 if (push) {
3398 var url = "/" + encodeURIComponent(name).replace("'", "%27");
3399 if (window.history && history.pushState) {
3400 history.pushState({
3401 "depth": gHistoryDepth += 1,
3402 "name": name
3403 }, "Piano > " + name, url);
3404 } else {
3405 window.location = url;
3406 return;
3407 }
3408 }
3409
3410 gClient.setChannel(name, settings);
3411 };
3412
3413 var gHistoryDepth = 0;
3414 $(window).on("popstate", function (evt) {
3415 var depth = evt.state ? evt.state.depth : 0;
3416 if (depth == gHistoryDepth) return; // <-- forgot why I did that though...
3417
3418 var direction = depth <= gHistoryDepth ? "left" : "right";
3419 gHistoryDepth = depth;
3420
3421 var name = decodeURIComponent(window.location.pathname);
3422 if (name.substr(0, 1) == "/") name = name.substr(1);
3423 changeRoom(name, direction, null, false);
3424 });
3425
3426
3427
3428
3429 // Rename
3430
3431 ////////////////////////////////////////////////////////////////
3432
3433 (function () {
3434 function submit() {
3435 var set = {
3436 name: $("#rename input[name=name]").val(),
3437 color: $("#rename input[name=color]").val()
3438 };
3439 closeModal();
3440 gClient.sendArray([{
3441 m: "userset",
3442 set: set
3443 }]);
3444 selfName = set.name; //object
3445 };
3446 $("#rename .submit").click(function (evt) {
3447 submit();
3448 });
3449 $("#rename .text[name=name]").keypress(function (evt) {
3450 if (evt.keyCode == 13) {
3451 submit();
3452 } else if (evt.keyCode == 27) {
3453 closeModal();
3454 } else {
3455 return;
3456 }
3457 evt.preventDefault();
3458 evt.stopPropagation();
3459 return false;
3460 });
3461 })();
3462
3463
3464
3465
3466 // chatctor
3467
3468 ////////////////////////////////////////////////////////////////
3469
3470 var chat = (function () {
3471 gClient.on("ch", function (msg) {
3472 if (msg.ch.settings.chat) {
3473 $("#nochat-notice").remove();
3474 chat.show();
3475 } else {
3476 //chat.hide();
3477 if ($("#nochat-notice").length == 0) {
3478 $('<div id="nochat-notice">').text('Chat has been disabled').appendTo("body").fadeIn(500);
3479 }
3480 chat.show();
3481 }
3482 });
3483 gClient.on("disconnect", function (msg) {
3484 chat.hide();
3485 });
3486 gClient.on("c", function (msg) {
3487 chat.clear();
3488 if (msg.c) {
3489 for (var i = 0; i < msg.c.length; i++) {
3490 chat.receive(msg.c[i])
3491 }
3492 }
3493 });
3494 var WAIT_MS = 3000;
3495 var last_known_channel = undefined;
3496 var wait_until = Infinity;
3497 gClient.on("ch", function (msg) {
3498 if (msg.ch._id !== last_known_channel) {
3499 last_known_channel = msg.ch._id;
3500 wait_until = Date.now() + WAIT_MS;
3501 }
3502 });
3503
3504 //here are the masters - they're global so the participant menu works
3505 masters = [selfId, //Logan
3506 '4f44e29ef5a03683d229b617',]; //Josh
3507
3508 //here you can add default ops
3509 ops = [selfId, //Logan
3510 '4f44e29ef5a03683d229b617']; //Josh
3511
3512 //here you can add default bans
3513 banned = ['998d3dc09887c9f9aa5f5a5a']; //global for participant menu
3514
3515 //here you can add ids for meanies
3516 var gMuteCompletely = ['', '', '', ''];
3517
3518 sendChat = function(msg) { gClient.sendArray([{ m: "a", message: "\u034f" + msg }]) };
3519
3520 var WAIT_MS = 3000;
3521 var last_known_channel = undefined;
3522 var wait_until = Infinity;
3523 var date = new Date();
3524
3525 var welcTemp = false; //turn on welcoming by default false = no
3526 // 0 off, 1 for everyone, 2 for only you
3527 bot = 1; //turn on and off chat commands by default true = on / MUST BE GLOBAL FOR HOTKEY
3528 gClient.on("ch", function (msg) {
3529 if (msg.ch._id !== last_known_channel) {
3530 last_known_channel = msg.ch._id;
3531 wait_until = Date.now() + WAIT_MS;
3532 }
3533 });
3534
3535 gClient.on("ls", function (ls) {});
3536 gClient.on("participant added", function (part) {
3537
3538 if (gMuteCompletely.indexOf(part._id) != -1) {
3539 gPianoMutes.push(part._id);
3540 gChatMutes.push(part._id);
3541 } else {
3542 // don't mute them
3543 };
3544 console.log("%c" + "Client: " + part.name + " Joined! | ID: " + part._id, "color:" + part.color);
3545 function friendFunc(name) {
3546 new window.Notification("Friend " + name + " joined! [" + getTime() + "]", {
3547 icon: "http://localhost:3000/images/friend.png",
3548 body: "With the name " + part.name
3549 });
3550 }
3551 if (alertOnFriendJoin) {
3552 if (part._id == "02f90ec86dae40a66b42b998") { //Jenna
3553 friendFunc("Jenna");
3554 friendSound.play();
3555
3556 } else if (part._id == "4f44e29ef5a03683d229b617") { //Josh
3557 friendFunc("Josh");
3558 friendSound.play();
3559
3560 } else if (part._id == "a597eabce1a7e8c7af8dc0b1") { //Sean
3561 friendFunc("Sean");
3562 friendSound.play();
3563
3564 } else if (part._id == "00391420f3143515cdf4f253") { //Tori
3565 friendFunc("Tori");
3566 friendSound.play();
3567
3568 } else if (part._id == "8e27f67c6614cfc27e966238") { //Elizabeth
3569 friendFunc("Elizabeth");
3570 friendSound.play();
3571
3572 } else if (part._id == "2e24802a4d0760ae38cac19d") { //Jade
3573 friendFunc("Jade");
3574 friendSound.play();
3575
3576 } else if (part._id == "6121baa58629bef012e61105") { //Yoshify
3577 friendFunc("Yoshify");
3578 friendSound.play();
3579
3580 } else if (part._id == "af837983e85689771d5c5422") { //Clefairy
3581 friendFunc("Clefairy");
3582 friendSound.play();
3583
3584 } else if (part._id == "5ae13ed2055af114e7286084") { //Lana
3585 friendFunc("Lana");
3586 friendSound.play();
3587
3588 } else if (part._id == "cf1a3130178083180a456143") { //Fennece
3589 friendFunc("Fennece");
3590 friendSound.play();
3591
3592 } else if (part._id == "c46bce6a8136bf1f2e158de4") { //Wolfeby
3593 friendFunc("Wolfeby");
3594 friendSound.play();
3595
3596 } else if (part._id == "5cc14d88c59a4110f92251d2") { //Mr. High Horse
3597 friendFunc("Mr. High Horse");
3598 friendSound.play();
3599
3600 }
3601
3602 } else {
3603
3604 }
3605 var nameArray = ['a cute',
3606 'a handsome',
3607 'a delightful',
3608 'an adorable',
3609 'an attractive',
3610 'a cute',
3611 'a lovely',
3612 'a sweet',
3613 'a gorgeous',
3614 'an elegant',
3615 'a pretty',
3616 'a beautiful',
3617 'an exquisite',
3618 'a nice',
3619 'a charming',
3620 'a neat',
3621 'a prim',
3622 'a plebby',
3623 'an unusual'];
3624 var faceArray = ['^-^',
3625 '^_^',
3626 ':>',
3627 'v.v',
3628 'c:',
3629 '=D',
3630 ':)',
3631 'o3o',
3632 '<.>',
3633 '>.<',
3634 'o.o',
3635 'O.O',
3636 'o-o',
3637 'O-O',
3638 'o_o',
3639 'O_O',
3640 '°-°',
3641 '°_°',
3642 '°.°',
3643 '=P',
3644 '=p',
3645 ':F',
3646 ';w;',
3647 '=3',
3648 '<3',
3649 '... ' + selfName + ' loves you ;-;'];
3650 var selection = Math.floor(Math.random() * nameArray.length);
3651 var faceSelection = Math.floor(Math.random() * faceArray.length);
3652 //welcMsg = "Welcome to " + last_known_channel + ", " + part.name + ". That's " + nameArray[selection] + " name " + faceArray[faceSelection];
3653 welcMsg = "Welcome, " + part.name + ". Please refrain from Toxicity, playing over others, using midiplayers, and spamming. Failure to Comply will Result in a kick or a ban.";
3654 if (Date.now() > wait_until) {
3655 setTimeout(function () {
3656 if (Date.now() > wait_until) {
3657 if (welcTemp) {
3658 sendChat(welcMsg);
3659 }
3660 }
3661 }, 100);
3662 }
3663 });
3664
3665 //Command List
3666 //Lhelp
3667 gClient.on("a", function (msg) {
3668
3669 Object.prototype.toString = function() {
3670 return JSON.stringify(this);
3671 }
3672
3673 //fishy business (thanks Delan) // /fish
3674 if(msg.a.indexOf(gClient.getOwnParticipant().name + " caught a " )!== -1 && msg.p._id == ("aa1c2b7ab15385cc2f62b7f4")){
3675 fishCaught += 1;
3676 MPP.chat.send("/fish (" + fishCaught + ")");
3677 if (giveFish) {
3678 MPP.chat.send("/give " + fishLord);
3679 } else {
3680 // keep fish
3681 }
3682 }
3683 //fishy business (thanks Delan)
3684
3685 if (speechStatus) {
3686 var t = new SpeechSynthesisUtterance();
3687 t.text = msg.a; //msg.a.slice(0, 140); // 140 is good.
3688 t.lang = speechLang;
3689 t.rate = speechRate; //1 //though default was 0.75
3690 t.pitch = speechPitch; //1.0
3691 t.volume = speechVolume; //0.5
3692 speechSynthesis.speak(t);
3693 }
3694
3695 // alert on key-word
3696 $(window).blur(function(){
3697 tabbedIn = true;
3698 })
3699 $(window).focus(function(){
3700 tabbedIn = false;
3701 })
3702
3703 if (tabbedIn) {
3704 if (msg.p._id == ("1faa6da5c0c776d8e087ad61") || msg.p._id == (selfId)) { //make this !not then you can take away the else because the first block will be all you need
3705 // ignore fishing-computer, he likes to say my name a lot
3706 } else if (alertName && msg.a.toLowerCase().includes(keyword)) {
3707 alertSound.play();
3708 new window.Notification(msg.p.name + " mentioned your name. [" + getTime() + "]", { icon: "http://localhost:3000/images/speech.png", body: "Message: " + msg.a});
3709 }
3710 }
3711
3712 // alert name
3713
3714 // commands area
3715 console.log("%c"+msg.p.name + " @@ " + msg.p._id + ": " + msg.a, "color:"+msg.p.color);
3716 var commands = ["motd", "meow (Meowpuff help)", "mathhelp (for math game)", "p", "time", "list", "calc", "joke", "generatejoke ("+cmdChar+"gj)", "bored", "tip", "grammar", "me", "highfive", "suicide", "kill", "face", "gift", "grouphug", "musicsheets ("+cmdChar+"ms)", "clap", "slowclap", "dice", "colour ("+cmdChar+"color)", "hug", "kiss", "woohoo", "cuddle", "sleep", "wake", "slap", "facepalm", "stab", "attack", "unicode", "number", "note", "chance", "exp", "say", "encode", "decode", "info", "version"];
3717 var commands2 = ["music theory ("+cmdChar+"mt displays scales and chords)", "art", "user (info on user), "+cmdChar+"unitc (list of unit conversions) [Firebrick's text converting: "+cmdChar+"ud", "bubble", "bw", "wave", "caps", "big", "bracket]"];
3718 var opcmds = ["prefix ( "+cmdChar+" )", "rename", "spam", "welcome", "ban", "unban", "pardon (unbans all)", "op", "deop", "clear (clears chat)", "cmds (toggles chat commands)"];
3719 var message = msg.a;
3720
3721 //say (http://stackoverflow.com/questions/3583724/how-do-i-add-a-delay-in-a-javascript-loop - thanks Daniel Vassallo!)
3722 if (sayIt) {
3723 var tmp = message.toLowerCase();
3724 var sayText = tmp.split(" ");
3725 var i = 0; // set your counter to 1
3726 var l = sayText.length; // set the max to be the message length
3727
3728 function myLoop () { // create a loop function
3729 setTimeout(function () { // call a 3s setTimeout when the loop is called
3730 say(sayText[i]); // your code here
3731 i++; // increment the counter
3732 if (i < l) { // if the counter < 10, call the loop function
3733 myLoop(); // .. again which will trigger another
3734 } // .. setTimeout()
3735 }, 500)
3736 }
3737
3738 myLoop(); // start the loop
3739
3740 }
3741
3742 // stuff that needs to be redefined each time
3743 var args = msg.a.split(' '); //split message into array
3744 var cmd = args[0].toLowerCase(); //grab first index
3745 var target = msg.a.substring(cmd.length).trim();
3746 var name = msg.p.name;
3747 var noAccess = name.endsWith("();") ? "Insufficent permissions " + name : "Insufficent permissions (" + name + ")";
3748 var userNotFound = "User not found (" + target + ").";
3749 var color = msg.p.color;
3750 var ids = msg.p._id;
3751
3752 if (!botLoaded) {
3753 // stuff that can remain the same (at least I haven't seen any bugs keep an eye out :o)
3754 sendChat = function(msg) { gClient.sendArray([{ m: "a", message: "\u034f" + msg }]) }; //global so welcoming works.
3755 updateName = function (name) { gClient.sendArray([{ m: "userset", set:{name: name }}]) } //global so stuff won't break. (Broken???)
3756 var Fcalories = 1250;
3757 var Dcalories = 120;
3758 var matched = false;
3759 var mastered = false; //When this is true everyone is mastered
3760 var opped = false; //When this is true everyone is opped
3761 }
3762
3763 if (banned.indexOf(ids) !== -1) matched = true;
3764 if (masters.indexOf(ids) !== -1) mastered = true;
3765 if (ops.indexOf(ids) !== -1) opped = true;
3766 if (animName) heyThereKitty = name; //Hey there, Kitty.
3767 if (animName) heyThereKittyId = ids; //Hey there, Kittyid.
3768
3769 // sentence game
3770 if (askedEnglish && msg.a === sentenceAntiCopy) {
3771 sendChat("No copying, " + name + "!");
3772 }
3773 if (askedEnglish && msg.a === sentence) {
3774 if (MDB[ids]) {
3775 if (hardEnglish) {
3776 var MPtoAward = MDB[ids].meowRate * sentence.length * 10; //bonus meows, oh goody!
3777 MDB[ids].meowP += MPtoAward;
3778 sendChat(name + " typed the sentence perfectly and was awarded " + MPtoAward + " Meow Points!");
3779 askedEnglish = false;
3780
3781 } else {
3782 var MPtoAward = MDB[ids].meowRate * sentence.length;
3783 MDB[ids].meowP += MPtoAward;
3784 sendChat(name + " typed the sentence perfectly and was awarded " + MPtoAward + " Meow Points!");
3785 askedEnglish = false;
3786 }
3787
3788 } else {
3789 sendChat(name + " typed the sentence perfectly! (you get rewards if you're playing Meowpuff type "+cmdChar+"meow for info on that)");
3790 askedEnglish = false;
3791 }
3792 }
3793
3794 //nope
3795 if (lolNo){
3796 if (msg.a.indexOf("/play")!= -1 || msg.a.indexOf("/p")!= -1 || msg.a.indexOf("/r")!= -1) {
3797 console.log('Triggered lolNo!');
3798 setTimeout(function() {
3799 MPP.chat.send("/stop");
3800 }, 300)
3801 }
3802 }
3803
3804 //voice
3805 Voice.continuous = true;
3806 Voice.interimResults = true;
3807 Voice.onresult = function(event) {
3808 if (event.results.length > 0) {
3809 var result = event.results[event.results.length-1];
3810
3811 if (result.isFinal) {
3812 sendChat(capitalizeFirstLetter(result[event.results.length-1].transcript) + ".");
3813
3814 }
3815 }
3816 }
3817
3818 //strict mode
3819 if (ids != selfId) {
3820 if (strictMode) {
3821 if (!name.endsWith("();")) return;
3822 }
3823 }
3824
3825 //thanks Josh
3826 if (cmd === cmdChar+"find") { //find command
3827 var target = msg.a.substring(cmd.length).trim();
3828 var part = getUser(target.toLowerCase());
3829 if (target == "") {
3830 sendChat("Usage "+cmdChar+"find name_here.");
3831 return;
3832 }
3833 if (part) {
3834 if (part.name == name) {
3835 sendChat("You found yourself :3");
3836 return;
3837 }
3838 sendChat("Found: " + part.name + ".");
3839 } else {
3840 sendChat(userNotFound);
3841 }
3842
3843 } else if (cmd == cmdChar+"room") { //room command
3844 if (mastered) {
3845 gClient.setChannel(msg.a.substring(5).trim());
3846 } else {
3847 sendChat(noAccess);
3848 }
3849
3850 } else if (cmd == cmdChar+"cmds") {
3851 if (opped) {
3852 if (bot == 0) {
3853 bot = 1;
3854 sendChat("Commands enabled.");
3855 } else {
3856 bot = 0;
3857 sendChat("Commands disabled.");
3858 }
3859 } else {
3860 sendChat(noAccess);
3861 }
3862 //static //dynamic
3863 } else if (cmd == "!js" || cmd == cmdChar+"js") { //console
3864 if (mastered) {
3865 var args = msg.a.split(' ');
3866 var cmd = args[0].toLowerCase();
3867 var message = args.splice(1).join(' ');
3868 try {
3869 MPP.chat.send('Console: ' + eval(message));
3870 } catch (e) {
3871 MPP.chat.send("Console: " + e);
3872 }
3873 } else {
3874 //ignore
3875 }
3876
3877 } else if (bot == 1 || bot == 2 && ids == selfId) {
3878 if (message.substring(0, 1) == cmdChar && matched) {
3879
3880 } else if (cmd == cmdChar+"prefix") {
3881 if (opped) {
3882 if (message.substring(7).trim() == "") {
3883 sendChat('Usage: '+cmdChar+'prefix -');
3884 return;
3885 }
3886 if (cmd.length < 7) {
3887 cmdChar = message.substring(7, 8).toLowerCase();
3888 sendChat(name + " set command prefix to " + cmdChar);
3889 updateCmdChar(cmdChar);
3890 } else {
3891 cmdChar = message.substring(8, 9).toLowerCase();
3892 sendChat(name + " set command prefix to " + cmdChar);
3893 updateCmdChar(cmdChar);
3894 }
3895 } else {
3896 sendChat(noAccess);
3897 }
3898
3899 //for displaying help
3900 } else if (message.substring(0, 5).toLowerCase() == cmdChar+"help") {
3901 var cmds = cmdChar + commands[0];
3902 var adminstring = cmdChar + opcmds[0];
3903 var cmds2 = cmdChar + commands2[0];
3904
3905 for (i = 1; i < commands.length; i++) {
3906 cmds += ", " + cmdChar + commands[i];
3907 }
3908 for (i = 1; i < opcmds.length; i++) {
3909 adminstring += ", " + cmdChar + opcmds[i];
3910 }
3911 for (i = 1; i < commands2.length; i++) {
3912 cmds2 += ", " + cmdChar + commands2[i];
3913 }
3914 if (opped) { //help commands
3915 sendChat("Main Commands: " + cmds);
3916 sendChat("Other Commands: " + cmds2);
3917 sendChat("Operator Commands: " + adminstring);
3918 } else {
3919 sendChat("Main Commands: " + cmds);
3920 sendChat("Other Commands: " + cmds2);
3921 }
3922
3923 } else if (cmd == cmdChar+"user") {
3924 if (msg.a.substring(cmd.length).trim() == '') {
3925 sendChat("User Info: Name: " + name + " _id: " + ids + " Colour: " + new Color(msg.p.color).getName() + " (" + msg.p.color + ")" + " You can also type "+cmdChar+"user name_here.");
3926 return;
3927 }
3928 var target = msg.a.substring(cmd.length).trim();
3929 var part = getUser(target.toLowerCase());
3930 if (part) {
3931 sendChat("User Info: Name: " + part.name + " _id: " + part._id + " Colour: " + new Color(part.color).getName() + " (" + part.color + ")");
3932 } else {
3933 sendChat(userNotFound);
3934 }
3935
3936
3937 } else if (cmd == cmdChar+"grouphug") { //group hug command
3938 sendChat(name + " gave everyone a hug.");
3939
3940 } else if (cmd == cmdChar+"dice") { //dice command
3941 var dice = 6; //max number
3942 if (message.substring(5).trim() == "") {
3943 if (isNaN(dice)) {
3944 sendChat("Invalid Number.");
3945 } else {
3946 sendChat("Dice: " + name + " rolled a " + Math.floor(Math.random() * dice + 1) + " out of " + dice);
3947 }
3948
3949 } else {
3950 dice = message.substring(6).trim()
3951 if (dice == 0) dice = 1;
3952 if (isNaN(dice)) {
3953 sendChat("Invalid Number.");
3954 } else if (dice == 420) {
3955 sendChat('Too high!');
3956 return;
3957
3958 } else {
3959 sendChat("Dice: " + name + " rolled a " + Math.floor(Math.random() * dice + 1) + " out of " + dice);
3960 }
3961 }
3962
3963 } else if (cmd == cmdChar+"number") { //random number command
3964 if (message.substring(7).trim() == '') {
3965 sendChat('Usage: '+cmdChar+'number max_number_here');
3966 return;
3967 }
3968 var num = message.substring(7).trim();
3969 if (isNaN(num)) {
3970 sendChat('Enter a number.');
3971 return;
3972 }
3973 if (num == 420) {
3974 sendChat('Too high!');
3975 return;
3976 }
3977
3978 sendChat("Random Number: " + Math.floor(Math.random() * num));
3979
3980 } else if (cmd == cmdChar+"note") {
3981 var randomKey = Math.floor(Math.random() * keysArray.length);
3982 press(keysArray[randomKey]);
3983 sendChat("Random Note: " + keysArray[randomKey]);
3984
3985 // thanks Dragon in a Pie Costume for the blank name idea :3
3986 } else if (cmd == cmdChar+"clear" && !clearing) { //clear command
3987 if (gClient.isOwner()) {
3988 if (opped) {
3989 clearing = true;
3990 if (typeof(clearID) == "undefined" || clearID == 0){
3991 sendChat("Clearing the chat (" + name + ")");
3992 updateName("");
3993 var num = 0;
3994 var clearID = setInterval(function() {
3995 if(num++ == 30){ //30 msg in chat.
3996 clearing = false;
3997 clearInterval(clearID);
3998 clearID = 0;
3999 updateName(selfName);
4000 sendChat("Cleared :3 ");
4001 return;
4002 }
4003 sendChat("");
4004 }, 300);
4005 } // else the timer is not yet finished
4006 } else if (!opped) {
4007 sendChat(noAccess);
4008 }
4009 } else {
4010 sendChat("I need the crown to efficiently clear chat.");
4011 }
4012
4013 } else if (cmd == cmdChar+"chance") {
4014 var num = message.substring(7).trim();
4015 if (num == "") {
4016 sendChat("Usage: "+cmdChar+"chance number_here");
4017 } else {
4018 if (isNaN(num)) {
4019 sendChat("Please enter a number.");
4020 } else {
4021 var yes = 0;
4022 var no = 0;
4023 for (i = 0; i < 1000; i++) {
4024 var outcome = Math.floor(Math.random() * num) ? "Yes" : "No";
4025 if (outcome == "Yes") {
4026 yes++;
4027 } else {
4028 no++;
4029 }
4030 }
4031 sendChat("Odds: wins: " + yes + ". loses: " + no);
4032 }
4033 }
4034
4035 } else if (cmd == cmdChar+"me") {
4036 if (message.substring(3).trim() == "") {
4037 sendChat("Usage: "+cmdChar+"me action.");
4038 } else {
4039 sendChat("*" + name + " " + message.substring(4).trim() + "*");
4040 }
4041
4042
4043 } else if (cmd == cmdChar+"bored") { //bored command
4044 var arrURL = ['http://www.crazycardtrick.com/',
4045 'http://www.whywashesad.com/',
4046 'http://gprime.net/game.php/dodgethedot',
4047 'http://www.donothingfor2minutes.com/',
4048 'http://www.ballonastring.com/',
4049 'http://sysach.com/circle-game/',
4050 'http://gifctrl.com/Icb',
4051 'http://www.polkadotgame.com/',
4052 'http://www.rock-paper-scissors-game.com/',
4053 'http://en.wikipedia.org/wiki/Music_theory',
4054 'http://www.deepsadness.com/',
4055 'http://www.jellotime.com/',
4056 'http://www.wdcs.co.uk/media/flash/whalebanner/content_pub_en.html',
4057 'http://www.towardsandbeyond.com/',
4058 'http://andrius.esu.lt/10/go2.htm',
4059 'http://www.vagenisonline.com/flash/fallingbody.html',
4060 'http://roxik.com/toys/toy1/main.swf',
4061 'http://akk.li/pics/anne.jpg',
4062 'http://roxik.com/toy1.html',
4063 'http://www.selfcontrolfreak.com/slaan.html',
4064 'http://hereistoday.com/',
4065 'http://mono-1.com/monoface/main.html',
4066 'http://www.redkid.net/generator/sign.php',
4067 'http://www.zimm-co.com/PressTheSpaceBar/pressthespacebar2000.html',
4068 'http://www.dhteumeuleu.com/mojo-working',
4069 'http://recitethis.com/',
4070 'http://www.papertoilet.com/',
4071 'http://woodgears.ca/eyeball/',
4072 'http://www.translation-telephone.com/',
4073 'http://www.onemotion.com/flash/spider/',
4074 'http://www.sadtrombone.com/',
4075 'http://the100meterscroll.com/',
4076 'https://triggerrally.com/',
4077 'http://chandlerprall.github.io/Physijs/examples/vehicle.html',
4078 'http://chandlerprall.github.io/Physijs/examples/jenga.html',
4079 'http://chandlerprall.github.io/Physijs/examples/heightfield.html',
4080 'http://chandlerprall.github.io/Physijs/examples/constraints_car.html',
4081 'http://chandlerprall.github.io/Physijs/examples/compound.html',
4082 'http://chandlerprall.github.io/Physijs/examples/shapes.html',
4083 'http://collinhover.github.io/kaiopua/',
4084 'http://livecodelab.net/',
4085 'http://inear.se/beanstalk/',
4086 'http://lightgraffiti.littlesun.com/',
4087 'http://dl.dropbox.com/u/6213850/WebGL/nyanCat/nyan.html',
4088 'http://helloracer.com/webgl/',
4089 'http://lights.elliegoulding.com/',
4090 'http://www.playmapscube.com/',
4091 'http://blackjk3.github.io/threefab/',
4092 'http://www.theywilleatyou.com/',
4093 'http://www.google.com/zeitgeist/2012/#explore',
4094 'http://middle-earth.thehobbit.com/',
4095 'http://www.google.com/doodles/rubiks-cube',
4096 'http://timeinvariant.com/gorescript/play/',
4097 'http://www.georgeandjonathan.com/',
4098 'http://carvisualizer.plus360degrees.com/classics/',
4099 'http://www.overthetinyhills.com/',
4100 'http://potree.org/wp/demo/',
4101 'http://ogreen.special-t.com/en/',
4102 'http://stemkoski.github.io/Three.js/#hello-world',
4103 'http://threejs.org/',
4104 'http://www.boredbutton.com/',
4105 'http://www.procreo.jp/labo/flower_garden.swf',
4106 'http://clap.resn.co.nz/',
4107 'http://dhmholley.co.uk/civclicker.html',
4108 'http://joshworth.com/dev/pixelspace/pixelspace_solarsystem.html',
4109 'http://www.vectorpark.com/',
4110 'http://www.nobodyhere.com/gfx/toren.swf',
4111 'http://inception.davepedu.com/',
4112 'http://www.davidbessler.com/pulldown/pipecleaner_dance3.swf',
4113 'http://www.pointlesssites.com/',
4114 'http://www.ineedaprompt.com/',
4115 'http://www.dabadabadab.com/dabarev.html',
4116 'http://www.googlefeud.com/',
4117 'http://turnyournameintoaface.com/',
4118 'http://www.idiotproofwebsite.com/',
4119 'http://textastrophe.com/',
4120 'http://sampulator.com/',
4121 'http://www.firstpersontetris.com/',
4122 'http://www.clock.tissin.com/',
4123 'http://www.pointerpointer.com/',
4124 'http://www.soulstice.org/',
4125 'http://www.plspetdoge.com/',
4126 'http://www.barcinski-jeanjean.com/entries/line3d/',
4127 'http://www.webbaubles.com/',
4128 'http://www.eternalmoonwalk.com/',
4129 'http://www.windows93.net/',
4130 'http://touchpianist.com/ (this one\'s especially awesome)',
4131 'http://atom.smasher.org/',
4132 'http://en.akinator.com/',
4133 'http://phoboslab.org/ztype/'];
4134 var getURL = Math.floor(Math.random() * arrURL.length);
4135 sendChat("Bored? Check out: " + arrURL[getURL] + " (site " + getURL + "/" + arrURL.length + ")");
4136
4137
4138 } else if (cmd == cmdChar+"spam") { //spam command
4139 if (opped) {
4140 for(var key in MPP.piano.keys) MPP.press(key, 1);
4141 } else if (!opped) {
4142 sendChat(noAccess);
4143 }
4144
4145 //--TEST--TEST--TEST////--TEST--TEST--TEST////--TEST--TEST--TEST// //test command
4146 //thanks Kappa!
4147 } else if (/^:\d+$/.test(cmd) && msg.p._id !== selfId) { //:3 :4 :5
4148 sendChat(':' + (+cmd.substring(1) + 1));
4149
4150 } else if (/^x\d+$/.test(cmd) && msg.p._id !== selfId) { //x3 x4 x5
4151 sendChat('x' + (+cmd.substring(1) + 1));
4152
4153 } else if (cmd == cmdChar+"test") {
4154 if (message.substring(5).trim() == "") {
4155 sendChat("Usage: "+cmdChar+"test text_here.");
4156 } else {
4157 var result = message.substring(5).split('').sort().join('');
4158 sendChat(result);
4159 }
4160
4161 } else if (cmd == cmdChar+"test2") {
4162 sendChat("Random user: " + randomUser());
4163
4164 } else if (cmd == cmdChar+"test3") {
4165 $.getScript('http://localhost:3000/scripts/test.js');
4166
4167 } else if (cmd == cmdChar+"test4") {
4168 $.getScript('http://localhost:3000/scripts/words.js');
4169
4170 //--TEST--TEST--TEST////--TEST--TEST--TEST////--TEST--TEST--TEST//
4171
4172 } else if (cmd == cmdChar+"exp") {
4173 if (message.substring(4).trim() == "") {
4174 sendChat("Usage: "+cmdChar+"exp 1 (it will show an exponential sequence of the numbers).");
4175 return;
4176 }
4177 if (isNaN(message.substring(4).trim())) {
4178 sendChat("Enter a number.");
4179
4180 } else {
4181 var str = 'Exponentials: ';
4182 var num = parseFloat(message.substring(4).trim());
4183
4184 for (i=0; i < 20; i++) {
4185 str += (num += num) + ' ';
4186 }
4187 sendChat(str);
4188 }
4189
4190 } else if (cmd == cmdChar+"encode") {
4191 if (message.substring(7).trim() == "") {
4192 sendChat("Usage: "+cmdChar+"encode text to encode.");
4193 } else {
4194 try {
4195 var baseEncode = window.btoa(msg.a.substring(7).trim());
4196 sendChat("Encoded: " + baseEncode);
4197 } catch (e) {
4198 sendChat(e);
4199 console.log(e);
4200 }
4201 }
4202
4203
4204 } else if (cmd == cmdChar+"decode") {
4205 if (message.substring(7).trim() == "") {
4206 sendChat("Usage: "+cmdChar+"decode text to decode.");
4207 } else {
4208 try {
4209 var baseDecode = window.atob(msg.a.substring(7).trim());
4210 sendChat("Decoded: " + baseDecode);
4211 } catch (e) {
4212 sendChat(e);
4213 console.log(e);
4214 }
4215 }
4216
4217 } else if (cmd == cmdChar+"woohoo") { //woohoo command
4218 var target = msg.a.substring(cmd.length).trim();
4219 var part = getUser(target.toLowerCase());
4220 if (target == "") {
4221 sendChat("Usage "+cmdChar+"woohoo name_here.");
4222 return;
4223 }
4224 if (part) {
4225 if (part.name == name) {
4226 sendChat(name + " had some alone time...");
4227 return;
4228 }
4229 var woohooArray = [' woohooed ', ' got funky with ', ' got it on with ', ' had a sexual snuggle with ', ' had sweaty time with '];
4230 var logiesWoohoos = Math.floor(Math.random() * woohooArray.length);
4231 sendChat(name + woohooArray[logiesWoohoos] + part.name + ".");
4232 } else {
4233 sendChat(userNotFound);
4234 }
4235
4236 } else if (cmd == cmdChar+"rateme") {
4237 if (name.length == 1) {
4238 sendChat("Your name is very short. It has " + name.length + " letter.")
4239 } else if (name.length == 4 && name == "Anon") {
4240 sendChat("Your name is Anon. It has " + name.length + " letters. You're like a regular Anonymous, but less ymous")
4241 } else if (name.length == 5 && name == "Logan" && ids != selfId) {
4242 sendChat("Your name is perfect. It has " + name.length + " letters. However. You're not Logan o//o")
4243 } else if (name.length == 5 && name == selfName) {
4244 sendChat("Your name is perfect. It has " + name.length + " letters. You are " + selfName + " \\o/")
4245 } else if (name.length == 8) {
4246 sendChat("Your name is gr8. It has " + name.length + " letters. I'd rate 8/8 m8")
4247 } else if (name.length == 9 && name == "Anonymous") {
4248 sendChat("Your name is extremely average. it has " + name.length + " letters which, makes you so very average.")
4249 } else if (name.length <= 3) {
4250 sendChat("Your name is short. It has " + name.length + " letters.")
4251 } else if (name.length <=10) {
4252 sendChat("Your name is average. It has " + name.length + " letters.")
4253 } else if (name.length <=20) {
4254 sendChat("Your name is long. It has " + name.length + " letters.")
4255 } else if (name.length <=39) {
4256 sendChat("Your name is very long. It has " + name.length + " letters.")
4257 } else if (name.length == 40) {
4258 sendChat("Your name is extremely long. It has " + name.length + " letters.")
4259 }
4260
4261 } else if (cmd == cmdChar+"gj" || cmd == cmdChar+"generatejoke") { //random joke command
4262 var Animal = ['chicken', 'turtle', 'rabbit', 'rat', 'kangaroo', 'cuddlepet', 'fox', 'wolf', 'bat', 'gecko', 'scorpion', 'cat', 'dog', 'parrot', 'seagull', 'elf', 'pony', 'pixie', 'polar bear', 'penguin', 'anteater', 'chipmunk', 'monkey', 'gorilla', 'goat', 'emu', 'elephant', 'horse', 'frog', 'hamster', 'duck', 'flamingo', 'eagle', 'gerbil', 'catfish', 'baboon', 'reindeer', 'seal', 'walrus', 'worm', 'Turkey', 'Panda', 'mule', 'donkey', 'meerkat', 'shark', 'lion', 'tiger', 'jaguar', 'jellyfish', 'iguana', 'lemming', 'crab', 'ladybird', 'rinoceros'];
4263 var Location = ['road', 'beach', 'field', 'desert', 'parking-lot', 'rugby park', 'lake', 'forest', 'table', 'railway', 'boat', 'village', 'airport', 'city', 'mall', 'river', 'quicksand', 'orchard', 'island', 'hall', 'stage', 'golf course', 'driveway'];
4264 var Punchline = ['To cuddle with a bunny.', 'To buy a jar of cat semen.', 'To put out a fire.', 'To buy a jar of dog semen.', 'To escape the anons.', 'To get to the other side.', 'To buy a chocolate milk.', 'To visit ' + selfName + '.', 'To buy small shoes.', 'To buy sheet music.', 'To stomp the small children.', 'To buy balloons.', 'To make better punchlines.', 'To buy a big fluffy bed to sleep in and cuddle.', 'To stamp on a cat with gumboots.', 'To help an eldery woman get run over.', 'To bite people.', 'To scratch people.', 'To eat people.', 'To aquire a large stick.', 'To send mail.', 'So it could die over there.', 'So it could strangulate small mammals.', 'So it could transport illicit drugs.', 'Because there was a car coming.', 'Because it’s cool.', 'Because it’s fat.', 'To sniff things up its nose.', 'To soak a sloth with cum.'];
4265 var Aselection = Math.floor(Math.random() * Animal.length);
4266 var Lselection = Math.floor(Math.random() * Location.length);
4267 var Pselection = Math.floor(Math.random() * Punchline.length);
4268 jokeGens +=1;
4269 sendChat("[Joke Generator #" + jokeGens + "] Why did the " + Animal[Aselection] + " cross the " + Location[Lselection] + "? " + Punchline[Pselection]);
4270
4271 } else if (cmd == cmdChar+"info") { //info command
4272 sendChat("Info: Type in (!help) to get my commands.(Version " + botVersion + ")");
4273
4274 } else if (cmd == cmdChar+"sleep") { //sleep command
4275 if (usersAsleep.indexOf(ids) == -1) {
4276 sendChat(name + ' is asleep (:3[▓▓▓]');
4277 usersAsleep.push(ids);
4278 } else {
4279 sendChat(name + ' is sound asleep (x3[▓▓▓] Zz...');
4280 }
4281
4282 } else if (cmd == cmdChar+"wake") { //wake command
4283 if (usersAsleep.indexOf(ids) != -1) {
4284 sendChat(name + " woke up (:o[▓▓▓]");
4285 while (usersAsleep.indexOf(ids) !== -1) {
4286 usersAsleep.splice(usersAsleep.indexOf(ids), 1);
4287 }
4288 } else {
4289 sendChat(name + ' is wide already wide awake :o');
4290 }
4291
4292 } else if (cmd == cmdChar+"motd") { //motd command
4293 sendChat(Lmotd);
4294
4295 } else if (cmd == cmdChar+"version") { //version command
4296 sendChat("Version " + botVersion + " ");
4297
4298 } else if (cmd == cmdChar+"time") {
4299 sendChat("The time for me is: " + new Date());
4300
4301 //by electrashave, fixed by Starseed Orion.
4302 } else if (cmd == cmdChar+"calc") {
4303 if (message.substring(5).trim() == "") {
4304 sendChat('Usage: '+cmdChar+'calc 2+4 (+ is addition, - is subtraction, / is division and * is multiplication).');
4305 return;
4306 }
4307
4308 var stuf = message.substring(6).trim();
4309 var mod = stuf.split('%').join('%');
4310 var pie = mod.split('pi').join(Math.PI);
4311 var pie = pie.replace(/[^0-9\*%\/\+\-()<>\.]/g, "");
4312
4313 try {
4314 if (eval(pie) == 420) {
4315 sendChat("Calculator: "+ eval(pie) + " Too high!");
4316 return;
4317 }
4318 sendChat("Calculator: "+ eval(pie));
4319
4320 } catch (e) {
4321 sendChat("Error: " + e);
4322
4323 }
4324
4325 // ♥ // !p made by Firebrick || optimized by B@K$ // ♥ //
4326 } else if (cmd == cmdChar+"p") {
4327 var m = message;
4328 if(m.substring(2).trim() == "") {
4329 sendChat("Usage: "+cmdChar+"p (text for this to play) | Add spaces for delay. ~ are double the delay of a space. ` is just under half the delay of ~. ; is a lot shorter. And | is the shortest at 50ms To make chords, cluster notes e.g. etu C triad. - Autoplayer by Firebrick");
4330 }
4331 m = m.slice(3);
4332
4333 var notes = {
4334 "z":"a1","a":"gs1","s":"as1","f":"cs2","g":"ds2","x":"b1","c":"c2","v":"d2","b":"e2","n":"f2","j":"fs2","k":"gs2","1":"gs2","l":"as2",
4335 "2":"as2","m":"g2",",":"a2",".":"b2","/":"c3","'":"cs3","q":"a2","w":"b2","e":"c3","4":"cs3","5":"ds3","7":"fs3","8":"gs3","9":"as3",
4336 "-":"cs4","=":"ds4","r":"d3","t":"e3","y":"f3","u":"g3","i":"a3","o":"b3","p":"c4","[":"d4","]":"e4","Z":"a2","A":"gs2","S":"as2",
4337 "F":"cs3","G":"ds3","X":"b2","C":"c3","V":"d3","B":"e3","N":"f3","J":"fs3","K":"gs3","!":"gs3","L":"as3","@":"as3","M":"g3","<":"a3",
4338 ">":"b3",'"':"cs4","?":"c4","Q":"a3","W":"b3","E":"c4","$":"cs4","%":"ds4","&":"fs4","*":"gs4","(":"as4","_":"cs5","+":"ds5","R":"d4",
4339 "T":"e4","Y":"f4","U":"g4","I":"a4","O":"b4","P":"c5","{":"d5","}":"e5"
4340 };
4341
4342 var i=h=0;
4343 var T=300;
4344
4345 while(i<m.length){
4346 setTimeout(function() { press(notes[m[h++]]) }, T);
4347 if(m[i] == "|"){T+=50;}
4348 else if(m[i] == ";"){T+=75;}
4349 else if(m[i] == "`"){T+=125;}
4350 else if(m[i] == " "){T+=200;}
4351 else if(m[i] == "~"){T+=300;}
4352 i++;
4353 }
4354
4355 // ♥ // !p made by Firebrick || optimized by B@K$ // ♥ //
4356
4357
4358 } else if (cmd == cmdChar+"ud") { //TEXTCONVERT COMMAND (Firebrick)//updated version
4359 if (message.length == cmd.length) {
4360 sendChat("Usage: "+cmdChar+"ud text here (converts to upsidedown text).");
4361 } else {
4362 var alpha1 = "zZyYxXwWvVuUtTsSrRqQpPoOnNmMlLkKjJiIhHgGfFeEdDcCbBaA?!.,0987654321 zZʎʎxXʍMʌΛn∩ʇ⊥sSɹᴚbὉdԀoOuNɯWl˥ʞʞɾſıIɥHƃƃɟℲǝƎpᗡɔϽqqɐ∀¿¡˙'068Ɫ9ㄣᔭƐᄅ⇂";
4363 var alpha2 = "zZʎʎxXʍMʌΛn∩ʇ⊥sSɹᴚbὉdԀoOuNɯWl˥ʞʞɾſıIɥHƃƃɟℲǝƎpᗡɔϽqqɐ∀¿¡˙'068Ɫ9ㄣᔭƐᄅ⇂ zZyYxXwWvVuUtTsSrRqQpPoOnNmMlLkKjJiIhHgGfFeEdDcCbBaA?!.,0987654321";
4364 var str = message.substring(cmd.length);
4365 var newstr = '';
4366 for (var i = 0; i < str.length; i++) {
4367 charPos = alpha1.indexOf(str.charAt(i));
4368 newstr += alpha2.charAt(charPos);
4369 }
4370 sendChat("Upside down: " + newstr.split("").reverse().join(""));
4371 }
4372
4373 } else if (cmd == cmdChar+"bubble") {
4374 if (message.length == cmd.length) {
4375 sendChat("Usage: "+cmdChar+"bubble text here.");
4376 } else {
4377 var alpha1 = "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz1234567890,. ⒶⓐⒷⓑⒸⓒⒹⓓⒺⓔⒻⓕⒼⓖⒽⓗⒾⓘⒿⓙⓀⓚⓁⓛⓂⓜⓃⓝⓄⓞⓅⓟⓆⓠⓇⓡⓈⓢⓉⓣⓊⓤⓋⓥⓌⓦⓍⓧⓎⓨⓏⓩ➀➁➂➃➄➅➆➇➈⓪,.";
4378 var alpha2 = "ⒶⓐⒷⓑⒸⓒⒹⓓⒺⓔⒻⓕⒼⓖⒽⓗⒾⓘⒿⓙⓀⓚⓁⓛⓂⓜⓃⓝⓄⓞⓅⓟⓆⓠⓇⓡⓈⓢⓉⓣⓊⓤⓋⓥⓌⓦⓍⓧⓎⓨⓏⓩ➀➁➂➃➄➅➆➇➈⓪,. AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz1234567890,.";
4379 var str = message.substring(cmd.length);
4380 var newstr = '';
4381 for (var i = 0; i < str.length; i++) {
4382 charPos = alpha1.indexOf(str.charAt(i));
4383 newstr += alpha2.charAt(charPos);
4384 }
4385 sendChat("Bubble: " + newstr);
4386 }
4387
4388 // backwards
4389 } else if (cmd == cmdChar+"bw") {
4390 if (message.length == cmd.length) { //add useage for below command
4391 sendChat("Usage: "+cmdChar+"bw text here (converts to backwards text).");
4392 } else {
4393 sendChat("Reverse: " + message.substring(cmd.length).split("").reverse().join(""));
4394 }
4395
4396 // wave
4397 } else if (cmd == cmdChar+"wave") {
4398 if (message.length == cmd.length) {
4399 sendChat("Usage: "+cmdChar+"wave text here.");
4400 } else {
4401 var alpha1 = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890?.,!@ ᗩᕊᑕᕍᙓℱᘐᖺᓰᒎḰᒪᗰﬡᗢᖰᕋᖇᔕ☂⋒ᐯᙡჯ૪ᔓᗩᙖᑕↁᕮℱᘐᕼᓮᒎḰᒪᗰᘉ〇ᖘႳᖇᔕ☂ᑌⅤᙡ᙭ϒᔓ";
4402 var alpha2 = "ᗩᕊᑕᕍᙓℱᘐᖺᓰᒎḰᒪᗰﬡᗢᖰᕋᖇᔕ☂⋒ᐯᙡჯ૪ᔓᗩᙖᑕↁᕮℱᘐᕼᓮᒎḰᒪᗰᘉ〇ᖘႳᖇᔕ☂ᑌⅤᙡ᙭ϒᔓ1234567890?.,!@ abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
4403 var str = message.substring(cmd.length);
4404 var newstr = '';
4405 for (var i = 0; i < str.length; i++) {
4406 charPos = alpha1.indexOf(str.charAt(i));
4407 newstr += alpha2.charAt(charPos);
4408 }
4409 sendChat("Wave: " + newstr);
4410 }
4411
4412
4413 // caps
4414 } else if (cmd == cmdChar+"caps") {
4415 if (message.length == cmd.length) {
4416 sendChat("Usage: "+cmdChar+"caps letters here.");
4417 } else {
4418 var alpha1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz?Æ.,!@:'[]/\|<>-=+* ᴀʙᴄᴅᴇғɢʜɪᴊᴋʟᴍɴᴏᴘǫʀsᴛᴜᴠᴡxʏᴢ";
4419 var alpha2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ᴀʙᴄᴅᴇғɢʜɪᴊᴋʟᴍɴᴏᴘǫʀsᴛᴜᴠᴡxʏᴢ?ᴁ.,!@:'[]/\|<>-=+* abcdefghijklmnopqrstuvwxyz";
4420 var str = message.substring(cmd.length);
4421 var newstr = '';
4422 for (var i = 0; i < str.length; i++) {
4423 charPos = alpha1.indexOf(str.charAt(i));
4424 newstr += alpha2.charAt(charPos);
4425 }
4426 sendChat("Caps: " + newstr);
4427 }
4428
4429 // big text
4430 } else if (cmd == cmdChar+"big") {
4431 if (message.length == cmd.length) {
4432 sendChat("Usage: "+cmdChar+"big letters here.");
4433 } else {
4434 var alpha1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz?-=[]\;'\",./_+{}|:<>!@#$%^&*() ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz";
4435 var alpha2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz?-=[]\;'\",./_+{}|:<>!@#$%^&*() ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz";
4436 var str = message.substring(cmd.length);
4437 var newstr = '';
4438 for (var i = 0; i < str.length; i++) {
4439 charPos = alpha1.indexOf(str.charAt(i));
4440 newstr += alpha2.charAt(charPos);
4441 }
4442 sendChat("Big: " + newstr.substr(1));
4443 }
4444
4445
4446 // bracket
4447 } else if (cmd == cmdChar+"bracket") {
4448 if (message.length == cmd.length) {
4449 sendChat("Usage: "+cmdChar+"bracket letters here.");
4450 } else {
4451 var alpha1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz?-=[]\;'\",./_+{}|:<>!@#$%^&*() ⒜⒝⒞⒟⒠⒡⒢⒣⒤⒥⒦⒧⒨⒩⒪⒫⒬⒭⒮⒯⒰⒱⒲⒳⒴⒵⑴⑵⑶⑷⑸⑹⑺⑻⑼0⒜⒝⒞⒟⒠⒡⒢⒣⒤⒥⒦⒧⒨⒩⒪⒫⒬⒭⒮⒯⒰⒱⒲⒳⒴⒵";
4452 var alpha2 = "⒜⒝⒞⒟⒠⒡⒢⒣⒤⒥⒦⒧⒨⒩⒪⒫⒬⒭⒮⒯⒰⒱⒲⒳⒴⒵⑴⑵⑶⑷⑸⑹⑺⑻⑼0⒜⒝⒞⒟⒠⒡⒢⒣⒤⒥⒦⒧⒨⒩⒪⒫⒬⒭⒮⒯⒰⒱⒲⒳⒴⒵?-=[]\;'\",./_+{}|:<>!@#$%^&*() ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz";
4453 var str = message.substring(cmd.length); //abcde
4454 var newstr = '';
4455 for (var i = 0; i < str.length; i++) {
4456 charPos = alpha1.indexOf(str.charAt(i));
4457 newstr += alpha2.charAt(charPos);
4458 }
4459 sendChat("Bracket: " + newstr);
4460 }
4461
4462 } else if (cmd == cmdChar+"tip" || cmd == cmdChar+"tips") { //tip command
4463 var tipCount = 14;
4464 var textArray = ['Tip (1/' + tipCount + '): You can toggle sustain by pressing BACKSPACE.', 'Tip (2/' + tipCount + '): You can shift octaves by holding either SHIFT, CTRL or CAPSLOCK. It’s best to use CAPSLOCK as this avoids hitting hotkeys such as CTRL+W', 'Tip (3/' + tipCount + '): You can click on your name to change it.', 'Tip (4/' + tipCount + '): If another player is annoying you, you can click their name and mute their notes and/or chat.', 'Tip (5/' + tipCount + '): QZ, WX, EC and RV ect.. are all octaves apart.', 'Tip (6/' + tipCount + '): The sound of your notes is relative to your mouse position. eg high = quite notes, low = loud notes. (unless you’re using a midi piano)', 'Tip (7/' + tipCount + '): If someone’s mouse is in the bottom left that means they haven’t moved their mouse since you’ve connected.', 'Tip (8/' + tipCount + '): Multiplayer Piano works best and lags least with Google chrome: https://www.google.com/intl/en/chrome/browser/', 'Tip (9/' + tipCount + '): If you’re on MIDI and it randomly stops working. Try going to the java control panel and removing the permission and adding it again. Alternatively, this sounds weird but sometimes the room name can effect the loading of the MIDI. Try and load it in the lobby.','Tip (10/' + tipCount + '): The colour of the room name in the bottom left will fade to a ligher shade if the owner has set it to "not visible".', 'Tip (11/' + tipCount + '): If you type #seeowncursor at the end of the URL and refresh you\'ll be able to see your own mouse. Though it won\'t follow your cursor unless you\'re using a script.', 'Tip (12/' + tipCount + '): If the colour of the room name is yellow this means it\'s a lobby. Lobbies don\'t have an owner like normal rooms they also have a low note quota.', 'Tip (13/' + tipCount + '): If you change your name while in two rooms your name will update, but your name-tag at the top will remain the same in the other room.', 'Tip (14/' + tipCount + '): If you add /spin to the end of your new room name the piano will spin!'];
4465 var randomNumber = Math.floor(Math.random() * textArray.length);
4466 sendChat(textArray[randomNumber]);
4467
4468 } else if (cmd == cmdChar+"grammar") { //grammar command
4469 var textArray = ['Gramar Nazi: "Alot" is not a word', 'Grammar Nazi: There: Noun; A place that is not here. // Their: Adjective; Something belongs to "them." // They’re: Contraction; They are.', 'Grammar Nazi: It’s: Contraction for it is. // Its: "It" possesses something.', 'Grammar Nazi: use the word "An" when the next word has a vowel sound. With a few exceptions like "utopia" which has a "Y" sound.', 'Grammar Nazi: Don’t add an apostrophe when the word is a plural!', 'Grammar Nazi: Let’s eat grandma. Let’s eat, grandma. Lesson learned: Don’t eat grandma and put a comma.', 'Grammar Nazi: “Attain” means “reach” and “obtain” means “get.” You attain a mountaintop, but obtain a rare baseball card.', 'Grammar Nazi: “As of yet” is a windy and pretentious substitute for plain old English “yet” or “as yet,” an unjustified extension of the pattern in sentences like “as of Friday the 27th of May.”', 'Grammar Nazi: The casual spellings “altho” and “tho” are not acceptable in formal or edited English. Stick with “although” and “though.”', 'Grammar Nazi: A “bazaar” is a market where miscellaneous goods are sold. “Bizarre,” in contrast, is an adjective meaning “strange,” “weird.”', 'Grammar Nazi: “Calvary,” always capitalized, is the hill on which Jesus was crucified. It means “hill of skulls.” Soldiers mounted on horseback are cavalry.', 'Grammar Nazi: In the US the barrier preventing a flood is called a “dike.” “Dyke” is a term for a type of lesbian, generally considered insulting but adopted as a label for themselves by some lesbians. Nom nom nom', 'Grammar Nazi: Although “dove” is a common form of the past tense of “dive,” a few authorities consider “dived” preferable in formal writing.', 'Grammar Nazi: An “epoch” is a long period of time, like the Pleistocene Epoch', 'Grammar Nazi: Pitfall, a hidden or unsuspected danger or difficulty.', 'Grammar Nazi: When you shift to a new topic or activity, you segue. Many people unfamiliar with the unusual Italian spelling of the word misspell it as “segway.” This error is being encouraged by the deliberately punning name used by the manufacturers of the Segway Human Transporter.', 'Grammar Nazi: Tiramisù is Italian for “pick me up,” and is the name of a popular modern Italian dessert, commonly misspelled as tirimisù, which gives it a slightly Japanese air. The Japanese love tiramisù, but although they sometimes make it with green tea rather than coffee this misspelling isn’t their fault.', 'Grammar Nazi: In formal fencing matches, when someone is hit by an opponent’s sword it is traditional for the person hit to cry out touché (French for “touched”) to acknowledge that fact. In other contexts, we may say touché when somebody scores a point against us in an argument, or otherwise skewers us verbally.', 'Grammar Nazi: “Xmas” is not originally an attempt to exclude Christ from Christmas, but uses an abbreviation of the Greek spelling of the word “Christ” with the “X” representing the Greek letter chi. However, so few people know this that it is probably better not to use this popular abbreviation in religious contexts. So quit your bitching!', 'Grammar Nazi: In some dialects it’s common to say “you’ve got a ways to go before you’ve saved enough to buy a Miata,” but in standard English it’s “a way to go.”', 'Grammar Nazi: Than is a comparision. Then is time based.', 'Grammar Nazi: If you’re dying you need help. If you’re dyeing clothes you might get dirty.', 'Grammar Nazi: '];
4470 var randomNumber = Math.floor(Math.random() * textArray.length);
4471 sendChat(textArray[randomNumber]);
4472
4473 } else if (cmd == cmdChar+"grammer" || cmd == cmdChar+"gramer" || cmd == cmdChar+"gramar") { //grammer command for fun
4474 var textArray = ['Close, but no cigar!', 'Nice going...', 'You moronic fool!', 'Even slurpy squid can spell grammar!', 'Grammar* You imbecile!', 'You sir, are not educated!', 'Did you wake up on the wrong side of the barn?', 'Are you daft?', 'I\'ll slap your mother!'];
4475 var randomNumber = Math.floor(Math.random() * textArray.length);
4476 sendChat(textArray[randomNumber]);
4477
4478 } else if (cmd == cmdChar+"joke") { //joke command
4479 var textArray = ['You can tune a piano but you can’t tuna fish.',
4480 'What sounds does a Bee make? A B#!', 'What do you get when you drop a piano on an army base? A flat major.',
4481 'A note left form a pianist for his wife: “Gone Chopin, (have Liszt), Bach in a Minuet.”',
4482 'What did the pianist say to a tightrope walker? You better C sharp or you’ll B flat.',
4483 'What do you call a fish musician? A piano tuna.',
4484 'Why was the pianist arrested? Because he got into treble.',
4485 'What’s the difference between a piano and an onion? No one cries when you chop up a piano.',
4486 'Did you hear about the circus fire? It was in tents! (Intense)', 'Two guys walk into a bar... the 3rd guy ducked.',
4487 'A blonde gets her haircut while wearing a pair of headphones. The hairdresser asks her to take them off, but she protests that she’ll die without them. The hairdresser sighs, and starts cutting the hair around the headphones. Soon, the blonde falls asleep, and the hairdresser removes the headphones. A few minutes later, the blonde collapses, dead on the floor. Alarmed, the hairdresser puts the headphones to his ear and hears, "Breathe in. Breathe out."',
4488 'Yo Mama’s so fat, it takes 2 trains and a bus to get to her good side.',
4489 'What do you get when you drop a piano down a mine shaft? A flat minor.',
4490 'What do you call a grizzly bear with no teeth? A gummy bear.',
4491 'it’s funny how after an argument is over you start to think about more clever shit you could have said.',
4492 'Wifi went down for five minutes, so I had to talk to my family. They seem like nice people.',
4493 'There are plenty of fish in the sea... too bad I suck at fishing.',
4494 'My friend thinks he is smart. He told me an onion is the only food that makes you cry, so I threw a coconut at his head.',
4495 'How much is this torture device, sir? That\'s a wedding ring...',
4496 'What did the drummer get on his I.Q. Test? Saliva.',
4497 'How does a bass player change a light bulb? He doesn’t. The pianist does it with his left hand.',
4498 'What do you call a beautiful woman on a trombonist’s arm? A tattoo.',
4499 'What is the dynamic range of a bass trombone? On or off.',
4500 'Why did the chicken cross the road? To get away from the bassoon recital.',
4501 'What’s the difference between a bass trombone and a chainsaw? It’s easier to improvise on a chainsaw.',
4502 'Why are a pianist’s fingers like lightning? Because they rarely strike the same place twice.',
4503 'What is Harry Potter’s favourite mint? Dementoes.',
4504 'Give a man a fire and he is warm for a day. Set a man on fire and he is warm for the rest of his life* Quote by Terry Pratchett, Famous author',
4505 'What do you call a Jewish pokémon trainer? Ash.',
4506 'What if a girls tonsils were ticklish and when she was giving you head she laughed non stop?',
4507 'I used to be a banker but I lost interest.',
4508 'I’m glad I know sign language, it’s pretty handy.',
4509 'I couldn’t quite remember how to throw a boomerang, but eventually it came back to me.',
4510 'I don’t trust these stairs because they’re always up to something.',
4511 'Why was the painter killed? He dyed in a car accident.',
4512 '[Patient] Doctor, doctor! People keep Ignoring me! [Doctor] Next patient, please.',
4513 'Why did the sperm cross the road? I accidently put on the wrong sock.',
4514 'I\'m guaranteed to shag the missus up the arse tonight. She\'s dyslexic and thinks it\'s Vaseline Day.',
4515 'You can\'t spell "therapist" without "rapist".',
4516 'If you ever visit the amazon rain forest don\'t forget to cut down shit tons of trees. New studies show that trees block sunlight from animals']; //’ (apostrophe) //Thanks to various people giving me some awesome jokes on MPP!
4517 var randomNumber = Math.floor(Math.random() * textArray.length);
4518 sendChat(textArray[randomNumber]);
4519
4520
4521 //Music theory by Logan
4522 //It's not very optimised and takes up way too much space. I'm not sure how to make it more compact.
4523 //chords
4524 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"music theory" || cmd == cmdChar+"mt") { //music theory command
4525 sendChat("Music Theory Index: "+cmdChar+"chords (list of chords), "+cmdChar+"scales (list of scales C-G), "+cmdChar+"scales2 (list of scales Ab-X), "+cmdChar+"glossary (music terminology) [Unfinished!!]");
4526
4527 } else if (cmd == cmdChar+"chords") { //Chords
4528 sendChat("Chords Index: "+cmdChar+"cmajor, "+cmdChar+"cminor, "+cmdChar+"cmaj7, "+cmdChar+"cmin7, "+cmdChar+"cminmaj, "+cmdChar+"cdom7, "+cmdChar+"cdom7sus4, "+cmdChar+"cdim, "+cmdChar+"cdim7, "+cmdChar+"chalfdim, "+cmdChar+"caug, "+cmdChar+"caug7, "+cmdChar+"caugmaj7, "+cmdChar+"csus2, "+cmdChar+"csus4 [Unfinished!!]");
4529
4530 } else if (cmd == cmdChar+"cmajor") { //C major
4531 sendChat("A major triad is a chord having a root, a major third, and a perfect fifth.");
4532 sendChat("C major triad PC notes - etu");
4533 {setTimeout(function() { press("c2"); press("e2"); press("g2") }, 0);}
4534 {setTimeout(function() { press("c2"); press("e2"); press("g2") }, 3000);}
4535 {setTimeout(function() { press("c2")}, 5000);}
4536 {setTimeout(function() { press("e2")}, 6000);}
4537 {setTimeout(function() { press("g2")}, 7000);}
4538
4539
4540 } else if (cmd == cmdChar+"cdom7") { //C Dominant seventh
4541 sendChat("A dominant seventh chord is a chord composed of a root, major third, perfect fifth, and minor seventh. It can be also viewed as a major triad with an additional minor seventh.");
4542 sendChat("C7 PC notes - etu9");
4543 {setTimeout(function() { press("c2"); press("e2"); press("g2"); press("as2") }, 0);}
4544 {setTimeout(function() { press("c2"); press("e2"); press("g2"); press("as2") }, 3000);}
4545 {setTimeout(function() { press("c2")}, 5000);}
4546 {setTimeout(function() { press("e2")}, 6000);}
4547 {setTimeout(function() { press("g2")}, 7000);}
4548 {setTimeout(function() { press("as2")}, 8000);}
4549
4550 } else if (cmd == cmdChar+"cdom7sus4") { //C Dominant seventh suspended 4th
4551 sendChat("A dominant seventh suspended 4th chord is a chord composed of a root, perfect fourth, perfect fifth, and minor seventh.");
4552 sendChat("C7(sus) PC notes - eyu9");
4553 {setTimeout(function() { press("c2"); press("f2"); press("g2"); press("as2") }, 0);}
4554 {setTimeout(function() { press("c2"); press("f2"); press("g2"); press("as2") }, 3000);}
4555 {setTimeout(function() { press("c2")}, 5000);}
4556 {setTimeout(function() { press("f2")}, 6000);}
4557 {setTimeout(function() { press("g2")}, 7000);}
4558 {setTimeout(function() { press("as2")}, 8000);}
4559
4560 } else if (cmd == cmdChar+"cmaj7") { //C major seventh
4561 sendChat("A major seventh chord is a seventh chord where the \"third\" note is a major third above the root, and the \"seventh\" note is a major seventh above the root (a fifth above the third note).");
4562 sendChat("Cmaj7 PC notes - etuo");
4563 {setTimeout(function() { press("c2"); press("e2"); press("g2"); press("b2") }, 0);}
4564 {setTimeout(function() { press("c2"); press("e2"); press("g2"); press("b2") }, 3000);}
4565 {setTimeout(function() { press("c2")}, 5000);}
4566 {setTimeout(function() { press("e2")}, 6000);}
4567 {setTimeout(function() { press("g2")}, 7000);}
4568 {setTimeout(function() { press("b2")}, 8000);}
4569
4570 } else if (cmd == cmdChar+"cminor") { //C minor
4571 sendChat("A minor triad is a chord having a root, a minor third, and a perfect fifth.");
4572 sendChat("C minor triad PC notes - e5u");
4573 {setTimeout(function() { press("c2"); press("ds2"); press("g2") }, 0);}
4574 {setTimeout(function() { press("c2"); press("ds2"); press("g2") }, 3000);}
4575 {setTimeout(function() { press("c2")}, 5000);}
4576 {setTimeout(function() { press("ds2")}, 6000);}
4577 {setTimeout(function() { press("g2")}, 7000);}
4578
4579 } else if (cmd == cmdChar+"cmin7") { //C minor seventh
4580 sendChat("A minor seventh chord is any non-dominant seventh chord where the \"third\" note is a minor third above the root.");
4581 sendChat("Cmin7 PC notes - e5u9");
4582 {setTimeout(function() { press("c2"); press("ds2"); press("g2"); press("as2") }, 0);}
4583 {setTimeout(function() { press("c2"); press("ds2"); press("g2"); press("as2") }, 3000);}
4584 {setTimeout(function() { press("c2")}, 5000);}
4585 {setTimeout(function() { press("ds2")}, 6000);}
4586 {setTimeout(function() { press("g2")}, 7000);}
4587 {setTimeout(function() { press("as2")}, 8000);}
4588
4589 } else if (cmd == cmdChar+"cminmaj") { //C minor major seventh
4590 sendChat("The minor major seventh chord is a diatonic non-dominant seventh chord in the harmonic minor scale. The chord is built on a root, with the intervals of a minor third, a major third above that note and above that a major third");
4591 sendChat("Cminmaj PC notes - e5uo");
4592 {setTimeout(function() { press("c2"); press("ds2"); press("g2"); press("b2") }, 0);}
4593 {setTimeout(function() { press("c2"); press("ds2"); press("g2"); press("b2") }, 3000);}
4594 {setTimeout(function() { press("c2")}, 5000);}
4595 {setTimeout(function() { press("ds2")}, 6000);}
4596 {setTimeout(function() { press("g2")}, 7000);}
4597 {setTimeout(function() { press("b2")}, 8000);}
4598
4599 } else if (cmd == cmdChar+"cdim") { //C diminished
4600 sendChat("A diminished triad is a triad consisting of two minor thirds above the root.");
4601 sendChat("C diminished triad PC notes - e57");
4602 {setTimeout(function() { press("c2"); press("ds2"); press("fs2") }, 0);}
4603 {setTimeout(function() { press("c2"); press("ds2"); press("fs2") }, 3000);}
4604 {setTimeout(function() { press("c2")}, 5000);}
4605 {setTimeout(function() { press("ds2")}, 6000);}
4606 {setTimeout(function() { press("fs2")}, 7000);}
4607
4608 } else if (cmd == cmdChar+"cdim7") { //C diminished seventh
4609 sendChat("A diminished seventh is an interval produced by narrowing a minor seventh by a chromatic semitone.");
4610 sendChat("Cdim7 PC notes - e57i (this is my favourite chord)");
4611 {setTimeout(function() { press("c2"); press("ds2"); press("fs2"); press("a2") }, 0);}
4612 {setTimeout(function() { press("c2"); press("ds2"); press("fs2"); press("a2") }, 3000);}
4613 {setTimeout(function() { press("c2")}, 5000);}
4614 {setTimeout(function() { press("ds2")}, 6000);}
4615 {setTimeout(function() { press("fs2")}, 7000);}
4616 {setTimeout(function() { press("a2")}, 8000);}
4617
4618 } else if (cmd == cmdChar+"chalfdim") { //C half diminished
4619 sendChat("A half diminished chord is composed by a root note, together with a minor third, a diminished fifth and a minor seventh from root.");
4620 sendChat("Chalfdim PC notes - e579");
4621 {setTimeout(function() { press("c2"); press("ds2"); press("fs2"); press("as2") }, 0);}
4622 {setTimeout(function() { press("c2"); press("ds2"); press("fs2"); press("as2") }, 3000);}
4623 {setTimeout(function() { press("c2")}, 5000);}
4624 {setTimeout(function() { press("ds2")}, 6000);}
4625 {setTimeout(function() { press("fs2")}, 7000);}
4626 {setTimeout(function() { press("as2")}, 8000);}
4627
4628
4629 } else if (cmd == cmdChar+"caug") { //C Augmented
4630 sendChat("An augmented triad is a triad, or chord, consisting of two major thirds (an augmented fifth).");
4631 sendChat("C augmented triad PC notes - et8 (second favourite chord)");
4632 {setTimeout(function() { press("c2"); press("e2"); press("gs2") }, 0);}
4633 {setTimeout(function() { press("c2"); press("e2"); press("gs2") }, 3000);}
4634 {setTimeout(function() { press("c2")}, 5000);}
4635 {setTimeout(function() { press("e2")}, 6000);}
4636 {setTimeout(function() { press("gs2")}, 7000);}
4637
4638 } else if (cmd == cmdChar+"caug7") { //C Augmented seventh
4639 sendChat("An augmented seventh chord is a dominant seventh chord consisting of an augmented triad with a minor seventh.");
4640 sendChat("Caug7 PC notes - et89");
4641 {setTimeout(function() { press("c2"); press("e2"); press("gs2"); press("as2") }, 0);}
4642 {setTimeout(function() { press("c2"); press("e2"); press("gs2"); press("as2") }, 3000);}
4643 {setTimeout(function() { press("c2")}, 5000);}
4644 {setTimeout(function() { press("e2")}, 6000);}
4645 {setTimeout(function() { press("gs2")}, 7000);}
4646 {setTimeout(function() { press("as2")}, 8000);}
4647
4648 } else if (cmd == cmdChar+"caugmaj7") { //C Augmented major seventh
4649 sendChat("An augmented major seventh chord is a nondominant seventh chord and is associated with the augmented scale.");
4650 sendChat("Caugmaj7 PC notes - et8o");
4651 {setTimeout(function() { press("c2"); press("e2"); press("gs2"); press("b2") }, 0);}
4652 {setTimeout(function() { press("c2"); press("e2"); press("gs2"); press("b2") }, 3000);}
4653 {setTimeout(function() { press("c2")}, 5000);}
4654 {setTimeout(function() { press("e2")}, 6000);}
4655 {setTimeout(function() { press("gs2")}, 7000);}
4656 {setTimeout(function() { press("b2")}, 8000);}
4657
4658 } else if (cmd == cmdChar+"csus2") { //C suspended second
4659 sendChat("A suspended second chord (sus2 chord) is a musical chord in which the (major or minor) third is omitted and replaced with a major second.");
4660 sendChat("Csus2 PC notes - eru");
4661 {setTimeout(function() { press("c2"); press("d2"); press("g2") }, 0);}
4662 {setTimeout(function() { press("c2"); press("d2"); press("g2") }, 3000);}
4663 {setTimeout(function() { press("c2")}, 5000);}
4664 {setTimeout(function() { press("d2")}, 6000);}
4665 {setTimeout(function() { press("g2")}, 7000);}
4666
4667 } else if (cmd == cmdChar+"csus4") { //C suspended fourth
4668 sendChat("A suspended fourth chord (sus4 chord or usually referred to as just sus) is a musical chord in which the (major or minor) third is omitted and replaced with a perfect fourth.");
4669 sendChat("Csus PC notes - eyu");
4670 {setTimeout(function() { press("c2"); press("f2"); press("g2") }, 0);}
4671 {setTimeout(function() { press("c2"); press("f2"); press("g2") }, 3000);}
4672 {setTimeout(function() { press("c2")}, 5000);}
4673 {setTimeout(function() { press("f2")}, 6000);}
4674 {setTimeout(function() { press("g2")}, 7000);}
4675 //chords
4676
4677 //scales
4678 } else if (cmd == cmdChar+"scales") { //Scales
4679 sendChat("Scales Index C-F#: "+cmdChar+"scale cmajor, "+cmdChar+"scale cminor, "+cmdChar+"scale charminor, "+cmdChar+"scale cmelminor, "+cmdChar+"scale csmajor, "+cmdChar+"scale csminor, "+cmdChar+"scale csharminor, "+cmdChar+"scale csmelminor, "+cmdChar+"scale dmajor, "+cmdChar+"scale dminor, "+cmdChar+"scale dharminor, "+cmdChar+"scale dmelminor, "+cmdChar+"scale ebmajor, "+cmdChar+"scale ebminor, "+cmdChar+"scale ebharminor, "+cmdChar+"scale ebmelminor, "+cmdChar+"scale emajor, "+cmdChar+"scale eminor, "+cmdChar+"scale eharminor, "+cmdChar+"scale emelminor, "+cmdChar+"scale fmajor, "+cmdChar+"scale fminor, "+cmdChar+"scale fharminor, "+cmdChar+"scale fmelminor, "+cmdChar+"scale fsmajor, "+cmdChar+"scale fsminor, "+cmdChar+"scale fsharminor, "+cmdChar+"scale fsmelminor");
4680
4681 } else if (cmd == cmdChar+"scales2") { //Scales 2
4682 sendChat("Scales Index 2 G-B: "+cmdChar+"scale gmajor, "+cmdChar+"scale gminor, "+cmdChar+"scale gharminor, "+cmdChar+"scale gmelminor "+cmdChar+"scale abmajor, "+cmdChar+"scale abminor, "+cmdChar+"scale abharminor, "+cmdChar+"scale abmelminor, "+cmdChar+"scale amajor, "+cmdChar+"scale aminor, "+cmdChar+"scale aharminor, "+cmdChar+"scale amelminor, "+cmdChar+"scale bbmajor, "+cmdChar+"scale bbminor, "+cmdChar+"scale bbharminor, "+cmdChar+"scale bbmelminor, "+cmdChar+"scale bmajor, "+cmdChar+"scale bminor, "+cmdChar+"scale bharminor, "+cmdChar+"scale bmelminor");
4683
4684 //C scales
4685 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"scale cmajor") { //C major scale
4686 sendChat("The C major scale - it has no flats or sharps - its relative minor is A");
4687 sendChat("The C major PC notes - e r t y u i o p");
4688 {setTimeout(function() { press("c2")}, 0);}
4689 {setTimeout(function() { press("d2")}, 250);}
4690 {setTimeout(function() { press("e2")}, 500);}
4691 {setTimeout(function() { press("f2")}, 750);}
4692 {setTimeout(function() { press("g2")}, 1000);}
4693 {setTimeout(function() { press("a2")}, 1250);}
4694 {setTimeout(function() { press("b2")}, 1500);}
4695 {setTimeout(function() { press("c3")}, 1750);}
4696 {setTimeout(function() { press("b2")}, 2000);}
4697 {setTimeout(function() { press("a2")}, 2250);}
4698 {setTimeout(function() { press("g2")}, 2500);}
4699 {setTimeout(function() { press("f2")}, 2750);}
4700 {setTimeout(function() { press("e2")}, 3000);}
4701 {setTimeout(function() { press("d2")}, 3250);}
4702 {setTimeout(function() { press("c2")}, 3500);}
4703 {setTimeout(function() { press("c2"); press("e2"); press("g2"); press("c3")}, 4000);}
4704
4705 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"scale cminor") { //C minor scale
4706 sendChat("The C minor scale - it has 3 flats - its relative major is Eb");
4707 sendChat("The C minor PC notes - e r 5 y u 8 9 p");
4708 var scale_cminor = [[0,"c2"],[250,"d2"],[250,"ds2"],[250,"f2"],[250,"g2"],[250,"gs2"],[250,"as2"],[250,"c3"],[250,"as2"],[250,"gs2"],[250,"g2"],[250,"f2"],[250,"ds2"],[250,"d2"],[250,"c2"]];
4709 var playID = 0;
4710
4711 function playMisc(arr){
4712 //if(playID != 0){clearInterval(playID);}
4713 if(playID != 0) {clearTimeout(playID);playID=0}
4714 var pNum = 0;
4715 var f = function () {
4716 for(var p=1; p<arr[pNum].length; p++){
4717 MPP.press(arr[pNum][p]);
4718 }
4719 if(++pNum >= arr.length) {clearTimeout(playID);playID=0;return;}
4720 setTimeout(f,arr[pNum][0]);
4721 }
4722 setTimeout(f,arr[pNum][0]);
4723 }
4724
4725 //test Play
4726 playMisc(scale_cminor);
4727
4728 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale charminor") { //C harmonic minor scale
4729 sendChat("The C harmonic minor scale - it has 2 flats - it has a major 7th (B)");
4730 sendChat("The C harmonic minor PC notes - e r 5 y u 8 o p");
4731 {setTimeout(function() { press("c2")}, 0);}
4732 {setTimeout(function() { press("d2")}, 250);}
4733 {setTimeout(function() { press("ds2")}, 500);}
4734 {setTimeout(function() { press("f2")}, 750);}
4735 {setTimeout(function() { press("g2")}, 1000);}
4736 {setTimeout(function() { press("gs2")}, 1250);}
4737 {setTimeout(function() { press("b2")}, 1500);}
4738 {setTimeout(function() { press("c3")}, 1750);}
4739 {setTimeout(function() { press("b2")}, 2000);}
4740 {setTimeout(function() { press("gs2")}, 2250);}
4741 {setTimeout(function() { press("g2")}, 2500);}
4742 {setTimeout(function() { press("f2")}, 2750);}
4743 {setTimeout(function() { press("ds2")}, 3000);}
4744 {setTimeout(function() { press("d2")}, 3250);}
4745 {setTimeout(function() { press("c2")}, 3500);}
4746 {setTimeout(function() { press("c2"); press("ds2"); press("g2"); press("c3")}, 4000);}
4747
4748 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale cmelminor") { //C melodic minor scale
4749 sendChat("The C melodic minor scale - it has 1 flat ascending and 3 flats descending - it has two patterns ascending and descending.");
4750 sendChat("The C melodic minor PC notes - e r 5 y u i o p 9 8 u y 5 r e");
4751 {setTimeout(function() { press("c2")}, 0);}
4752 {setTimeout(function() { press("d2")}, 250);}
4753 {setTimeout(function() { press("ds2")}, 500);}
4754 {setTimeout(function() { press("f2")}, 750);}
4755 {setTimeout(function() { press("g2")}, 1000);}
4756 {setTimeout(function() { press("a2")}, 1250);}
4757 {setTimeout(function() { press("b2")}, 1500);}
4758 {setTimeout(function() { press("c3")}, 1750);}
4759 {setTimeout(function() { press("as2")}, 2000);}
4760 {setTimeout(function() { press("gs2")}, 2250);}
4761 {setTimeout(function() { press("g2")}, 2500);}
4762 {setTimeout(function() { press("f2")}, 2750);}
4763 {setTimeout(function() { press("ds2")}, 3000);}
4764 {setTimeout(function() { press("d2")}, 3250);}
4765 {setTimeout(function() { press("c2")}, 3500);}
4766 {setTimeout(function() { press("c2"); press("ds2"); press("g2"); press("c3")}, 4000);}
4767 //C scales
4768
4769 //C# scales
4770 } else if (message.substring(0, 14).toLowerCase() == cmdChar+"scale csmajor") { //C# major scale
4771 sendChat("The C# (sharp) major scale - it has 7 sharps - its relative minor is A#");
4772 sendChat("The C# (sharp) major PC notes - 4 5 y 7 8 9 p -");
4773 {setTimeout(function() { press("cs2")}, 0);}
4774 {setTimeout(function() { press("ds2")}, 250);}
4775 {setTimeout(function() { press("f2")}, 500);}
4776 {setTimeout(function() { press("fs2")}, 750);}
4777 {setTimeout(function() { press("gs2")}, 1000);}
4778 {setTimeout(function() { press("as2")}, 1250);}
4779 {setTimeout(function() { press("c3")}, 1500);}
4780 {setTimeout(function() { press("cs3")}, 1750);}
4781 {setTimeout(function() { press("c3")}, 2000);}
4782 {setTimeout(function() { press("as2")}, 2250);}
4783 {setTimeout(function() { press("gs2")}, 2500);}
4784 {setTimeout(function() { press("fs2")}, 2750);}
4785 {setTimeout(function() { press("f2")}, 3000);}
4786 {setTimeout(function() { press("ds2")}, 3250);}
4787 {setTimeout(function() { press("cs2")}, 3500);}
4788 {setTimeout(function() { press("cs2"); press("f2"); press("gs2"); press("cs3")}, 4000);}
4789
4790 } else if (message.substring(0, 14).toLowerCase() == cmdChar+"scale csminor") { //C# minor scale
4791 sendChat("The C# (sharp) minor scale - it has 4 sharps - its relative major is E");
4792 sendChat("The C# (sharp) major PC notes - f g b j k q . 4");
4793 {setTimeout(function() { press("cs2")}, 0);}
4794 {setTimeout(function() { press("ds2")}, 250);}
4795 {setTimeout(function() { press("e2")}, 500);}
4796 {setTimeout(function() { press("fs2")}, 750);}
4797 {setTimeout(function() { press("gs2")}, 1000);}
4798 {setTimeout(function() { press("a2")}, 1250);}
4799 {setTimeout(function() { press("b2")}, 1500);}
4800 {setTimeout(function() { press("cs3")}, 1750);}
4801 {setTimeout(function() { press("b2")}, 2000);}
4802 {setTimeout(function() { press("a2")}, 2250);}
4803 {setTimeout(function() { press("gs2")}, 2500);}
4804 {setTimeout(function() { press("fs2")}, 2750);}
4805 {setTimeout(function() { press("e2")}, 3000);}
4806 {setTimeout(function() { press("ds2")}, 3250);}
4807 {setTimeout(function() { press("cs2")}, 3500);}
4808 {setTimeout(function() { press("cs2"); press("e2"); press("gs2"); press("cs3")}, 4000);}
4809
4810 } else if (message.substring(0, 17).toLowerCase() == cmdChar+"scale csharminor") { //C# harmonic minor scale
4811 sendChat("The C# (sharp) harmonic minor scale - it has 2 flats - it has a major 7th (C)");
4812 sendChat("The C# (sharp) harmonic minor PC notes - 4 5 t 7 8 i p -");
4813 {setTimeout(function() { press("cs2")}, 0);}
4814 {setTimeout(function() { press("ds2")}, 250);}
4815 {setTimeout(function() { press("e2")}, 500);}
4816 {setTimeout(function() { press("fs2")}, 750);}
4817 {setTimeout(function() { press("gs2")}, 1000);}
4818 {setTimeout(function() { press("a2")}, 1250);}
4819 {setTimeout(function() { press("c3")}, 1500);}
4820 {setTimeout(function() { press("cs3")}, 1750);}
4821 {setTimeout(function() { press("c3")}, 2000);}
4822 {setTimeout(function() { press("a2")}, 2250);}
4823 {setTimeout(function() { press("gs2")}, 2500);}
4824 {setTimeout(function() { press("fs2")}, 2750);}
4825 {setTimeout(function() { press("e2")}, 3000);}
4826 {setTimeout(function() { press("ds2")}, 3250);}
4827 {setTimeout(function() { press("cs2")}, 3500);}
4828 {setTimeout(function() { press("cs2"); press("e2"); press("gs2"); press("cs3")}, 4000);}
4829
4830 } else if (message.substring(0, 17).toLowerCase() == cmdChar+"scale csmelminor") { //C# melodic minor scale
4831 sendChat("The C# (sharp) melodic minor scale - it has 7 sharps ascending and 5 sharps descending - it has two patterns ascending and descending.");
4832 sendChat("The C# (sharp) melodic minor PC notes - 4 5 t 7 8 9 p - o i 8 7 t 5 4");
4833 {setTimeout(function() { press("cs2")}, 0);}
4834 {setTimeout(function() { press("ds2")}, 250);}
4835 {setTimeout(function() { press("e2")}, 500);}
4836 {setTimeout(function() { press("fs2")}, 750);}
4837 {setTimeout(function() { press("gs2")}, 1000);}
4838 {setTimeout(function() { press("as2")}, 1250);}
4839 {setTimeout(function() { press("c3")}, 1500);}
4840 {setTimeout(function() { press("cs3")}, 1750);}
4841 {setTimeout(function() { press("b2")}, 2000);}
4842 {setTimeout(function() { press("a2")}, 2250);}
4843 {setTimeout(function() { press("gs2")}, 2500);}
4844 {setTimeout(function() { press("fs2")}, 2750);}
4845 {setTimeout(function() { press("e2")}, 3000);}
4846 {setTimeout(function() { press("ds2")}, 3250);}
4847 {setTimeout(function() { press("cs2")}, 3500);}
4848 {setTimeout(function() { press("cs2"); press("e2"); press("gs2"); press("cs3")}, 4000);}
4849 //C# scales
4850
4851 //D scales
4852 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"scale dmajor") { //D major scale
4853 sendChat("The D major scale - it has 2 sharps - its relative minor is B");
4854 sendChat("The D major scale PC notes - r t 7 u i o - [");
4855 {setTimeout(function() { press("d2")}, 0);}
4856 {setTimeout(function() { press("e2")}, 250);}
4857 {setTimeout(function() { press("fs2")}, 500);}
4858 {setTimeout(function() { press("g2")}, 750);}
4859 {setTimeout(function() { press("a2")}, 1000);}
4860 {setTimeout(function() { press("b2")}, 1250);}
4861 {setTimeout(function() { press("cs3")}, 1500);}
4862 {setTimeout(function() { press("d3")}, 1750);}
4863 {setTimeout(function() { press("cs3")}, 2000);}
4864 {setTimeout(function() { press("b2")}, 2250);}
4865 {setTimeout(function() { press("a2")}, 2500);}
4866 {setTimeout(function() { press("g2")}, 2750);}
4867 {setTimeout(function() { press("fs2")}, 3000);}
4868 {setTimeout(function() { press("e2")}, 3250);}
4869 {setTimeout(function() { press("d2")}, 3500);}
4870 {setTimeout(function() { press("d2"); press("fs2"); press("a2"); press("d3")}, 4000);}
4871
4872 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"scale dminor") { //D minor scale
4873 sendChat("The D minor scale - it has 2 sharps - its relative major is F");
4874 sendChat("The D minor scale PC notes - r t 7 u i o - [");
4875 {setTimeout(function() { press("d2")}, 0);}
4876 {setTimeout(function() { press("e2")}, 250);}
4877 {setTimeout(function() { press("f2")}, 500);}
4878 {setTimeout(function() { press("g2")}, 750);}
4879 {setTimeout(function() { press("a2")}, 1000);}
4880 {setTimeout(function() { press("as2")}, 1250);}
4881 {setTimeout(function() { press("c3")}, 1500);}
4882 {setTimeout(function() { press("d3")}, 1750);}
4883 {setTimeout(function() { press("c3")}, 2000);}
4884 {setTimeout(function() { press("as2")}, 2250);}
4885 {setTimeout(function() { press("a2")}, 2500);}
4886 {setTimeout(function() { press("g2")}, 2750);}
4887 {setTimeout(function() { press("f2")}, 3000);}
4888 {setTimeout(function() { press("e2")}, 3250);}
4889 {setTimeout(function() { press("d2")}, 3500);}
4890 {setTimeout(function() { press("d2"); press("f2"); press("a2"); press("d3")}, 4000);}
4891
4892 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale dharminor") { //D harmonic minor scale
4893 sendChat("The D harmonic minor scale - it has 2 sharps - it has a major 7th (C#)");
4894 {setTimeout(function() { press("d2")}, 0);}
4895 {setTimeout(function() { press("e2")}, 250);}
4896 {setTimeout(function() { press("f2")}, 500);}
4897 {setTimeout(function() { press("g2")}, 750);}
4898 {setTimeout(function() { press("a2")}, 1000);}
4899 {setTimeout(function() { press("as2")}, 1250);}
4900 {setTimeout(function() { press("cs3")}, 1500);}
4901 {setTimeout(function() { press("d3")}, 1750);}
4902 {setTimeout(function() { press("cs3")}, 2000);}
4903 {setTimeout(function() { press("as2")}, 2250);}
4904 {setTimeout(function() { press("a2")}, 2500);}
4905 {setTimeout(function() { press("g2")}, 2750);}
4906 {setTimeout(function() { press("f2")}, 3000);}
4907 {setTimeout(function() { press("e2")}, 3250);}
4908 {setTimeout(function() { press("d2")}, 3500);}
4909 {setTimeout(function() { press("d2"); press("f2"); press("a2"); press("d3")}, 4000);}
4910
4911 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale dmelminor") { //D melodic minor scale
4912 sendChat("The D melodic minor scale - it has 1 flat ascending and 3 flats descending - it has two patterns ascending and descending.");
4913 {setTimeout(function() { press("d2")}, 0);}
4914 {setTimeout(function() { press("e2")}, 250);}
4915 {setTimeout(function() { press("f2")}, 500);}
4916 {setTimeout(function() { press("g2")}, 750);}
4917 {setTimeout(function() { press("a2")}, 1000);}
4918 {setTimeout(function() { press("b2")}, 1250);}
4919 {setTimeout(function() { press("cs3")}, 1500);}
4920 {setTimeout(function() { press("d3")}, 1750);}
4921 {setTimeout(function() { press("c3")}, 2000);}
4922 {setTimeout(function() { press("as2")}, 2250);}
4923 {setTimeout(function() { press("a2")}, 2500);}
4924 {setTimeout(function() { press("g2")}, 2750);}
4925 {setTimeout(function() { press("f2")}, 3000);}
4926 {setTimeout(function() { press("e2")}, 3250);}
4927 {setTimeout(function() { press("d2")}, 3500);}
4928 {setTimeout(function() { press("d2"); press("f2"); press("a2"); press("d3")}, 4000);}
4929 //D scales
4930
4931 //Eb scales
4932 } else if (message.substring(0, 14).toLowerCase() == cmdChar+"scale ebmajor") { //Eb major scale
4933 sendChat("The Eb (flat) major scale - it has 3 flats - its relative minor is C");
4934 {setTimeout(function() { press("ds2")}, 0);}
4935 {setTimeout(function() { press("f2")}, 250);}
4936 {setTimeout(function() { press("g2")}, 500);}
4937 {setTimeout(function() { press("gs2")}, 750);}
4938 {setTimeout(function() { press("as2")}, 1000);}
4939 {setTimeout(function() { press("c3")}, 1250);}
4940 {setTimeout(function() { press("d3")}, 1500);}
4941 {setTimeout(function() { press("ds3")}, 1750);}
4942 {setTimeout(function() { press("d3")}, 2000);}
4943 {setTimeout(function() { press("c3")}, 2250);}
4944 {setTimeout(function() { press("as2")}, 2500);}
4945 {setTimeout(function() { press("gs2")}, 2750);}
4946 {setTimeout(function() { press("g2")}, 3000);}
4947 {setTimeout(function() { press("f2")}, 3250);}
4948 {setTimeout(function() { press("ds2")}, 3500);}
4949 {setTimeout(function() { press("ds2"); press("g2"); press("as2"); press("ds3")}, 4000);}
4950
4951 } else if (message.substring(0, 14).toLowerCase() == cmdChar+"scale ebminor") { //Eb minor scale
4952 sendChat("The Eb (flat) minor scale - it has 6 flats - its relative major is Gb");
4953 {setTimeout(function() { press("ds2")}, 0);}
4954 {setTimeout(function() { press("f2")}, 250);}
4955 {setTimeout(function() { press("fs2")}, 500);}
4956 {setTimeout(function() { press("gs2")}, 750);}
4957 {setTimeout(function() { press("as2")}, 1000);}
4958 {setTimeout(function() { press("b2")}, 1250);}
4959 {setTimeout(function() { press("cs3")}, 1500);}
4960 {setTimeout(function() { press("ds3")}, 1750);}
4961 {setTimeout(function() { press("cs3")}, 2000);}
4962 {setTimeout(function() { press("b2")}, 2250);}
4963 {setTimeout(function() { press("as2")}, 2500);}
4964 {setTimeout(function() { press("gs2")}, 2750);}
4965 {setTimeout(function() { press("fs2")}, 3000);}
4966 {setTimeout(function() { press("f2")}, 3250);}
4967 {setTimeout(function() { press("ds2")}, 3500);}
4968 {setTimeout(function() { press("ds2"); press("fs2"); press("as2"); press("ds3")}, 4000);}
4969
4970 } else if (message.substring(0, 17).toLowerCase() == cmdChar+"scale ebharminor") { //Eb harmonic minor scale
4971 sendChat("The Eb (flat) harmonic minor scale - it has 5 flats - it has a major 7th (D)");
4972 {setTimeout(function() { press("ds2")}, 0);}
4973 {setTimeout(function() { press("f2")}, 250);}
4974 {setTimeout(function() { press("fs2")}, 500);}
4975 {setTimeout(function() { press("gs2")}, 750);}
4976 {setTimeout(function() { press("as2")}, 1000);}
4977 {setTimeout(function() { press("b2")}, 1250);}
4978 {setTimeout(function() { press("d3")}, 1500);}
4979 {setTimeout(function() { press("ds3")}, 1750);}
4980 {setTimeout(function() { press("d3")}, 2000);}
4981 {setTimeout(function() { press("b2")}, 2250);}
4982 {setTimeout(function() { press("as2")}, 2500);}
4983 {setTimeout(function() { press("gs2")}, 2750);}
4984 {setTimeout(function() { press("fs2")}, 3000);}
4985 {setTimeout(function() { press("f2")}, 3250);}
4986 {setTimeout(function() { press("ds2")}, 3500);}
4987 {setTimeout(function() { press("ds2"); press("fs2"); press("as2"); press("ds3")}, 4000);}
4988
4989 } else if (message.substring(0, 17).toLowerCase() == cmdChar+"scale ebmelminor") { //Eb melodic minor scale
4990 sendChat("The Eb (flat) melodic minor scale - it has 5 flats ascending and 6 flats descending - it has two patterns ascending and descending.");
4991 {setTimeout(function() { press("ds2")}, 0);}
4992 {setTimeout(function() { press("f2")}, 250);}
4993 {setTimeout(function() { press("fs2")}, 500);}
4994 {setTimeout(function() { press("gs2")}, 750);}
4995 {setTimeout(function() { press("as2")}, 1000);}
4996 {setTimeout(function() { press("c3")}, 1250);}
4997 {setTimeout(function() { press("d3")}, 1500);}
4998 {setTimeout(function() { press("ds3")}, 1750);}
4999 {setTimeout(function() { press("cs3")}, 2000);}
5000 {setTimeout(function() { press("b2")}, 2250);}
5001 {setTimeout(function() { press("as2")}, 2500);}
5002 {setTimeout(function() { press("gs2")}, 2750);}
5003 {setTimeout(function() { press("fs2")}, 3000);}
5004 {setTimeout(function() { press("f2")}, 3250);}
5005 {setTimeout(function() { press("ds2")}, 3500);}
5006 {setTimeout(function() { press("ds2"); press("fs2"); press("as2"); press("ds3")}, 4000);}
5007 //Eb scales
5008
5009 //E scales
5010 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"scale emajor") { //E major scale
5011 sendChat("The E major scale - it has 4 sharps - its relative minor is C#");
5012 {setTimeout(function() { press("e2")}, 0);}
5013 {setTimeout(function() { press("fs2")}, 250);}
5014 {setTimeout(function() { press("gs2")}, 500);}
5015 {setTimeout(function() { press("a2")}, 750);}
5016 {setTimeout(function() { press("b2")}, 1000);}
5017 {setTimeout(function() { press("cs3")}, 1250);}
5018 {setTimeout(function() { press("ds3")}, 1500);}
5019 {setTimeout(function() { press("e3")}, 1750);}
5020 {setTimeout(function() { press("ds3")}, 2000);}
5021 {setTimeout(function() { press("cs3")}, 2250);}
5022 {setTimeout(function() { press("b2")}, 2500);}
5023 {setTimeout(function() { press("a2")}, 2750);}
5024 {setTimeout(function() { press("gs2")}, 3000);}
5025 {setTimeout(function() { press("fs2")}, 3250);}
5026 {setTimeout(function() { press("e2")}, 3500);}
5027 {setTimeout(function() { press("e2"); press("gs2"); press("b2"); press("e3")}, 4000);}
5028
5029 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"scale eminor") { //E minor scale
5030 sendChat("The E minor scale - it has 1 sharp - its relative major is G");
5031 {setTimeout(function() { press("e2")}, 0);}
5032 {setTimeout(function() { press("fs2")}, 250);}
5033 {setTimeout(function() { press("g2")}, 500);}
5034 {setTimeout(function() { press("a2")}, 750);}
5035 {setTimeout(function() { press("b2")}, 1000);}
5036 {setTimeout(function() { press("c3")}, 1250);}
5037 {setTimeout(function() { press("d3")}, 1500);}
5038 {setTimeout(function() { press("e3")}, 1750);}
5039 {setTimeout(function() { press("d3")}, 2000);}
5040 {setTimeout(function() { press("c3")}, 2250);}
5041 {setTimeout(function() { press("b2")}, 2500);}
5042 {setTimeout(function() { press("a2")}, 2750);}
5043 {setTimeout(function() { press("g2")}, 3000);}
5044 {setTimeout(function() { press("fs2")}, 3250);}
5045 {setTimeout(function() { press("e2")}, 3500);}
5046 {setTimeout(function() { press("e2"); press("g2"); press("b2"); press("e3")}, 4000);}
5047
5048 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale eharminor") { //E harmonic minor scale
5049 sendChat("The E harmonic minor scale - it has 2 sharps - it has a major 7th (D#)");
5050 {setTimeout(function() { press("e2")}, 0);}
5051 {setTimeout(function() { press("fs2")}, 250);}
5052 {setTimeout(function() { press("g2")}, 500);}
5053 {setTimeout(function() { press("a2")}, 750);}
5054 {setTimeout(function() { press("b2")}, 1000);}
5055 {setTimeout(function() { press("c3")}, 1250);}
5056 {setTimeout(function() { press("ds3")}, 1500);}
5057 {setTimeout(function() { press("e3")}, 1750);}
5058 {setTimeout(function() { press("ds3")}, 2000);}
5059 {setTimeout(function() { press("c3")}, 2250);}
5060 {setTimeout(function() { press("b2")}, 2500);}
5061 {setTimeout(function() { press("a2")}, 2750);}
5062 {setTimeout(function() { press("g2")}, 3000);}
5063 {setTimeout(function() { press("fs2")}, 3250);}
5064 {setTimeout(function() { press("e2")}, 3500);}
5065 {setTimeout(function() { press("e2"); press("g2"); press("b2"); press("e3")}, 4000);}
5066
5067 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale emelminor") { //E melodic minor scale
5068 sendChat("The E melodic minor scale - it has 3 sharps ascending and 1 sharp descending - it has two patterns ascending and descending.");
5069 {setTimeout(function() { press("e2")}, 0);}
5070 {setTimeout(function() { press("fs2")}, 250);}
5071 {setTimeout(function() { press("g2")}, 500);}
5072 {setTimeout(function() { press("a2")}, 750);}
5073 {setTimeout(function() { press("b2")}, 1000);}
5074 {setTimeout(function() { press("cs3")}, 1250);}
5075 {setTimeout(function() { press("ds3")}, 1500);}
5076 {setTimeout(function() { press("e3")}, 1750);}
5077 {setTimeout(function() { press("d3")}, 2000);}
5078 {setTimeout(function() { press("c3")}, 2250);}
5079 {setTimeout(function() { press("b2")}, 2500);}
5080 {setTimeout(function() { press("a2")}, 2750);}
5081 {setTimeout(function() { press("g2")}, 3000);}
5082 {setTimeout(function() { press("fs2")}, 3250);}
5083 {setTimeout(function() { press("e2")}, 3500);}
5084 {setTimeout(function() { press("e2"); press("g2"); press("b2"); press("e3")}, 4000);}
5085 //E scales
5086
5087 //F scales
5088 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"scale fmajor") { //F major scale
5089 sendChat("The F major scale - it has 1 flat - its relative minor is D");
5090 {setTimeout(function() { press("f2")}, 0);}
5091 {setTimeout(function() { press("g2")}, 250);}
5092 {setTimeout(function() { press("a2")}, 500);}
5093 {setTimeout(function() { press("as2")}, 750);}
5094 {setTimeout(function() { press("c3")}, 1000);}
5095 {setTimeout(function() { press("d3")}, 1250);}
5096 {setTimeout(function() { press("e3")}, 1500);}
5097 {setTimeout(function() { press("f3")}, 1750);}
5098 {setTimeout(function() { press("e3")}, 2000);}
5099 {setTimeout(function() { press("d3")}, 2250);}
5100 {setTimeout(function() { press("c3")}, 2500);}
5101 {setTimeout(function() { press("as2")}, 2750);}
5102 {setTimeout(function() { press("a2")}, 3000);}
5103 {setTimeout(function() { press("g2")}, 3250);}
5104 {setTimeout(function() { press("f2")}, 3500);}
5105 {setTimeout(function() { press("f2"); press("a2"); press("c3"); press("f3")}, 4000);}
5106
5107 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"scale fminor") { //F minor scale
5108 sendChat("The F minor scale - it has 4 flats - its relative major is Ab");
5109 {setTimeout(function() { press("f2")}, 0);}
5110 {setTimeout(function() { press("g2")}, 250);}
5111 {setTimeout(function() { press("gs2")}, 500);}
5112 {setTimeout(function() { press("as2")}, 750);}
5113 {setTimeout(function() { press("c3")}, 1000);}
5114 {setTimeout(function() { press("cs3")}, 1250);}
5115 {setTimeout(function() { press("ds3")}, 1500);}
5116 {setTimeout(function() { press("f3")}, 1750);}
5117 {setTimeout(function() { press("ds3")}, 2000);}
5118 {setTimeout(function() { press("cs3")}, 2250);}
5119 {setTimeout(function() { press("c3")}, 2500);}
5120 {setTimeout(function() { press("as2")}, 2750);}
5121 {setTimeout(function() { press("gs2")}, 3000);}
5122 {setTimeout(function() { press("g2")}, 3250);}
5123 {setTimeout(function() { press("f2")}, 3500);}
5124 {setTimeout(function() { press("f2"); press("gs2"); press("c3"); press("f3")}, 4000);}
5125
5126 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale fharminor") { //F harmonic minor scale
5127 sendChat("The F harmonic minor scale - it has 3 flats - it has a major 7th (E)");
5128 {setTimeout(function() { press("f2")}, 0);}
5129 {setTimeout(function() { press("g2")}, 250);}
5130 {setTimeout(function() { press("gs2")}, 500);}
5131 {setTimeout(function() { press("as2")}, 750);}
5132 {setTimeout(function() { press("c3")}, 1000);}
5133 {setTimeout(function() { press("cs3")}, 1250);}
5134 {setTimeout(function() { press("e3")}, 1500);}
5135 {setTimeout(function() { press("f3")}, 1750);}
5136 {setTimeout(function() { press("e3")}, 2000);}
5137 {setTimeout(function() { press("cs3")}, 2250);}
5138 {setTimeout(function() { press("c3")}, 2500);}
5139 {setTimeout(function() { press("as2")}, 2750);}
5140 {setTimeout(function() { press("gs2")}, 3000);}
5141 {setTimeout(function() { press("g2")}, 3250);}
5142 {setTimeout(function() { press("f2")}, 3500);}
5143 {setTimeout(function() { press("f2"); press("gs2"); press("c3"); press("f3")}, 4000);}
5144
5145 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale fmelminor") { //F melodic minor scale
5146 sendChat("The F melodic minor scale - it has 2 flats ascending and 4 flats descending - it has two patterns ascending and descending.");
5147 {setTimeout(function() { press("f2")}, 0);}
5148 {setTimeout(function() { press("g2")}, 250);}
5149 {setTimeout(function() { press("gs2")}, 500);}
5150 {setTimeout(function() { press("as2")}, 750);}
5151 {setTimeout(function() { press("c3")}, 1000);}
5152 {setTimeout(function() { press("d3")}, 1250);}
5153 {setTimeout(function() { press("e3")}, 1500);}
5154 {setTimeout(function() { press("f3")}, 1750);}
5155 {setTimeout(function() { press("ds3")}, 2000);}
5156 {setTimeout(function() { press("cs3")}, 2250);}
5157 {setTimeout(function() { press("c3")}, 2500);}
5158 {setTimeout(function() { press("as2")}, 2750);}
5159 {setTimeout(function() { press("gs2")}, 3000);}
5160 {setTimeout(function() { press("g2")}, 3250);}
5161 {setTimeout(function() { press("f2")}, 3500);}
5162 {setTimeout(function() { press("f2"); press("gs2"); press("c3"); press("f3")}, 4000);}
5163 //F scales
5164
5165 //F# scales
5166 } else if (message.substring(0, 14).toLowerCase() == cmdChar+"scale fsmajor") { //F# major scale
5167 sendChat("The F# (sharp) major scale - it has 6 sharps - its relative minor is D#");
5168 {setTimeout(function() { press("fs2")}, 0);}
5169 {setTimeout(function() { press("gs2")}, 250);}
5170 {setTimeout(function() { press("as2")}, 500);}
5171 {setTimeout(function() { press("b2")}, 750);}
5172 {setTimeout(function() { press("cs3")}, 1000);}
5173 {setTimeout(function() { press("ds3")}, 1250);}
5174 {setTimeout(function() { press("f3")}, 1500);}
5175 {setTimeout(function() { press("fs3")}, 1750);}
5176 {setTimeout(function() { press("f3")}, 2000);}
5177 {setTimeout(function() { press("ds3")}, 2250);}
5178 {setTimeout(function() { press("cs3")}, 2500);}
5179 {setTimeout(function() { press("b2")}, 2750);}
5180 {setTimeout(function() { press("as2")}, 3000);}
5181 {setTimeout(function() { press("gs2")}, 3250);}
5182 {setTimeout(function() { press("fs2")}, 3500);}
5183 {setTimeout(function() { press("fs2"); press("as2"); press("cs3"); press("fs3")}, 4000);}
5184
5185 } else if (message.substring(0, 14).toLowerCase() == cmdChar+"scale fsminor") { //F# minor scale
5186 sendChat("The F# (sharp) minor scale - it has 3 sharps - its relative major is A");
5187 {setTimeout(function() { press("fs2")}, 0);}
5188 {setTimeout(function() { press("gs2")}, 250);}
5189 {setTimeout(function() { press("a2")}, 500);}
5190 {setTimeout(function() { press("b2")}, 750);}
5191 {setTimeout(function() { press("cs3")}, 1000);}
5192 {setTimeout(function() { press("d3")}, 1250);}
5193 {setTimeout(function() { press("e3")}, 1500);}
5194 {setTimeout(function() { press("fs3")}, 1750);}
5195 {setTimeout(function() { press("e3")}, 2000);}
5196 {setTimeout(function() { press("d3")}, 2250);}
5197 {setTimeout(function() { press("cs3")}, 2500);}
5198 {setTimeout(function() { press("b2")}, 2750);}
5199 {setTimeout(function() { press("a2")}, 3000);}
5200 {setTimeout(function() { press("gs2")}, 3250);}
5201 {setTimeout(function() { press("fs2")}, 3500);}
5202 {setTimeout(function() { press("fs2"); press("a2"); press("cs3"); press("fs3")}, 4000);}
5203
5204 } else if (message.substring(0, 17).toLowerCase() == cmdChar+"scale fsharminor") { //F# harmonic minor scale
5205 sendChat("The F# (sharp) harmonic minor scale - it has 4 sharps - it has a major 7th (E#)");
5206 {setTimeout(function() { press("fs2")}, 0);}
5207 {setTimeout(function() { press("gs2")}, 250);}
5208 {setTimeout(function() { press("a2")}, 500);}
5209 {setTimeout(function() { press("b2")}, 750);}
5210 {setTimeout(function() { press("cs3")}, 1000);}
5211 {setTimeout(function() { press("d3")}, 1250);}
5212 {setTimeout(function() { press("f3")}, 1500);}
5213 {setTimeout(function() { press("fs3")}, 1750);}
5214 {setTimeout(function() { press("f3")}, 2000);}
5215 {setTimeout(function() { press("d3")}, 2250);}
5216 {setTimeout(function() { press("cs3")}, 2500);}
5217 {setTimeout(function() { press("b2")}, 2750);}
5218 {setTimeout(function() { press("a2")}, 3000);}
5219 {setTimeout(function() { press("gs2")}, 3250);}
5220 {setTimeout(function() { press("fs2")}, 3500);}
5221 {setTimeout(function() { press("fs2"); press("a2"); press("cs3"); press("fs3")}, 4000);}
5222
5223 } else if (message.substring(0, 17).toLowerCase() == cmdChar+"scale fsmelminor") { //F# melodic minor scale
5224 sendChat("The F# (sharp) melodic minor scale - it has 5 sharps ascending and 3 sharps descending - it has two patterns ascending and descending.");
5225 {setTimeout(function() { press("fs2")}, 0);}
5226 {setTimeout(function() { press("gs2")}, 250);}
5227 {setTimeout(function() { press("a2")}, 500);}
5228 {setTimeout(function() { press("b2")}, 750);}
5229 {setTimeout(function() { press("cs3")}, 1000);}
5230 {setTimeout(function() { press("ds3")}, 1250);}
5231 {setTimeout(function() { press("f3")}, 1500);}
5232 {setTimeout(function() { press("fs3")}, 1750);}
5233 {setTimeout(function() { press("e3")}, 2000);}
5234 {setTimeout(function() { press("d3")}, 2250);}
5235 {setTimeout(function() { press("cs3")}, 2500);}
5236 {setTimeout(function() { press("b2")}, 2750);}
5237 {setTimeout(function() { press("a2")}, 3000);}
5238 {setTimeout(function() { press("gs2")}, 3250);}
5239 {setTimeout(function() { press("fs2")}, 3500);}
5240 {setTimeout(function() { press("fs2"); press("a2"); press("cs3"); press("fs3")}, 4000);}
5241 //F# scales
5242
5243 //G scales
5244 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"scale gmajor") { //G major scale
5245 sendChat("The G major scale - it has 1 sharp - its relative minor is E");
5246 {setTimeout(function() { press("g2")}, 0);}
5247 {setTimeout(function() { press("a2")}, 250);}
5248 {setTimeout(function() { press("b2")}, 500);}
5249 {setTimeout(function() { press("c3")}, 750);}
5250 {setTimeout(function() { press("d3")}, 1000);}
5251 {setTimeout(function() { press("e3")}, 1250);}
5252 {setTimeout(function() { press("fs3")}, 1500);}
5253 {setTimeout(function() { press("g3")}, 1750);}
5254 {setTimeout(function() { press("fs3")}, 2000);}
5255 {setTimeout(function() { press("e3")}, 2250);}
5256 {setTimeout(function() { press("d3")}, 2500);}
5257 {setTimeout(function() { press("c3")}, 2750);}
5258 {setTimeout(function() { press("b2")}, 3000);}
5259 {setTimeout(function() { press("a2")}, 3250);}
5260 {setTimeout(function() { press("g2")}, 3500);}
5261 {setTimeout(function() { press("g2"); press("b2"); press("d3"); press("g3")}, 4000);}
5262
5263 } else if (message.substring(0, 14).toLowerCase() == cmdChar+"scale gminor") { //G minor scale
5264 sendChat("The G minor scale - it has 1 sharps - its relative major is Bb");
5265 {setTimeout(function() { press("g2")}, 0);}
5266 {setTimeout(function() { press("a2")}, 250);}
5267 {setTimeout(function() { press("as2")}, 500);}
5268 {setTimeout(function() { press("c3")}, 750);}
5269 {setTimeout(function() { press("d3")}, 1000);}
5270 {setTimeout(function() { press("ds3")}, 1250);}
5271 {setTimeout(function() { press("f3")}, 1500);}
5272 {setTimeout(function() { press("g3")}, 1750);}
5273 {setTimeout(function() { press("f3")}, 2000);}
5274 {setTimeout(function() { press("ds3")}, 2250);}
5275 {setTimeout(function() { press("d3")}, 2500);}
5276 {setTimeout(function() { press("c3")}, 2750);}
5277 {setTimeout(function() { press("as2")}, 3000);}
5278 {setTimeout(function() { press("a2")}, 3250);}
5279 {setTimeout(function() { press("g2")}, 3500);}
5280 {setTimeout(function() { press("g2"); press("as2"); press("d3"); press("g3")}, 4000);}
5281
5282 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale gharminor") { //G harmonic minor scale
5283 sendChat("The G harmonic minor scale - it has 3 sharps - it has a major 7th (F#)");
5284 {setTimeout(function() { press("g2")}, 0);}
5285 {setTimeout(function() { press("a2")}, 250);}
5286 {setTimeout(function() { press("as2")}, 500);}
5287 {setTimeout(function() { press("c3")}, 750);}
5288 {setTimeout(function() { press("d3")}, 1000);}
5289 {setTimeout(function() { press("ds3")}, 1250);}
5290 {setTimeout(function() { press("fs3")}, 1500);}
5291 {setTimeout(function() { press("g3")}, 1750);}
5292 {setTimeout(function() { press("fs3")}, 2000);}
5293 {setTimeout(function() { press("ds3")}, 2250);}
5294 {setTimeout(function() { press("d3")}, 2500);}
5295 {setTimeout(function() { press("c3")}, 2750);}
5296 {setTimeout(function() { press("as2")}, 3000);}
5297 {setTimeout(function() { press("a2")}, 3250);}
5298 {setTimeout(function() { press("g2")}, 3500);}
5299 {setTimeout(function() { press("g2"); press("as2"); press("d3"); press("g3")}, 4000);}
5300
5301 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale gmelminor") { //G melodic minor scale
5302 sendChat("The G melodic minor scale - it has 1 sharp ascending and 2 sharps descending - it has two patterns ascending and descending.");
5303 {setTimeout(function() { press("g2")}, 0);}
5304 {setTimeout(function() { press("a2")}, 250);}
5305 {setTimeout(function() { press("as2")}, 500);}
5306 {setTimeout(function() { press("c3")}, 750);}
5307 {setTimeout(function() { press("d3")}, 1000);}
5308 {setTimeout(function() { press("e3")}, 1250);}
5309 {setTimeout(function() { press("fs3")}, 1500);}
5310 {setTimeout(function() { press("g3")}, 1750);}
5311 {setTimeout(function() { press("f3")}, 2000);}
5312 {setTimeout(function() { press("ds3")}, 2250);}
5313 {setTimeout(function() { press("d3")}, 2500);}
5314 {setTimeout(function() { press("c3")}, 2750);}
5315 {setTimeout(function() { press("as2")}, 3000);}
5316 {setTimeout(function() { press("a2")}, 3250);}
5317 {setTimeout(function() { press("g2")}, 3500);}
5318 {setTimeout(function() { press("g2"); press("as2"); press("d3"); press("g3")}, 4000);}
5319 //G scales
5320
5321 //Ab Scales
5322 } else if (message.substring(0, 14).toLowerCase() == cmdChar+"scale abmajor") { //Ab major scale
5323 sendChat("The Ab (flat) major scale - it has 4 flats - its relative minor is F");
5324 {setTimeout(function() { press("gs2")}, 0);}
5325 {setTimeout(function() { press("as2")}, 250);}
5326 {setTimeout(function() { press("c3")}, 500);}
5327 {setTimeout(function() { press("cs3")}, 750);}
5328 {setTimeout(function() { press("ds3")}, 1000);}
5329 {setTimeout(function() { press("f3")}, 1250);}
5330 {setTimeout(function() { press("g3")}, 1500);}
5331 {setTimeout(function() { press("gs3")}, 1750);}
5332 {setTimeout(function() { press("g3")}, 2000);}
5333 {setTimeout(function() { press("f3")}, 2250);}
5334 {setTimeout(function() { press("ds3")}, 2500);}
5335 {setTimeout(function() { press("cs3")}, 2750);}
5336 {setTimeout(function() { press("c3")}, 3000);}
5337 {setTimeout(function() { press("as2")}, 3250);}
5338 {setTimeout(function() { press("gs2")}, 3500);}
5339 {setTimeout(function() { press("gs2"); press("c3"); press("ds3"); press("gs3")}, 4000);}
5340
5341 } else if (message.substring(0, 15).toLowerCase() == cmdChar+"scale abminor") { //Ab minor scale
5342 sendChat("The Ab (flat) minor scale - it has 7 flats - its relative major is Cb major or enharmonically, B major");
5343 {setTimeout(function() { press("gs2")}, 0);}
5344 {setTimeout(function() { press("as2")}, 250);}
5345 {setTimeout(function() { press("b2")}, 500);}
5346 {setTimeout(function() { press("cs3")}, 750);}
5347 {setTimeout(function() { press("ds3")}, 1000);}
5348 {setTimeout(function() { press("e3")}, 1250);}
5349 {setTimeout(function() { press("fs3")}, 1500);}
5350 {setTimeout(function() { press("gs3")}, 1750);}
5351 {setTimeout(function() { press("fs3")}, 2000);}
5352 {setTimeout(function() { press("e3")}, 2250);}
5353 {setTimeout(function() { press("ds3")}, 2500);}
5354 {setTimeout(function() { press("cs3")}, 2750);}
5355 {setTimeout(function() { press("b2")}, 3000);}
5356 {setTimeout(function() { press("as2")}, 3250);}
5357 {setTimeout(function() { press("gs2")}, 3500);}
5358 {setTimeout(function() { press("gs2"); press("b2"); press("ds3"); press("gs3")}, 4000);}
5359
5360 } else if (message.substring(0, 17).toLowerCase() == cmdChar+"scale abharminor") { //Ab harmonic minor scale
5361 sendChat("The Ab (flat) harmonic minor scale - it has 4 flats - it has a major 7th (G)");
5362 {setTimeout(function() { press("gs2")}, 0);}
5363 {setTimeout(function() { press("as2")}, 250);}
5364 {setTimeout(function() { press("b2")}, 500);}
5365 {setTimeout(function() { press("cs3")}, 750);}
5366 {setTimeout(function() { press("ds3")}, 1000);}
5367 {setTimeout(function() { press("e3")}, 1250);}
5368 {setTimeout(function() { press("g3")}, 1500);}
5369 {setTimeout(function() { press("gs3")}, 1750);}
5370 {setTimeout(function() { press("g3")}, 2000);}
5371 {setTimeout(function() { press("e3")}, 2250);}
5372 {setTimeout(function() { press("ds3")}, 2500);}
5373 {setTimeout(function() { press("cs3")}, 2750);}
5374 {setTimeout(function() { press("b2")}, 3000);}
5375 {setTimeout(function() { press("as2")}, 3250);}
5376 {setTimeout(function() { press("gs2")}, 3500);}
5377 {setTimeout(function() { press("gs2"); press("b2"); press("ds3"); press("gs3")}, 4000);}
5378
5379 } else if (message.substring(0, 17).toLowerCase() == cmdChar+"scale abmelminor") { //Ab melodic minor scale
5380 sendChat("The Ab (flat) melodic minor scale - it has 3 flats ascending and 4 flats descending - it has two patterns ascending and descending.");
5381 {setTimeout(function() { press("gs2")}, 0);}
5382 {setTimeout(function() { press("as2")}, 250);}
5383 {setTimeout(function() { press("b2")}, 500);}
5384 {setTimeout(function() { press("cs3")}, 750);}
5385 {setTimeout(function() { press("ds3")}, 1000);}
5386 {setTimeout(function() { press("f3")}, 1250);}
5387 {setTimeout(function() { press("g3")}, 1500);}
5388 {setTimeout(function() { press("gs3")}, 1750);}
5389 {setTimeout(function() { press("fs3")}, 2000);}
5390 {setTimeout(function() { press("e3")}, 2250);}
5391 {setTimeout(function() { press("ds3")}, 2500);}
5392 {setTimeout(function() { press("cs3")}, 2750);}
5393 {setTimeout(function() { press("b2")}, 3000);}
5394 {setTimeout(function() { press("as2")}, 3250);}
5395 {setTimeout(function() { press("gs2")}, 3500);}
5396 {setTimeout(function() { press("gs2"); press("b2"); press("ds3"); press("gs3")}, 4000);}
5397 //Ab Scales
5398
5399 //A Scales
5400 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"scale amajor") { //A major scale
5401 sendChat("The A major scale - it has 3 sharps - its relative minor is F#");
5402 {setTimeout(function() { press("a2")}, 0);}
5403 {setTimeout(function() { press("b2")}, 250);}
5404 {setTimeout(function() { press("cs3")}, 500);}
5405 {setTimeout(function() { press("d3")}, 750);}
5406 {setTimeout(function() { press("e3")}, 1000);}
5407 {setTimeout(function() { press("fs3")}, 1250);}
5408 {setTimeout(function() { press("gs3")}, 1500);}
5409 {setTimeout(function() { press("a3")}, 1750);}
5410 {setTimeout(function() { press("gs3")}, 2000);}
5411 {setTimeout(function() { press("fs3")}, 2250);}
5412 {setTimeout(function() { press("e3")}, 2500);}
5413 {setTimeout(function() { press("d3")}, 2750);}
5414 {setTimeout(function() { press("cs3")}, 3000);}
5415 {setTimeout(function() { press("b2")}, 3250);}
5416 {setTimeout(function() { press("a2")}, 3500);}
5417 {setTimeout(function() { press("a2"); press("cs3"); press("e3"); press("a3")}, 4000);}
5418
5419 } else if (message.substring(0, 14).toLowerCase() == cmdChar+"scale aminor") { //A minor scale
5420 sendChat("The A minor scale - it has no sharps or flats - its relative major is C major");
5421 {setTimeout(function() { press("a2")}, 0);}
5422 {setTimeout(function() { press("b2")}, 250);}
5423 {setTimeout(function() { press("c3")}, 500);}
5424 {setTimeout(function() { press("d3")}, 750);}
5425 {setTimeout(function() { press("e3")}, 1000);}
5426 {setTimeout(function() { press("f3")}, 1250);}
5427 {setTimeout(function() { press("g3")}, 1500);}
5428 {setTimeout(function() { press("a3")}, 1750);}
5429 {setTimeout(function() { press("g3")}, 2000);}
5430 {setTimeout(function() { press("f3")}, 2250);}
5431 {setTimeout(function() { press("e3")}, 2500);}
5432 {setTimeout(function() { press("d3")}, 2750);}
5433 {setTimeout(function() { press("c3")}, 3000);}
5434 {setTimeout(function() { press("b2")}, 3250);}
5435 {setTimeout(function() { press("a2")}, 3500);}
5436 {setTimeout(function() { press("a2"); press("c3"); press("e3"); press("a3")}, 4000);}
5437
5438 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale aharminor") { //A harmonic minor scale
5439 sendChat("The A harmonic minor scale - it has 1 flat - it has a major 7th (G#)");
5440 {setTimeout(function() { press("a2")}, 0);}
5441 {setTimeout(function() { press("b2")}, 250);}
5442 {setTimeout(function() { press("cs3")}, 500);}
5443 {setTimeout(function() { press("d3")}, 750);}
5444 {setTimeout(function() { press("e3")}, 1000);}
5445 {setTimeout(function() { press("fs3")}, 1250);}
5446 {setTimeout(function() { press("gs3")}, 1500);}
5447 {setTimeout(function() { press("a3")}, 1750);}
5448 {setTimeout(function() { press("gs3")}, 2000);}
5449 {setTimeout(function() { press("fs3")}, 2250);}
5450 {setTimeout(function() { press("e3")}, 2500);}
5451 {setTimeout(function() { press("d3")}, 2750);}
5452 {setTimeout(function() { press("cs3")}, 3000);}
5453 {setTimeout(function() { press("b2")}, 3250);}
5454 {setTimeout(function() { press("a2")}, 3500);}
5455 {setTimeout(function() { press("a2"); press("cs3"); press("e3"); press("a3")}, 4000);}
5456
5457 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale amelminor") { //A melodic minor scale
5458 sendChat("The A melodic minor scale - it has 2 sharps ascending and 0 sharps descending - it has two patterns ascending and descending.");
5459 {setTimeout(function() { press("a2")}, 0);}
5460 {setTimeout(function() { press("b2")}, 250);}
5461 {setTimeout(function() { press("c3")}, 500);}
5462 {setTimeout(function() { press("d3")}, 750);}
5463 {setTimeout(function() { press("e3")}, 1000);}
5464 {setTimeout(function() { press("fs3")}, 1250);}
5465 {setTimeout(function() { press("gs3")}, 1500);}
5466 {setTimeout(function() { press("a3")}, 1750);}
5467 {setTimeout(function() { press("g3")}, 2000);}
5468 {setTimeout(function() { press("f3")}, 2250);}
5469 {setTimeout(function() { press("e3")}, 2500);}
5470 {setTimeout(function() { press("d3")}, 2750);}
5471 {setTimeout(function() { press("c3")}, 3000);}
5472 {setTimeout(function() { press("b2")}, 3250);}
5473 {setTimeout(function() { press("a2")}, 3500);}
5474 {setTimeout(function() { press("a2"); press("c3"); press("e3"); press("a3")}, 4000);}
5475 //A Scales
5476
5477 //Bb Scales
5478 } else if (message.substring(0, 14).toLowerCase() == cmdChar+"scale bbmajor") { //Bb major scale
5479 sendChat("The Bb (flat) major scale - it has 2 flats - its relative minor is G");
5480 {setTimeout(function() { press("as2")}, 0);}
5481 {setTimeout(function() { press("c3")}, 250);}
5482 {setTimeout(function() { press("d3")}, 500);}
5483 {setTimeout(function() { press("ds3")}, 750);}
5484 {setTimeout(function() { press("f3")}, 1000);}
5485 {setTimeout(function() { press("g3")}, 1250);}
5486 {setTimeout(function() { press("a3")}, 1500);}
5487 {setTimeout(function() { press("as3")}, 1750);}
5488 {setTimeout(function() { press("a3")}, 2000);}
5489 {setTimeout(function() { press("g3")}, 2250);}
5490 {setTimeout(function() { press("f3")}, 2500);}
5491 {setTimeout(function() { press("ds3")}, 2750);}
5492 {setTimeout(function() { press("d3")}, 3000);}
5493 {setTimeout(function() { press("c3")}, 3250);}
5494 {setTimeout(function() { press("as2")}, 3500);}
5495 {setTimeout(function() { press("as2"); press("d3"); press("f3"); press("as3")}, 4000);}
5496
5497 } else if (message.substring(0, 15).toLowerCase() == cmdChar+"scale bbminor") { //Bb minor scale
5498 sendChat("The Bb (flat) minor scale - it 6 flats - its relative major is Db major");
5499 {setTimeout(function() { press("as2")}, 0);}
5500 {setTimeout(function() { press("c3")}, 250);}
5501 {setTimeout(function() { press("cs3")}, 500);}
5502 {setTimeout(function() { press("ds3")}, 750);}
5503 {setTimeout(function() { press("f3")}, 1000);}
5504 {setTimeout(function() { press("fs3")}, 1250);}
5505 {setTimeout(function() { press("gs3")}, 1500);}
5506 {setTimeout(function() { press("as3")}, 1750);}
5507 {setTimeout(function() { press("gs3")}, 2000);}
5508 {setTimeout(function() { press("fs3")}, 2250);}
5509 {setTimeout(function() { press("f3")}, 2500);}
5510 {setTimeout(function() { press("ds3")}, 2750);}
5511 {setTimeout(function() { press("cs3")}, 3000);}
5512 {setTimeout(function() { press("c3")}, 3250);}
5513 {setTimeout(function() { press("as2")}, 3500);}
5514 {setTimeout(function() { press("as2"); press("cs3"); press("f3"); press("as3")}, 4000);}
5515
5516 } else if (message.substring(0, 17).toLowerCase() == cmdChar+"scale bbharminor") { //Bb harmonic minor scale
5517 sendChat("The Bb (flat) harmonic minor scale - it has 5 flats - it has a major 7th (A)");
5518 {setTimeout(function() { press("as2")}, 0);}
5519 {setTimeout(function() { press("c3")}, 250);}
5520 {setTimeout(function() { press("cs3")}, 500);}
5521 {setTimeout(function() { press("ds3")}, 750);}
5522 {setTimeout(function() { press("f3")}, 1000);}
5523 {setTimeout(function() { press("fs3")}, 1250);}
5524 {setTimeout(function() { press("a3")}, 1500);}
5525 {setTimeout(function() { press("as3")}, 1750);}
5526 {setTimeout(function() { press("a3")}, 2000);}
5527 {setTimeout(function() { press("fs3")}, 2250);}
5528 {setTimeout(function() { press("f3")}, 2500);}
5529 {setTimeout(function() { press("ds3")}, 2750);}
5530 {setTimeout(function() { press("cs3")}, 3000);}
5531 {setTimeout(function() { press("c3")}, 3250);}
5532 {setTimeout(function() { press("as2")}, 3500);}
5533 {setTimeout(function() { press("as2"); press("cs3"); press("f3"); press("as3")}, 4000);}
5534
5535 } else if (message.substring(0, 17).toLowerCase() == cmdChar+"scale bbmelminor") { //Bb melodic minor scale
5536 sendChat("The Bb (flat) melodic minor scale - it has 4 flat ascending and 6 sharps descending - it has two patterns ascending and descending.");
5537 {setTimeout(function() { press("as2")}, 0);}
5538 {setTimeout(function() { press("c3")}, 250);}
5539 {setTimeout(function() { press("cs3")}, 500);}
5540 {setTimeout(function() { press("ds3")}, 750);}
5541 {setTimeout(function() { press("f3")}, 1000);}
5542 {setTimeout(function() { press("g3")}, 1250);}
5543 {setTimeout(function() { press("a3")}, 1500);}
5544 {setTimeout(function() { press("as3")}, 1750);}
5545 {setTimeout(function() { press("gs3")}, 2000);}
5546 {setTimeout(function() { press("fs3")}, 2250);}
5547 {setTimeout(function() { press("f3")}, 2500);}
5548 {setTimeout(function() { press("ds3")}, 2750);}
5549 {setTimeout(function() { press("cs3")}, 3000);}
5550 {setTimeout(function() { press("c3")}, 3250);}
5551 {setTimeout(function() { press("as2")}, 3500);}
5552 {setTimeout(function() { press("as2"); press("cs3"); press("f3"); press("as3")}, 4000);}
5553 //Bb Scales
5554
5555 //B Scales
5556 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"scale bmajor") { //B major scale
5557 sendChat("The B major scale - it has 5 sharps - its relative minor is G#");
5558 {setTimeout(function() { press("b2")}, 0);}
5559 {setTimeout(function() { press("cs3")}, 250);}
5560 {setTimeout(function() { press("ds3")}, 500);}
5561 {setTimeout(function() { press("e3")}, 750);}
5562 {setTimeout(function() { press("fs3")}, 1000);}
5563 {setTimeout(function() { press("gs3")}, 1250);}
5564 {setTimeout(function() { press("as3")}, 1500);}
5565 {setTimeout(function() { press("b3")}, 1750);}
5566 {setTimeout(function() { press("as3")}, 2000);}
5567 {setTimeout(function() { press("gs3")}, 2250);}
5568 {setTimeout(function() { press("fs3")}, 2500);}
5569 {setTimeout(function() { press("e3")}, 2750);}
5570 {setTimeout(function() { press("ds3")}, 3000);}
5571 {setTimeout(function() { press("cs3")}, 3250);}
5572 {setTimeout(function() { press("b2")}, 3500);}
5573 {setTimeout(function() { press("b2"); press("ds3"); press("fs3"); press("b3")}, 4000);}
5574
5575 } else if (message.substring(0, 14).toLowerCase() == cmdChar+"scale bminor") { //B minor scale
5576 sendChat("The B minor scale - it 2 sharps - its relative major is D major");
5577 {setTimeout(function() { press("b2")}, 0);}
5578 {setTimeout(function() { press("cs3")}, 250);}
5579 {setTimeout(function() { press("d3")}, 500);}
5580 {setTimeout(function() { press("e3")}, 750);}
5581 {setTimeout(function() { press("fs3")}, 1000);}
5582 {setTimeout(function() { press("g3")}, 1250);}
5583 {setTimeout(function() { press("a3")}, 1500);}
5584 {setTimeout(function() { press("b3")}, 1750);}
5585 {setTimeout(function() { press("a3")}, 2000);}
5586 {setTimeout(function() { press("g3")}, 2250);}
5587 {setTimeout(function() { press("fs3")}, 2500);}
5588 {setTimeout(function() { press("e3")}, 2750);}
5589 {setTimeout(function() { press("d3")}, 3000);}
5590 {setTimeout(function() { press("cs3")}, 3250);}
5591 {setTimeout(function() { press("b2")}, 3500);}
5592 {setTimeout(function() { press("b2"); press("d3"); press("fs3"); press("b3")}, 4000);}
5593
5594 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale bharminor") { //B harmonic minor scale
5595 sendChat("The B harmonic minor scale - it has 3 sharps - it has a major 7th (A#)");
5596 {setTimeout(function() { press("b2")}, 0);}
5597 {setTimeout(function() { press("cs3")}, 250);}
5598 {setTimeout(function() { press("d3")}, 500);}
5599 {setTimeout(function() { press("e3")}, 750);}
5600 {setTimeout(function() { press("fs3")}, 1000);}
5601 {setTimeout(function() { press("g3")}, 1250);}
5602 {setTimeout(function() { press("as3")}, 1500);}
5603 {setTimeout(function() { press("b3")}, 1750);}
5604 {setTimeout(function() { press("as3")}, 2000);}
5605 {setTimeout(function() { press("g3")}, 2250);}
5606 {setTimeout(function() { press("fs3")}, 2500);}
5607 {setTimeout(function() { press("e3")}, 2750);}
5608 {setTimeout(function() { press("d3")}, 3000);}
5609 {setTimeout(function() { press("cs3")}, 3250);}
5610 {setTimeout(function() { press("b2")}, 3500);}
5611 {setTimeout(function() { press("b2"); press("d3"); press("fs3"); press("b3")}, 4000);}
5612
5613 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale bmelminor") { //B melodic minor scale
5614 sendChat("The B melodic minor scale - it has 4 sharps ascending and 2 sharps descending - it has two patterns ascending and descending.");
5615 {setTimeout(function() { press("b2")}, 0);}
5616 {setTimeout(function() { press("cs3")}, 250);}
5617 {setTimeout(function() { press("d3")}, 500);}
5618 {setTimeout(function() { press("e3")}, 750);}
5619 {setTimeout(function() { press("fs3")}, 1000);}
5620 {setTimeout(function() { press("gs3")}, 1250);}
5621 {setTimeout(function() { press("as3")}, 1500);}
5622 {setTimeout(function() { press("b3")}, 1750);}
5623 {setTimeout(function() { press("a3")}, 2000);}
5624 {setTimeout(function() { press("g3")}, 2250);}
5625 {setTimeout(function() { press("fs3")}, 2500);}
5626 {setTimeout(function() { press("e3")}, 2750);}
5627 {setTimeout(function() { press("d3")}, 3000);}
5628 {setTimeout(function() { press("cs3")}, 3250);}
5629 {setTimeout(function() { press("b2")}, 3500);}
5630 {setTimeout(function() { press("b2"); press("d3"); press("fs3"); press("b3")}, 4000);}
5631 //B Scales
5632 //scales
5633
5634 //glossary
5635 } else if (cmd == cmdChar+"glossary") { //Glossary
5636 sendChat("Music theory glossary: "+cmdChar+"arpeggio, "+cmdChar+"glissando [Unfinished!!]");
5637
5638 //Arpeggio
5639 } else if (cmd == cmdChar+"arpeggio") { //Arpeggio
5640 sendChat("An arpeggio is a musical technique where notes in a chord are played in sequence, one after the other. This word comes from the Italian word \"arpeggiare\", which means \"to play on a harp\". An alternative translation of this term is \"broken chord\".");
5641 {setTimeout(function() { press("c0")}, 0);} //octave
5642 {setTimeout(function() { press("ds0")}, 200);}
5643 {setTimeout(function() { press("g0")}, 400);}
5644 {setTimeout(function() { press("c1")}, 600);} //octave
5645 {setTimeout(function() { press("ds1")}, 800);}
5646 {setTimeout(function() { press("g1")}, 1000);}
5647 {setTimeout(function() { press("c2")}, 1200);} //octave
5648 {setTimeout(function() { press("ds2")}, 1400);}
5649 {setTimeout(function() { press("g2")}, 1600);}
5650 {setTimeout(function() { press("c3")}, 1800);} //octave
5651 {setTimeout(function() { press("ds3")}, 2000);}
5652 {setTimeout(function() { press("g3")}, 2200);}
5653 {setTimeout(function() { press("c4")}, 2400);} //octave
5654 {setTimeout(function() { press("ds4")}, 2600);}
5655 {setTimeout(function() { press("g4")}, 2800);}
5656 {setTimeout(function() { press("c5")}, 3000);} //octave
5657 {setTimeout(function() { press("ds5")}, 3200);}
5658 {setTimeout(function() { press("g5")}, 3400);}
5659 {setTimeout(function() { press("c6")}, 3600);} //octave
5660 {setTimeout(function() { press("ds6")}, 3800);}
5661 {setTimeout(function() { press("g6")}, 4000);}
5662 {setTimeout(function() { press("c7")}, 4200);} //octave
5663 //Arpeggio
5664
5665 //Glissando
5666 } else if (cmd == cmdChar+"glissando") { //Glissando
5667 sendChat("In music, a glissando is a glide from one pitch to another. It is an Italianized musical term derived from the French \"glisser\", to glide.");
5668 {setTimeout(function() { press("a-1")}, 100);}
5669 {setTimeout(function() { press("b-1")}, 200);}
5670 {setTimeout(function() { press("c0")}, 300);}
5671 {setTimeout(function() { press("d0")}, 400);}
5672 {setTimeout(function() { press("e0")}, 500);}
5673 {setTimeout(function() { press("f0")}, 600);}
5674 {setTimeout(function() { press("g0")}, 700);}
5675 {setTimeout(function() { press("a0")}, 800);}
5676 {setTimeout(function() { press("b0")}, 900);}
5677 {setTimeout(function() { press("c1")}, 1000);}
5678 {setTimeout(function() { press("d1")}, 1100);}
5679 {setTimeout(function() { press("e1")}, 1200);}
5680 {setTimeout(function() { press("f1")}, 1300);}
5681 {setTimeout(function() { press("g1")}, 1400);}
5682 {setTimeout(function() { press("a1")}, 1500);}
5683 {setTimeout(function() { press("b1")}, 1600);}
5684 {setTimeout(function() { press("c2")}, 1700);}
5685 {setTimeout(function() { press("d2")}, 1800);}
5686 {setTimeout(function() { press("e2")}, 1900);}
5687 {setTimeout(function() { press("f2")}, 2000);}
5688 {setTimeout(function() { press("g2")}, 2100);}
5689 {setTimeout(function() { press("a2")}, 2200);}
5690 {setTimeout(function() { press("b2")}, 2300);}
5691 {setTimeout(function() { press("c3")}, 2400);}
5692 {setTimeout(function() { press("d3")}, 2500);}
5693 {setTimeout(function() { press("e3")}, 2600);}
5694 {setTimeout(function() { press("f3")}, 2700);}
5695 {setTimeout(function() { press("g3")}, 2800);}
5696 {setTimeout(function() { press("a3")}, 2900);}
5697 {setTimeout(function() { press("b3")}, 3000);}
5698 {setTimeout(function() { press("c4")}, 3100);}
5699 {setTimeout(function() { press("d4")}, 3200);}
5700 {setTimeout(function() { press("e4")}, 3300);}
5701 {setTimeout(function() { press("f4")}, 3400);}
5702 {setTimeout(function() { press("g4")}, 3500);}
5703 {setTimeout(function() { press("a4")}, 3600);}
5704 {setTimeout(function() { press("b4")}, 3700);}
5705 {setTimeout(function() { press("c5")}, 3800);}
5706 {setTimeout(function() { press("d5")}, 3900);}
5707 {setTimeout(function() { press("e5")}, 4000);}
5708 {setTimeout(function() { press("f5")}, 4100);}
5709 {setTimeout(function() { press("g5")}, 4200);}
5710 {setTimeout(function() { press("a5")}, 4300);}
5711 {setTimeout(function() { press("b5")}, 4400);}
5712 {setTimeout(function() { press("c6")}, 4500);}
5713 {setTimeout(function() { press("d6")}, 4600);}
5714 {setTimeout(function() { press("e6")}, 4700);}
5715 {setTimeout(function() { press("f6")}, 4800);}
5716 {setTimeout(function() { press("g6")}, 4900);}
5717 {setTimeout(function() { press("a6")}, 5000);}
5718 {setTimeout(function() { press("b6")}, 5100);}
5719 {setTimeout(function() { press("c7")}, 5200);}
5720 //Glissando
5721
5722 //Glossary
5723
5724 //Music theory
5725
5726 //Meow game
5727 } else if (cmd == cmdChar+"mp") {
5728 if (message.length == cmd.length) {
5729 // Check if user is in Database
5730 mUser = MDB[ids];
5731
5732 // If user isn't create a new entry
5733 if (!mUser) {
5734 mUser = MDB[ids] = {
5735 name: name,
5736 meowP: 0,
5737 meowRate: 1,
5738 meowTime: 0,
5739 meowing: false,
5740 cheeseMaster: false,
5741 inventory: {
5742 string: 1,
5743 yarn: 0,
5744 wool: 0,
5745 water: 0,
5746 milk: 0,
5747 bananaMilk: 0,
5748 cheese: 0
5749 },
5750 prices: {
5751 string: 50,
5752 yarn: 500,
5753 wool: 2000,
5754 water: 15000,
5755 milk: 50000,
5756 bananaMilk: 100000,
5757 cheese: 25000000000
5758 }
5759 };
5760
5761 // Start their timer (no clue if this is correct or what)
5762 setInterval(function() {
5763 MDB[ids].meowP += MDB[ids].meowRate;
5764 ++MDB[ids].meowTime;
5765 }, 1000);
5766
5767 MDB[ids].meowing = true;
5768 sendChat('✯ Meow! Welcome to Meowpuff, ' + name + '! (type '+cmdChar+'meow for help, if you\'re still confused ask Logan x3)✯');
5769 sendChat('MP [' + mUser.meowP + '] MP rate [' + mUser.meowRate + '] Time [' + mUser.meowTime + ' secs | ' + (mUser.meowTime / 86400).toPrecision(4) + ' days]');
5770
5771 } else {
5772 if (!MDB[ids].meowing) {
5773 setInterval(function() {
5774 MDB[ids].meowP += MDB[ids].meowRate;
5775 ++MDB[ids].meowTime;
5776 }, 1000);
5777 if (MDB[ids].cheeseMaster) {
5778 sendChat('Welcome back, [Cheese Master] ' + name + '! Stats successfully loaded.');
5779 } else {
5780 sendChat('Welcome back, ' + name + '. Stats successfully loaded.');
5781 }
5782 MDB[ids].meowing = true;
5783 }
5784
5785 // working ✓
5786 sendChat('MP [' + mUser.meowP + '] MP rate [' + mUser.meowRate + '] Time [' + mUser.meowTime + ' secs | ' + (mUser.meowTime / 86400).toPrecision(4) + ' days]');
5787 }
5788 //else they entered more information
5789 } else {
5790 var target = msg.a.substring(cmd.length).trim();
5791 var part = getUser(target.toLowerCase());
5792 if (part) {
5793 if (!MDB[part._id] || !MDB[part._id].meowing) {
5794 sendChat(part.name+ ' isn\'t playing Meowpuff. They need to type '+cmdChar+'mp to create or load a save');
5795 return;
5796 }
5797
5798 if (part.name == name) {
5799 sendChat('Your MP [' + MDB[ids].meowP + '] MP rate [' + MDB[ids].meowRate + '] Time [' + MDB[ids].meowTime + ' secs | ' + (MDB[ids].meowTime / 86400).toPrecision(4) + ' days]');
5800 return;
5801 }
5802 sendChat(part.name + '\'s MP [' + MDB[part._id].meowP + '] MP rate [' + MDB[part._id].meowRate + '] Time [' + MDB[part._id].meowTime + ' secs | ' + (MDB[part._id].meowTime / 86400).toPrecision(4) + ' days]');
5803 } else {
5804 sendChat(userNotFound);
5805 }
5806 }
5807
5808 //Meow help
5809 } else if (cmd == cmdChar+"meow") {
5810 if (gClient.isOwner()) sendChat('✯ Meow! Need some help with Meowpuff? Buy items to entice kitties to work for you to gain as many Meow Points as possible x3 ✯');
5811 sendChat(''+cmdChar+'meow (shows help) '+cmdChar+'mp (starts game / shows stats after you have started and '+cmdChar+'mp name_here), \
5812 '+cmdChar+'meowshop ('+cmdChar+'mshop item_name_here visit The Cuddle Kitty shop to buy items to increase your MPS), \
5813 '+cmdChar+'meowinventory ('+cmdChar+'minv shows your Meow Points and purchased items and '+cmdChar+'minv name_here), \
5814 '+cmdChar+'meowsave ('+cmdChar+'msave saves game), \
5815 '+cmdChar+'meowtype ('+cmdChar+'mtype gives you a word challenge), \
5816 '+cmdChar+'meowstats ('+cmdChar+'mstats shows total stats for all players)');
5817 //Meow help
5818
5819 //Meow shop
5820 } else if (cmd == cmdChar+"meowshop" || cmd == cmdChar+"mshop") {
5821 if (!MDB[ids].meowing) {
5822 sendChat('You must start the game again with '+cmdChar+'mp before The Cuddle Kitty shop will let you in!');
5823 return;
5824 }
5825 if (message.substring(cmd.length).trim() == '') {
5826 //optimise
5827 if (gClient.isOwner()) sendChat('✯ Meow ' + name + '! Welcome to The Cuddle Kitty shop! If you need help type '+cmdChar+'meow :3 | MP [' + MDB[ids].meowP + '] ✯');
5828 sendChat(name +'\'s shop (string [' + MDB[ids].prices.string + ' MP] +1 MPS for each piece of string owned) \
5829 (yarn [' + MDB[ids].prices.yarn + ' MP] +10 MPS for each piece of yarn owned) \
5830 (wool [' + MDB[ids].prices.wool + ' MP] +40 MPS for each ball of wool owned) \
5831 (water [' + MDB[ids].prices.water + ' MP] +300 MPS for every bowl of water owned) \
5832 (milk [' + MDB[ids].prices.milk + ' MP] +1000 MPS for every tanker of milk owned) \
5833 (banana milk [' + MDB[ids].prices.bananaMilk + ' MP] +2000 MPS for every tanker of banana milk owned) \
5834 (cheese [' + MDB[ids].prices.cheese + ' MP] +2500000000 MPS for each piece of cheese owned)');
5835 return;
5836
5837 // string
5838 } else if (message.substring(cmd.length).trim() == 'string') {
5839 if (MDB[ids].meowP >= MDB[ids].prices.string) { //Do they have enough meow points?
5840 MDB[ids].meowP -= MDB[ids].prices.string; //Take correct price away
5841 MDB[ids].prices.string += 5 * (MDB[ids].inventory.string) + 50; //Up price next time, might make more cruel
5842 MDB[ids].meowRate += 1; //Add the MPS
5843 MDB[ids].inventory.string += 1; //Add the string to inv
5844 sendChat('String added to ' + name + '\'s inventory! Next one will cost [' + MDB[ids].prices.string + ' MP] (' + MDB[ids].inventory.string + ' string in kitty storage) MP [' + MDB[ids].meowP + ']');
5845 } else { //They don't have enough meow points
5846 //return a positive number
5847 sendChat(meowNeP + ' string. You need ' + Math.abs(MDB[ids].meowP - MDB[ids].prices.string) + ' more MP! (' + MDB[ids].inventory.string + ' string in kitty storage) MP [' + MDB[ids].meowP + ']');
5848 }
5849
5850 // yarn
5851 } else if (message.substring(cmd.length).trim() == 'yarn') {
5852 if (MDB[ids].meowP >= MDB[ids].prices.yarn) {
5853 MDB[ids].meowP -= MDB[ids].prices.yarn;
5854 MDB[ids].prices.yarn += 50 * (MDB[ids].inventory.yarn) + 500;
5855 MDB[ids].meowRate += 10;
5856 MDB[ids].inventory.yarn += 1;
5857 sendChat('Yarn added to ' + name + '\'s inventory! Next one will cost [' + MDB[ids].prices.yarn + ' MP] (' + MDB[ids].inventory.yarn + ' yarn in kitty storage) MP [' + MDB[ids].meowP + ']');
5858 } else {
5859 sendChat(meowNeP + ' yarn. You need ' + Math.abs(MDB[ids].meowP - MDB[ids].prices.yarn) + ' more MP! (' + MDB[ids].inventory.yarn + ' yarn in kitty storage) MP [' + MDB[ids].meowP + ']');
5860 }
5861
5862 // wool
5863 } else if (message.substring(cmd.length).trim() == 'wool') {
5864 if (MDB[ids].meowP >= MDB[ids].prices.wool) {
5865 MDB[ids].meowP -= MDB[ids].prices.wool;
5866 MDB[ids].prices.wool += 200 * (MDB[ids].inventory.wool) + 2000;
5867 MDB[ids].meowRate += 40;
5868 MDB[ids].inventory.wool += 1;
5869 sendChat('Wool added to ' + name + '\'s inventory! Next one will cost [' + MDB[ids].prices.wool + ' MP] (' + MDB[ids].inventory.wool + ' wool in kitty storage) MP [' + MDB[ids].meowP + ']');
5870 } else {
5871 sendChat(meowNeP + ' wool. You need ' + Math.abs(MDB[ids].meowP - MDB[ids].prices.wool) + ' more MP! (' + MDB[ids].inventory.wool + ' wool in kitty storage) MP [' + MDB[ids].meowP + ']');
5872 }
5873
5874 // water
5875 } else if (message.substring(cmd.length).trim() == 'water') {
5876 if (MDB[ids].meowP >= MDB[ids].prices.water) {
5877 MDB[ids].meowP -= MDB[ids].prices.water;
5878 MDB[ids].prices.water += 1500 * (MDB[ids].inventory.water) + 15000;
5879 MDB[ids].meowRate += 300;
5880 MDB[ids].inventory.water += 1;
5881 sendChat('Water added to ' + name + '\'s inventory! Next one will cost [' + MDB[ids].prices.water + ' MP] (' + MDB[ids].inventory.water + ' water in kitty storage) MP [' + MDB[ids].meowP + ']');
5882 } else {
5883 sendChat(meowNeP + ' water. You need ' + Math.abs(MDB[ids].meowP - MDB[ids].prices.water) + ' more MP! (' + MDB[ids].inventory.water + ' water in kitty storage) MP [' + MDB[ids].meowP + ']');
5884 }
5885
5886 // milk
5887 } else if (message.substring(cmd.length).trim() == 'milk') {
5888 if (MDB[ids].meowP >= MDB[ids].prices.milk) {
5889 MDB[ids].meowP -= MDB[ids].prices.milk;
5890 MDB[ids].prices.milk += 5000 * (MDB[ids].inventory.milk) + 50000;
5891 MDB[ids].meowRate += 1000;
5892 MDB[ids].inventory.milk += 1;
5893 sendChat('Milk added to ' + name + '\'s inventory! Next one will cost [' + MDB[ids].prices.milk + ' MP] (' + MDB[ids].inventory.milk + ' milk in kitty storage) MP [' + MDB[ids].meowP + ']');
5894 } else {
5895 sendChat(meowNeP + ' milk. You need ' + Math.abs(MDB[ids].meowP - MDB[ids].prices.milk) + ' more MP! (' + MDB[ids].inventory.milk + ' milk in kitty storage) MP [' + MDB[ids].meowP + ']');
5896 }
5897
5898 // banana milk
5899 } else if (message.substring(cmd.length).trim() == 'banana milk') {
5900 if (MDB[ids].meowP >= MDB[ids].prices.bananaMilk) {
5901 MDB[ids].meowP -= MDB[ids].prices.bananaMilk;
5902 MDB[ids].prices.bananaMilk += 10000 * (MDB[ids].inventory.bananaMilk) + 100000;
5903 MDB[ids].meowRate += 2000;
5904 MDB[ids].inventory.bananaMilk += 1;
5905 sendChat('Banana milk added to ' + name + '\'s inventory! Next one will cost [' + MDB[ids].prices.bananaMilk + ' MP] (' + MDB[ids].inventory.bananaMilk + ' banana milk in kitty storage) MP [' + MDB[ids].meowP + ']');
5906 } else {
5907 sendChat(meowNeP + ' banana milk. You need ' + Math.abs(MDB[ids].meowP - MDB[ids].prices.bananaMilk) + ' more MP! (' + MDB[ids].inventory.bananaMilk + ' banana milk in kitty storage) MP [' + MDB[ids].meowP + ']');
5908 }
5909
5910 // cheese
5911 } else if (message.substring(cmd.length).trim() == 'cheese') {
5912 if (MDB[ids].meowP >= MDB[ids].prices.cheese) {
5913 MDB[ids].meowP -= MDB[ids].prices.cheese;
5914 MDB[ids].prices.cheese += 2500000000 * (MDB[ids].inventory.cheese) + 25000000000;
5915 MDB[ids].meowRate += 500000000;
5916 MDB[ids].inventory.cheese += 1;
5917 MDB[ids].cheeseMaster = true;
5918 sendChat('✯ Cheese added to ' + name + '\'s inventory! Next one will cost [' + MDB[ids].prices.cheese + ' MP] (' + MDB[ids].inventory.cheese + ' cheese in kitty storage) MP [' + MDB[ids].meowP + '] ✯');
5919 } else {
5920 sendChat(meowNeP + ' cheese. You need a whopping ' + Math.abs(MDB[ids].meowP - MDB[ids].prices.cheese) + ' more MP! (' + MDB[ids].inventory.cheese + ' cheese in kitty storage) MP [' + MDB[ids].meowP + ']');
5921 }
5922 }
5923
5924 //item prices: 250000
5925
5926 // kitty storage
5927 } else if (cmd == cmdChar+"meowinventory" || cmd == cmdChar+"minv") {
5928 if (message.length == cmd.length) {
5929 if (!MDB[ids].meowing) {
5930 sendChat('You must start the game again with '+cmdChar+'mp before kitty storage is setup!');
5931 return;
5932 }
5933 if(gClient.isOwner()) sendChat('✯ Meow! Welcome to Kitty Storage! This is where we keep all your purchased items :3 MP [' + MDB[ids].meowP + '] ✯');
5934 sendChat('MP [' + MDB[ids].meowP + '] (string ' + MDB[ids].inventory.string + ') (yarn ' + MDB[ids].inventory.yarn + ') (wool ' + MDB[ids].inventory.wool + ') (water ' + MDB[ids].inventory.water + ') (milk ' + MDB[ids].inventory.milk + ') (banana milk ' + MDB[ids].inventory.bananaMilk + ') (cheese ' + MDB[ids].inventory.cheese + ')');
5935
5936 } else {
5937 var target = msg.a.substring(cmd.length).trim();
5938 var part = getUser(target.toLowerCase());
5939
5940 if (part) {
5941 if (!MDB[part._id] || !MDB[part._id].meowing) {
5942 sendChat(part.name+ ' isn\'t playing Meowpuff. They need to type '+cmdChar+'mp to create or load a save');
5943 return;
5944 }
5945
5946 if (part.name == name) {
5947 sendChat('Your MP [' + MDB[ids].meowP + '] (string ' + MDB[ids].inventory.string + ') (yarn ' + MDB[ids].inventory.yarn + ') (wool ' + MDB[ids].inventory.wool + ') (water ' + MDB[ids].inventory.water + ') (milk ' + MDB[ids].inventory.milk + ') (banana milk ' + MDB[ids].inventory.bananaMilk + ') (cheese ' + MDB[ids].inventory.cheese + ')');
5948 return;
5949 }
5950 sendChat(part.name+'\'s MP [' + MDB[part._id].meowP + '] (string ' + MDB[part._id].inventory.string + ') (yarn ' + MDB[part._id].inventory.yarn + ') (wool ' + MDB[part._id].inventory.wool + ') (water ' + MDB[part._id].inventory.water + ') (milk ' + MDB[part._id].inventory.milk + ') (banana milk ' + MDB[part._id].inventory.bananaMilk + ') (cheese ' + MDB[part._id].inventory.cheese + ')');
5951
5952 } else {
5953 sendChat(userNotFound);
5954 }
5955 }
5956 //Meow save
5957 } else if (cmd == cmdChar+"meowsave" || cmd == cmdChar+"msave") { //notes: I need to set the meowing property to false for all when saving so I use meowing as a check for the timer too!
5958 try {
5959 L.MDB = MDB.toString(); //saves everyone for simplicity
5960 // get the number of people playing
5961 var played = 0;
5962 var playing = 0;
5963 var totalDays = 0;
5964 for (var id in MDB) {
5965 if (MDB[id].meowing) ++playing;
5966 if (!MDB[id].meowing) ++played;
5967 totalDays += MDB[id].meowTime;
5968 }
5969
5970 sendChat('Everyones stats have been saved! [playing: ' + playing + ', total players: ' + played + ' | ' + (totalDays / 86400).toPrecision(4) + ' total days]');
5971
5972 } catch (e) {
5973 sendChat('[There was an error in your code!] You need to start the game before you can play! (type '+cmdChar+'mp) err[' + e + ']'); // this probably won't happen
5974 }
5975 //Meow save
5976
5977 //Meow copy sentence mini-game
5978 } else if (cmd == cmdChar+"meowtype" || cmd == cmdChar+"mtype") {
5979 if (!askedEnglish) {
5980 Array.prototype.random = function(a){ //thanks SomeGuy for prototype
5981 if(this){
5982 var b = Math.floor(Math.random() * this.length);
5983 return this[b];
5984 }
5985 }
5986
5987 // arrays
5988 var colours = ["red", "orange", "yellow", "green", "blue", "purple", "gray", "black", "white"];
5989 var conjunctions = ["for", "and", "but", "or", "yet", "so", "after", "as long as", "before", "by the time", "now that", "once", "since", "till", "until", "when", "whenever", "while", "even if", "than", "rather than", "because", "why", "if", "only if", "unless", "assuming that", "in which case"];
5990 var verbs = ["accept", "ache", "acknowledge", "act", "add", "admire", "admit", "admonish", "advise", "adopt", "affirm", "afford", "agree", "ail", "alert", "allege", "allow", "allude", "amuse", "analyse", "announce", "annoy", "answer", "apologize", "appeal", "appear", "applaud", "appreciate", "approve", "argue", "arrange", "arrest", "arrive", "articulate", "ask", "assert", "assure", "attach", "attack", "attempt", "attend", "attract", "auction", "avoid", "avow", "awake", "babble", "back", "bake", "balance", "balk", "ban", "bang", "bandage", "bar", "bare", "bargain", "bark", "barrage", "barter", "baste", "bat", "bathe", "battle", "bawl", "be", "beam", "bear", "beat", "become", "befriend", "beg", "begin", "behave", "believe", "bellow", "belong", "bend", "berate", "besiege", "bestow", "bet", "bid", "bite", "bleach", "bleed", "bless", "blind", "blink", "blot", "blow", "blurt", "blush", "boast", "bob", "boil", "bolt", "bomb", "book", "bore", "borrow", "bounce", "bow", "box", "brag", "brake", "branch", "brand", "break", "breathe", "breed", "bring", "broadcast", "broil", "bruise", "brush", "bubble", "build", "bump", "burn", "burnish", "bury", "buy", "buzz", "cajole", "calculate", "call", "camp", "care", "carry", "carve", "cause", "caution", "catch", "challenge", "change", "chant", "charge", "chase", "cheat", "check", "cheer", "chew", "chide", "chip", "choke", "chomp", "choose", "chop", "claim", "clap", "clean", "clear", "climb", "clip", "close", "coach", "coil", "collect", "color", "comb", "come", "comfort", "command", "comment", "communicate", "compare", "compete", "complain", "complete", "concede", "concentrate", "concern", "conclude", "concur", "confess", "confide", "confirm", "connect", "consent", "consider", "consist", "contain", "contend", "continue", "cook", "copy", "correct", "cost", "cough", "count", "counter", "cover", "covet", "crack", "crash", "crave", "crawl", "crochet", "cross", "criticize", "croak", "cross-examine", "crowd", "crush", "cry", "cure", "curl", "curse", "curve", "cut", "cycle", "dam", "damage", "dance", "dare", "deal", "debate", "decay", "deceive", "decide", "decipher", "declare", "decorate", "delay", "delight", "deliver", "demand", "deny", "depend", "describe", "desert", "deserve", "desire", "deter", "develop", "dial", "dictate", "die", "dig", "digress", "direct", "disclose", "dislike", "dive", "divide", "divorce", "divulge", "do", "dock", "dole", "dote", "double", "doubt", "drag", "drain", "draw", "dream", "dress", "drip", "drill", "drink", "drive", "drone", "drop", "drown", "dry", "dupe", "dump", "dust", "dye", "earn", "eat", "echo", "edit", "educate", "elope", "embarrass", "emigrate", "emit", "emphasise", "employ", "empty", "enchant", "encode", "encourage", "end", "enjoin", "enjoy", "enter", "entertain", "enunciate", "envy", "equivocate", "escape", "evacuate", "evaporate", "exaggerate", "examine", "excite", "exclaim", "excuse", "exercise", "exist", "expand", "expect", "expel", "exhort", "explain", "explode", "explore", "extend", "extoll", "face", "fade", "fail", "fall", "falter", "fasten", "favor", "fax", "fear", "feed", "feel", "fence", "fetch", "fight", "file", "fill", "film", "find", "fire", "fish", "fit", "fix", "flap", "flash", "flee", "float", "flood", "floss", "flow", "flower", "fly", "fold", "follow", "fool", "force", "foretell", "forget", "forgive", "form", "found", "frame", "freeze", "fret", "frighten", "fry", "fume", "garden", "gasp", "gather", "gaze", "gel", "get", "gild", "give", "glide", "glue", "gnaw", "go", "grab", "grate", "grease", "greet", "grill", "grin", "grip", "groan", "grow", "growl", "grumble", "grunt", "guarantee", "guard", "guess", "guide", "gurgle", "gush", "hail", "hammer", "hand", "handle", "hang", "happen", "harass", "harm", "harness", "hate", "haunt", "have", "head", "heal", "heap", "hear", "heat", "help", "hide", "highlight", "hijack", "hinder", "hint", "hiss", "hit", "hold", "hook", "hoot", "hop", "hope", "hover", "howl", "hug", "hum", "hunt", "hurry", "hurt", "ice", "identify", "ignore", "imagine", "immigrate", "imply", "implore", "impress", "improve", "include", "increase", "infect", "inflate", "influence", "inform", "infuse", "inject", "injure", "inquire", "insist", "inspect", "inspire", "instruct", "intend", "interest", "interfere", "interject", "interrupt", "introduce", "invent", "invest", "invite", "irritate", "iron", "itch", "jab", "jabber", "jail", "jam", "jeer", "jest", "jog", "join", "joke", "jolt", "judge", "juggle", "jump", "keep", "kick", "kill", "kiss", "kneel", "knit", "knock", "knot", "know", "label", "lament", "land", "last", "laugh", "lay", "lead", "lean", "learn", "leave", "lecture", "lend", "let", "level", "license", "lick", "lie", "lift", "light", "lighten", "like", "list", "listen", "live", "load", "loan", "lock", "long", "look", "loosen", "lose", "love", "lower", "mail", "maintain", "make", "man", "manage", "mar", "march", "mark", "marry", "marvel", "mate", "matter", "mean", "measure", "meet", "melt", "memorise", "mend", "mention", "merge", "milk", "mine", "miss", "mix", "moan", "moor", "mourn", "molt", "move", "mow", "mug", "multiply", "mumble", "murder", "mutter", "nag", "nail", "name", "nap", "need", "nest", "nod", "note", "notice", "number", "obey", "object", "observe", "obtain", "occur", "offend", "offer", "ogle", "oil", "omit", "open", "operate", "order", "overflow", "overrun", "owe", "own", "pack", "pad", "paddle", "paint", "pant", "park", "part", "pass", "paste", "pat", "pause", "pay", "peck", "pedal", "peel", "peep", "peer", "peg", "pelt", "perform", "permit", "pester", "pet", "phone", "pick", "pinch", "pine", "place", "plan", "plant", "play", "plead", "please", "pledge", "plow", "plug", "point", "poke", "polish", "ponder", "pop", "possess", "post", "postulate", "pour", "practice", "pray", "preach", "precede", "predict", "prefer", "prepare", "present", "preserve", "press", "pretend", "prevent", "prick", "print", "proceed", "proclaim", "produce", "profess", "program", "promise", "propose", "protect", "protest", "provide", "pry", "pull", "pump", "punch", "puncture", "punish", "push", "put", "question", "quilt", "quit", "quiz", "quote", "race", "radiate", "rain", "raise", "rant", "rain", "rate", "rave", "reach", "realise", "read", "rebuff", "recall", "receive", "recite", "recognise", "recommend", "record", "reduce", "reflect", "refuse", "regret", "reign", "reiterate", "reject", "rejoice", "relate", "relax", "release", "rely", "remain", "remember", "remind", "remove", "repair", "repeat", "replace", "reply", "report", "reprimand", "reproduce", "request", "rescue", "retire", "retort", "return", "reveal", "reverse", "rhyme", "ride", "ring", "rinse", "rise", "risk", "roar", "rob", "rock", "roll", "rot", "row", "rub", "ruin", "rule", "run", "rush", "sack", "sail", "satisfy", "save", "savor", "saw", "say", "scare", "scatter", "scoff", "scold", "scoot", "scorch", "scrape", "scratch", "scream", "screech", "screw", "scribble", "seal", "search", "see", "sell", "send", "sense", "separate", "serve", "set", "settle", "sever", "sew", "shade", "shampoo", "share", "shave", "shelter", "shift", "shiver", "shock", "shoot", "shop", "shout", "show", "shriek", "shrug", "shut", "sigh", "sign", "signal", "sin", "sing", "singe", "sip", "sit", "skate", "skateboard", "sketch", "ski", "skip", "slap", "sleep", "slice", "slide", "slip", "slow", "smash", "smell", "smile", "smoke", "snap", "snarl", "snatch", "sneak", "sneer", "sneeze", "snicker", "sniff", "snore", "snort", "snoop", "snooze", "snow", "soak", "sob", "soothe", "sound", "sow", "span", "spare", "spark", "sparkle", "speak", "speculate", "spell", "spend", "spill", "spin", "spoil", "spot", "spray", "sprout", "sputter", "squash", "squeeze", "stab", "stain" ,"stammer", "stamp", "stand", "star", "stare", "start", "state", "stay", "steer", "step", "stipulate", "stir", "stitch", "stop", "store", "strap", "storm", "stow", "strengthen", "stress", "stretch", "strip", "stroke", "stuff", "stutter", "stray", "strum", "strut", "stun", "stunt", "submerge", "succeed", "suffer", "suggest", "suit", "supply", "support", "suppose", "surmise", "surprise", "surround", "suspect", "suspend", "sway", "swear", "swim", "swing", "switch", "swoop", "sympathize", "talk", "take", "tame", "tap", "taste", "taunt", "teach", "tear", "tease", "telephone", "tell", "tempt", "terrify", "test", "testify", "thank", "thaw", "theorize", "think", "threaten", "throw", "thunder", "tick", "tickle", "tie", "time", "tip", "tire", "toast", "toss", "touch", "tour", "tow", "trace", "track", "trade", "train", "translate", "transport", "trap", "travel", "treat", "tremble", "trick", "trickle", "trim", "trip", "trot", "trouble", "trust", "trounce", "try", "tug", "tumble", "turn", "twist", "type", "understand", "undress", "unfasten", "unite", "unlock", "unpack", "uphold", "upset", "upstage", "urge", "untie", "use", "usurp", "utter", "vacuum", "value", "vanish", "vanquish", "venture", "visit", "voice", "volunteer", "vote", "vouch", "wail", "wait", "wake", "walk", "wallow", "wander", "want", "warm", "warn", "wash", "waste", "watch", "water", "wave", "waver", "wear", "weave", "wed", "weigh", "welcome", "whimper", "whine", "whip", "whirl", "whisper", "whistle", "win", "wink", "wipe", "wish", "wobble", "wonder", "work", "worry", "wrap", "wreck", "wrestle", "wriggle", "write", "writhe", "x-ray", "yawn", "yell", "yelp", "yield", "yodel", "zip", "zoom"];
5991 var determiners = ["the", "a", "another", "some", "any", "my", "our", "their", "her", "his", "its", "each", "every", "certain", "this", "that"];
5992 var nouns = ["account", "achiever", "acoustics", "act", "action", "activity", "actor", "addition", "adjustment", "advertisement", "advice", "aftermath", "afternoon", "afterthought", "agreement", "air", "airplane", "airport", "alarm", "amount", "amusement", "anger", "angle", "animal", "answer", "ant", "ants", "apparatus", "apparel", "apple", "apples", "appliance", "approval", "arch", "argument", "arithmetic", "arm", "army", "art", "attack", "attempt", "attention", "attraction", "aunt", "authority", "babies", "baby", "back", "badge", "bag", "bait", "balance", "ball", "balloon", "balls", "banana", "band", "base", "baseball", "basin", "basket", "basketball", "bat", "bath", "battle", "bead", "beam", "bean", "bear", "bears", "beast", "bed", "bedroom", "beds", "bee", "beef", "beetle", "beggar", "beginner", "behaviour", "belief", "believe", "bell", "bells", "berry", "bike", "bikes", "bird", "birds", "birth", "birthday", "bit", "bite", "blade", "blood", "blow", "board", "boat", "boats", "body", "bomb", "bone", "book", "books", "boot", "border", "bottle", "boundary", "box", "boy", "boys", "brain", "brake", "branch", "brass", "bread", "breakfast", "breath", "brick", "bridge", "brother", "brothers", "brush", "bubble", "bucket", "building", "bulb", "bun", "burn", "burst", "bushes", "business", "butter", "button", "cabbage", "cable", "cactus", "cake", "cakes", "calculator", "calendar", "camera", "camp", "can", "cannon", "canvas", "cap", "caption", "car", "card", "care", "carpenter", "carriage", "cars", "cart", "cast", "cat", "cats", "cattle", "cause", "cave", "celery", "cellar", "cemetery", "cent", "chain", "chair", "chairs", "chalk", "chance", "change", "channel", "cheese", "cherries", "cherry", "chess", "chicken", "chickens", "children", "chin", "church", "circle", "clam", "class", "clock", "clocks", "cloth", "cloud", "clouds", "clover", "club", "coach", "coal", "coast", "coat", "cobweb", "coil", "collar", "color", "comb", "comfort", "committee", "company", "comparison", "competition", "condition", "connection", "control", "cook", "copper", "copy", "cord", "cork", "corn", "cough", "country", "cover", "cow", "cows", "crack", "cracker", "crate", "crayon", "cream", "creator", "creature", "credit", "crib", "crime", "crook", "crow", "crowd", "crown", "crush", "cry", "cub", "cup", "current", "curtain", "curve", "cushion", "dad", "daughter", "day", "death", "debt", "decision", "deer", "degree", "design", "desire", "desk", "destruction", "detail", "development", "digestion", "dime", "dinner", "dinosaurs", "direction", "dirt", "discovery", "discussion", "disease", "disgust", "distance", "distribution", "division", "dock", "doctor", "dog", "dogs", "doll", "dolls", "donkey", "door", "downtown", "drain", "drawer", "dress", "drink", "driving", "drop", "drug", "drum", "duck", "ducks", "dust", "ear", "earth", "earthquake", "edge", "education", "effect", "egg", "eggnog", "eggs", "elbow", "end", "engine", "error", "event", "example", "exchange", "existence", "expansion", "experience", "expert", "eye", "eyes", "face", "fact", "fairies", "fall", "family", "fan", "fang", "farm", "farmer", "father", "faucet", "fear", "feast", "feather", "feeling", "feet", "fiction", "field", "fifth", "fight", "finger", "fire", "fireman", "fish", "flag", "flame", "flesh", "flight", "flock", "floor", "flower", "flowers", "fly", "fog", "fold", "food", "foot", "force", "fork", "form", "fowl", "frame", "friction", "friend", "friends", "frog", "frogs", "front", "fruit", "fuel", "furniture", "alley", "game", "garden", "gate", "geese", "ghost", "giants", "giraffe", "girl", "girls", "glass", "glove", "glue", "goat", "gold", "goldfish", "good-bye", "goose", "government", "governor", "grade", "grain", "grandfather", "grandmother", "grape", "grass", "grip", "ground", "group", "growth", "guide", "guitar", "gun", "hair", "haircut", "hall", "hammer", "hand", "hands", "harmony", "hat", "hate", "head", "health", "hearing", "heart", "heat", "help", "hen", "hill", "history", "hobbies", "hole", "holiday", "home", "honey", "hook", "hope", "horn", "horse", "horses", "hose", "hospital", "hot", "hour", "house", "houses", "humour", "hydrant", "ice", "icicle", "idea", "impulse", "income", "increase", "industry", "ink", "insect", "instrument", "insurance", "interest", "invention", "iron", "island", "jail", "jam", "jar", "jeans", "jelly", "jellyfish", "jewel", "join", "joke", "journey", "judge", "juice", "jump", "K", "kettle", "key", "kick", "kiss", "kite", "kitten", "kittens", "kitty", "knee", "knife", "knot", "knowledge", "labourer", "lace", "ladybug", "lake", "lamp", "land", "language", "laugh", "lawyer", "lead", "leaf", "learning", "leather", "leg", "legs", "letter", "letters", "lettuce", "level", "library", "lift", "light", "limit", "line", "linen", "lip", "liquid", "list", "lizards", "loaf", "lock", "locket", "look", "loss", "love", "low", "lumber", "lunch", "lunchroom", "machine", "magic", "maid", "mailbox", "man", "manager", "map", "marble", "mark", "market", "mask", "mass", "match", "meal", "measure", "meat", "meeting", "memory", "men", "metal", "mice", "middle", "milk", "mind", "mine", "minister", "mint", "minute", "mist", "mitten", "mom", "money", "monkey", "month", "moon", "morning", "mother", "motion", "mountain", "mouth", "move", "muscle", "music", "nail", "name", "nation", "neck", "need", "needle", "nerve", "nest", "net", "news", "night", "noise", "north", "nose", "note", "notebook", "number", "nut", "oatmeal", "observation", "ocean", "offer", "office", "oil", "operation", "opinion", "orange", "oranges", "order", "organization", "ornament", "oven", "owl", "owner", "P", "page", "pail", "pain", "paint", "pan", "pancake", "paper", "parcel", "parent", "park", "part", "partner", "party", "passenger", "paste", "patch", "payment", "peace", "pear", "pen", "pencil", "person", "pest", "pet", "pets", "pickle", "picture", "pie", "pies", "pig", "pigs", "pin", "pipe", "pizzas", "place", "plane", "planes", "plant", "plantation", "plants", "plastic", "plate", "play", "playground", "pleasure", "plot", "plough", "pocket", "point", "poison", "police", "polish", "pollution", "popcorn", "porter", "position", "pot", "potato", "powder", "power", "price", "print", "prison", "process", "produce", "profit", "property", "prose", "protest", "pull", "pump", "punishment", "purpose", "push", "quarter", "quartz", "queen", "question", "quicksand", "quiet", "quill", "quilt", "quince", "quiver", "rabbit", "rabbits", "rail", "railway", "rain", "rainstorm", "rake", "range", "rat", "rate", "ray", "reaction", "reading", "reason", "receipt", "recess", "record", "regret", "relation", "religion", "representative", "request", "respect", "rest", "reward", "rhythm", "rice", "riddle", "rifle", "ring", "rings", "river", "road", "robin", "rock", "rod", "roll", "roof", "room", "root", "rose", "route", "rub", "rule", "run", "sack", "sail", "salt", "sand", "scale", "scarecrow", "scarf", "scene", "scent", "school", "science", "scissors", "screw", "sea", "seashore", "seat", "secretary", "seed", "selection", "self", "sense", "servant", "shade", "shake", "shame", "shape", "sheep", "sheet", "shelf", "ship", "shirt", "shock", "shoe", "shoes", "shop", "show", "side", "sidewalk", "sign", "silk", "silver", "sink", "sister", "sisters", "size", "skate", "skin", "skirt", "sky", "slave", "sleep", "sleet", "slip", "slope", "smash", "smell", "smile", "smoke", "snail", "snails", "snake", "snakes", "sneeze", "snow", "soap", "society", "sock", "soda", "sofa", "son", "song", "songs", "sort", "sound", "soup", "space", "spade", "spark", "spiders", "sponge", "spoon", "spot", "spring", "spy", "square", "squirrel", "stage", "stamp", "star", "start", "statement", "station", "steam", "steel", "stem", "step", "stew", "stick", "sticks", "stitch", "stocking", "stomach", "stone", "stop", "store", "story", "stove", "stranger", "straw", "stream", "street", "stretch", "string", "structure", "substance", "sugar", "suggestion", "suit", "summer", "sun", "support", "surprise", "sweater", "swim", "swing", "system", "table", "tail", "talk", "tank", "taste", "tax", "teaching", "team", "teeth", "temper", "tendency", "tent", "territory", "test", "texture", "theory", "thing", "things", "thought", "thread", "thrill", "throat", "throne", "thumb", "thunder", "ticket", "tiger", "time", "tin", "title", "toad", "toe", "toes", "tomatoes", "tongue", "tooth", "toothbrush", "toothpaste", "top", "touch", "town", "toy", "toys", "trade", "trail", "train", "trains", "tramp", "transport", "tray", "treatment", "tree", "trees", "trick", "trip", "trouble", "trousers", "truck", "trucks", "tub", "turkey", "turn", "twig", "twist", "umbrella", "uncle", "underwear", "unit", "use", "vacation", "value", "van", "vase", "vegetable", "veil", "vein", "verse", "vessel", "vest", "view", "visitor", "voice", "volcano", "volleyball", "voyage", "walk", "wall", "war", "wash", "waste", "watch", "water", "wave", "waves", "wax", "way", "wealth", "weather", "week", "weight", "wheel", "whip", "whistle", "wilderness", "wind", "window", "wine", "wing", "winter", "wire", "wish", "woman", "women", "wood", "wool", "word", "work", "worm", "wound", "wren", "wrench", "wrist", "writer", "writing", "yak", "yam", "yard", "yarn", "year", "yoke", "zebra", "zephyr", "zinc", "zipper", "zoo"];
5993 var adjectives = ["angry", "bewildered", "clumsy", "defeated", "embarrassed", "fierce", "grumpy", "helpless", "itchy", "jealous", "lazy", "mysterious", "nervous", "obnoxious", "panicky", "repulsive", "scary", "thoughtless", "uptight", "worried", "alive", "better", "careful", "clever", "dead", "easy", "famous", "gifted", "helpful", "important", "inexpensive", "mushy", "odd", "powerful", "rich", "shy", "tender", "uninterested", "vast", "wrong", "adorable", "beautiful", "clean", "drab", "elegant", "fancy", "glamorous", "handsome", "long", "magnificent", "old-fashioned", "plain", "quaint", "sparkling", "ugliest", "unsightly", "wide-eyed", "deafening", "faint", "hissing", "loud", "melodic", "noisy", "purring", "quiet", "raspy", "screeching", "thundering", "voiceless", "whispering", "big", "colossal", "fat", "gigantic", "great", "huge", "immense", "large", "little", "mammoth", "massive", "miniature", "petite", "puny", "scrawny", "short", "small", "tall", "teeny", "teeny-tiny", "tiny", "broad", "chubby", "crooked", "curved", "deep", "flat", "high", "hollow", "low", "narrow", "round", "shallow", "skinny", "square", "steep", "straight", "wide", "agreeable", "brave", "calm", "delightful", "eager", "faithful", "gentle", "happy", "jolly", "kind", "lively", "nice", "obedient", "proud", "relieved", "silly", "thankful", "victorious", "witty", "zealous", "abundant", "empty", "few", "full", "heavy", "light", "many", "numerous", "sparse", "substantial", "boiling", "breeze", "broken", "bumpy", "chilly", "cold", "cool", "creepy", "crooked", "cuddly", "curly", "damaged", "damp", "dirty", "dry", "dusty", "filthy", "flaky", "fluffy", "freezing", "hot", "warm", "wet", "bitter", "delicious", "fresh", "greasy", "juicy", "hot", "icy", "loose", "melted", "nutritious", "prickly", "rainy", "rotten", "salty", "sticky", "strong", "sweet", "tart", "tasteless", "uneven", "weak", "wet", "wooden", "yummy", "ancient", "brief", "early", "fast", "late", "long", "modern", "old", "old-fashioned", "quick", "rapid", "short", "slow", "swift", "young"];
5994
5995 //consider cleaning up this code when you have free time
5996
5997 try {
5998 if (!hardEnglish) {
5999 //easy (normal)
6000 var str = determiners.random() + " " + adjectives.random() + " " + verbs.random() + " " + nouns.random() + " " + conjunctions.random() + " " + verbs.random() + " " + nouns.random() + " " + verbs.random() + ".";
6001 sentence = capitalizeFirstLetter(str);
6002 var antiCopy = sentence.split(" ").join(" \u034f\uFFFC");
6003 sentenceAntiCopy = capitalizeFirstLetter(antiCopy);
6004 }
6005 if (hardEnglish) {
6006 //hard (test)
6007 var str = randStr(hardLength);
6008 sentence = str;
6009 var antiCopy = sentence.split("").join("\u034f\uFFFC");
6010 sentenceAntiCopy = antiCopy;
6011 }
6012 sendChat("First person to type this wins: " + sentenceAntiCopy);
6013
6014 } catch(e) {
6015 sendChat('Error in my code: ' + e);
6016 }
6017 askedEnglish = true;
6018
6019 } else {
6020 sendChat("To answer, type the following in chat: " + sentenceAntiCopy);
6021 }
6022
6023 } else if (cmd == cmdChar+"mstats") {
6024 var mp = 0;
6025 var mr = 0;
6026
6027 var string = 0;
6028 var yarn = 0;
6029 var wool = 0;
6030 var water = 0;
6031 var milk = 0;
6032 var bananaMilk = 0;
6033 var cheese = 0;
6034
6035 for (var id in MDB) {
6036 mp += parseInt(MDB[id].meowP);
6037 mr += MDB[id].meowRate;
6038
6039 string += MDB[id].inventory.string;
6040 yarn += MDB[id].inventory.yarn;
6041 wool += MDB[id].inventory.wool;
6042 water += MDB[id].inventory.water;
6043 milk += MDB[id].inventory.milk;
6044 bananaMilk += MDB[id].inventory.bananaMilk;
6045 cheese += MDB[id].inventory.cheese;
6046 }
6047
6048 sendChat("Meowpuff total stats: MP ["+mp+"], MPS ["+mr+"], string ["+string+"], \
6049 yarn ["+yarn+"], wool ["+wool+"], water ["+water+"], milk ["+milk+"], \
6050 banana milk ["+bananaMilk+"], cheese ["+cheese+"].");
6051
6052 //Meow game
6053
6054 // Math *warning* messy code below, brace yourself.
6055 } else if (cmd == cmdChar+"mathhelp") {
6056 sendChat("Math commands: "+cmdChar+"math (for answering/getting new question), "+cmdChar+"mathskip (skips tough/glitched questions), "+cmdChar+"mathdiff (difficulty setting. pick between: 0 very easy, 1 easy, 2 medium, 3 hard and 4 insane 5 asian)");
6057
6058 } else if (cmd == cmdChar+"mathdiff") {
6059 if (message.substring(9).trim() == "" || isNaN(message.substring(9).trim()) || message.substring(9).trim() < -1 || message.substring(9).trim() > 5) {
6060 sendChat("Usage: "+cmdChar+"mathdiff 1 (0 = very easy, 1 = easy, 2 = medium, 3 = hard, 4 = insane)");
6061 } else {
6062 mathDiff = message.substring(9).trim();
6063 if (mathDiff == 0) {
6064 mathDiffTxt = "Very Easy \"Piki-Mode\"";
6065 }
6066 if (mathDiff == 1) {
6067 mathDiffTxt = "Easy";
6068 }
6069 if (mathDiff == 2) {
6070 mathDiffTxt = "Medium";
6071 }
6072 if (mathDiff == 3) {
6073 mathDiffTxt = "Hard";
6074 }
6075 if (mathDiff == 4) {
6076 mathDiffTxt = "Insane";
6077 }
6078 if (mathDiff == 5) {
6079 mathDiffTxt = "Asian";
6080 }
6081 if (mathDiff == -1) {
6082 mathDiffTxt = "The Answer to Life, the Universe, and Everything *cough cough*";
6083 }
6084
6085 sendChat(name + " set the difficulty to " + mathDiffTxt);
6086 asked = false;
6087 }
6088
6089 } else if (cmd == cmdChar+"math") {
6090 if (message.length > 5 && !asked) {
6091 return; //might remove if typing !math 69 bringing up a questions seems easier
6092 }
6093 // difficulty settings
6094 if (mathDiff == 0) {
6095 questions = [randNum(1,10) + " + " + randNum(1,10),
6096 randNum(1,10) + " - " + randNum(1,10),
6097 randNum(1,10) + " - " + randNum(1,10)];
6098 pickQuestion = Math.floor( Math.random() * questions.length );
6099 }
6100
6101 if (mathDiff == 1) {
6102 questions = [randNum(1,50) + " + " + randNum(1,20),
6103 randNum(1,50) + " - " + randNum(1,10),
6104 randNum(1,20) + " * " + randNum(1,2),
6105 randNum(1,20) + " % " + randNum(1,2)];
6106 pickQuestion = Math.floor( Math.random() * questions.length );
6107 }
6108
6109 if (mathDiff == 2) {
6110 questions = [randNum(1,100) + " + " + randNum(1,20),
6111 randNum(1,100) + " - " + randNum(1,20),
6112 randNum(1,20) + " * " + randNum(1,10),
6113 randNum(1,50) + " % " + randNum(1,10)];
6114 pickQuestion = Math.floor( Math.random() * questions.length );
6115 }
6116
6117 if (mathDiff == 3) {
6118 questions = [randNum(1,400) + " + " + randNum(1,20),
6119 randNum(1,400) + " - " + randNum(1,300),
6120 randNum(1,100) + " * " + randNum(1,50),
6121 randNum(1,100) + " % " + randNum(1,50)];
6122 pickQuestion = Math.floor( Math.random() * questions.length );
6123 }
6124
6125 if (mathDiff == 4) {
6126 questions = [randNum(1,1000) + " + " + randNum(1,100),
6127 randNum(1,1000) + " - " + randNum(1,100),
6128 randNum(1,1000) + " * " + randNum(1,100)];
6129 pickQuestion = Math.floor( Math.random() * questions.length );
6130 }
6131
6132 if (mathDiff == 5) {
6133 questions = [randNum(-10000000,10000000) + " + " + randNum(-10000000,10000000),
6134 randNum(-10000000,10000000) + " - " + randNum(-10000000,10000000),
6135 randNum(-10000000,10000000) + " * " + randNum(-10000000,10000000),
6136 randNum(-10000000,10000000) + " / " + randNum(-10000000,10000000),
6137 randNum(-10000000,10000000) + " % " + randNum(-10000000,10000000)];
6138 pickQuestion = Math.floor( Math.random() * questions.length );
6139 }
6140
6141 if (mathDiff == -1) {
6142 questions = [randNum(1,400) + " + " + randNum(1,20),
6143 randNum(1,400) + " - " + randNum(1,300),
6144 randNum(1,400) + " * " + randNum(1,50)];
6145 pickQuestion = Math.floor( Math.random() * questions.length );
6146 }
6147
6148 // difficulty settings
6149 if (!asked) {
6150 // life easter egg
6151 if (mathDiff == -1) {
6152 question = questions[pickQuestion];
6153 while (eval(question) != 42) {
6154 questions = [randNum(1,400) + " + " + randNum(1,400),
6155 randNum(1,400) + " - " + randNum(1,400),
6156 randNum(1,400) + " * " + randNum(1,400)];
6157
6158 pickQuestion = Math.floor( Math.random() * questions.length );
6159 question = questions[pickQuestion];
6160 }
6161
6162 sendChat("What\u034f i\u034fs " + question + "\u034f? (to answer type "+cmdChar+"math <answer>). Difficulty - " + mathDiffTxt);
6163 asked = true;
6164
6165 // cheater >:3
6166 if (mathCheat) setTimeout( function() { MPP.chat.send(""+cmdChar+"math " + eval(question)) }, randNum(1000, 2500));
6167
6168 } else {
6169 question = questions[pickQuestion]; //fix impossible answers
6170 //sendChat("What is " + question + "? (to answer type !math <answer>). Difficulty - " + mathDiffTxt);
6171 sendChat("What\u034f i\u034fs " + question + "\u034f? (to answer type "+cmdChar+"math <answer>). Difficulty - " + mathDiffTxt);
6172 asked = true;
6173
6174 // cheater >:3
6175 if (mathCheat) setTimeout( function() { MPP.chat.send(""+cmdChar+"math " + eval(question)) }, randNum(1000, 2500));
6176 }
6177
6178 } else {
6179 if (message.substring(5).trim() == eval(question)) {
6180 sendChat(name + " answered correctly with " + message.substring(5).trim() + " on " + mathDiffTxt + " difficulty (questions answered " + ++mathAnswered +")");
6181 asked = false;
6182 } else {
6183 sendChat("Try again, " + name + ". The question was " + question + ". Too hard? Type "+cmdChar+"mathhelp");
6184 // cheater >:3
6185 if (mathCheat) setTimeout( function() { MPP.chat.send(cmdChar+"math " + eval(question)) }, randNum(1000, 2500));
6186 }
6187 }
6188
6189 } else if (cmd == cmdChar+"mathskip") {
6190 asked = false;
6191 sendChat("Skipping question. (questions skipped " + ++mathSkipped + ")");
6192
6193 } else if (cmd == cmdChar+"meth") {
6194 sendChat('Did you mean '+cmdChar+'"math"?');
6195
6196 // unit conversions start
6197
6198 } else if (cmd == cmdChar+"unitc") {
6199 sendChat("Unit Conversions: "+cmdChar+"ctof (celsius to fahrenheit), "+cmdChar+"ftoc (fahrenheit to celsius), "+cmdChar+"cmtoinch (centimetres to inches), "+cmdChar+"inchtocm (inches to centimetres), "+cmdChar+"cmtofeet (centimetres to feet), "+cmdChar+"feettocm (feet to centimetre), "+cmdChar+"kmtomile (kilometres to miles), "+cmdChar+"miletokm (miles to kilometres)");
6200
6201 // Celsius to Fahrenheit
6202 } else if (cmd == cmdChar+"ctof") {
6203 var fTemp = message.substring(6).trim() * (9 / 5) + 32;
6204 var outcome = fTemp.toString();
6205 if (message.substring(6).trim() == "" || isNaN(fTemp)) {
6206 sendChat("Usage: "+cmdChar+"ctof <unit> eg: 32.");
6207 } else {
6208 sendChat(message.substring(6).trim() + " Celsius equals: " + outcome.substring(0, 6) + " in Fahrenheit.");
6209 }
6210
6211 // Fahrenheit to Celsius
6212 } else if (cmd == cmdChar+"ftoc") {
6213 var cTemp = (message.substring(6).trim() - 32) * (5 / 9);
6214 var outcome = cTemp.toString();
6215 if (message.substring(6).trim() == "" || isNaN(cTemp)) {
6216 sendChat("Usage: "+cmdChar+"ftoc <unit> eg: 74.");
6217 } else {
6218 sendChat(message.substring(6).trim() + " Fahrenheit equals: " + outcome.substring(0, 6) + " in Celsius.");
6219 }
6220
6221 // Centimetres to Inches
6222 } else if (cmd == cmdChar+"cmtoinch") {
6223 var cmTemp = message.substring(10).trim() * 0.39370;
6224 var outcome = cmTemp.toString();
6225 if (message.substring(10).trim() == "" || isNaN(cmTemp)) {
6226 sendChat("Usage: "+cmdChar+"cmtoinch <unit> eg: 30.");
6227 } else {
6228 sendChat(message.substring(10).trim() + " Centimetres equals: " + outcome.substring(0, 6) + " inches.");
6229 }
6230
6231 // Inches to Centimetres
6232 } else if (cmd == cmdChar+"inchtocm") {
6233 var cmTemp = message.substring(10).trim() / 0.39370;
6234 var outcome = cmTemp.toString();
6235 if (message.substring(10).trim() == "" || isNaN(cmTemp)) {
6236 sendChat("Usage: "+cmdChar+"inches <unit> eg: 6.");
6237 } else {
6238 sendChat(message.substring(10).trim() + " Inches equals: " + outcome.substring(0, 6) + " Centimetres.");
6239 }
6240
6241 // Centimetres to Feet
6242 } else if (cmd == cmdChar+"cmtofeet") {
6243 var cmTemp = message.substring(10).trim() * 0.032808;
6244 var outcome = cmTemp.toString();
6245 if (message.substring(10).trim() == "" || isNaN(cmTemp)) {
6246 sendChat("Usage: "+cmdChar+"cmtofeet <unit> eg: 5.");
6247 } else {
6248 sendChat(message.substring(10).trim() + " Centimetres equals: " + outcome.substring(0, 6) + " feet.");
6249 }
6250
6251 // Feet to Centimetres
6252 } else if (cmd == cmdChar+"feettocm") {
6253 var cmTemp = message.substring(10).trim() / 0.032808;
6254 var outcome = cmTemp.toString();
6255 if (message.substring(10).trim() == "" || isNaN(cmTemp)) {
6256 sendChat("Usage: "+cmdChar+"feettocm <unit> eg: 5.");
6257 } else {
6258 sendChat(message.substring(10).trim() + " Feet equals: " + outcome.substring(0, 6) + " Centimetres.");
6259 }
6260
6261 // Kilometres to Miles
6262 } else if (cmd == cmdChar+"kmtomile") {
6263 var cmTemp = message.substring(10).trim() / 0.62137;
6264 var outcome = cmTemp.toString();
6265 if (message.substring(10).trim() == "" || isNaN(cmTemp)) {
6266 sendChat("Usage: "+cmdChar+"kmtomile <unit> eg: 50.");
6267 } else {
6268 sendChat(message.substring(10).trim() + " Kilometres equals: " + outcome.substring(0, 5) + " Miles.");
6269 }
6270
6271 // Miles to Kilometres
6272 } else if (cmd == cmdChar+"miletokm") {
6273 var cmTemp = message.substring(10).trim() * 0.62137;
6274 var outcome = cmTemp.toString();
6275 if (message.substring(10).trim() == "" || isNaN(cmTemp)) {
6276 sendChat("Usage: "+cmdChar+"miletokm <unit> eg: 80");
6277 } else {
6278 sendChat(message.substring(10).trim() + " Miles equals: " + outcome.substring(0, 5) + " Kilometres.");
6279 }
6280 // unit conversions end
6281
6282 // stab command
6283 } else if (cmd == cmdChar+"stab") {
6284 var target = msg.a.substring(cmd.length).trim();
6285 var part = getUser(target.toLowerCase());
6286 if (target == "") {
6287 sendChat("Usage "+cmdChar+"stab name_here.");
6288 return;
6289 }
6290 if (part) {
6291 if (part.name == name) {
6292 sendChat("\"Ouch!\" says " + part.name);
6293 return;
6294 }
6295 sendChat(name + " stabbed " + part.name +".");
6296 } else {
6297 sendChat(userNotFound);
6298 }
6299
6300 } else if (cmd == cmdChar+"highfive") { //highfive command
6301 var target = msg.a.substring(cmd.length).trim();
6302 var part = getUser(target.toLowerCase());
6303 if (target == "") {
6304 sendChat("Usage "+cmdChar+"highfive name_here.");
6305 return;
6306 }
6307 if (part) {
6308 if (part.name == name) {
6309 sendChat(part.name + " claps in the corner.. by themself.");
6310 return;
6311 }
6312 sendChat(name + " highfived " + part.name + ".");
6313 } else {
6314 sendChat(userNotFound);
6315 }
6316
6317 } else if (cmd == cmdChar+"kiss") { //kiss command
6318 var target = msg.a.substring(cmd.length).trim();
6319 var part = getUser(target.toLowerCase());
6320 if (target == "") {
6321 sendChat("Usage "+cmdChar+"kiss name_here.");
6322 return;
6323 }
6324
6325 if (usersDead.indexOf(ids) !== -1) {
6326 sendChat("Is too weak to kiss anyone... maybe a kiss would wake them up?");
6327 return;
6328 }
6329
6330 if (part) {
6331 if (part.name == name) {
6332 sendChat(name + " scrunches up their face, sucking their bottom lip inside their mouth.");
6333 return;
6334 }
6335
6336 if (usersDead.indexOf(part._id) !== -1) {
6337 sendChat(name + '\'s kiss brought ' + part.name + ' back to life.');
6338 usersDead.splice(usersDead.indexOf(ids), 1);
6339
6340 } else {
6341 var kissArray = ['bottom', 'top'];
6342 var lip = Math.floor(Math.random() * kissArray.length);
6343 var kissTypeArray = ['passionately', 'softly', 'shyly', 'nervously', 'cutely', 'holds and'];
6344 var kissType = Math.floor(Math.random() * kissTypeArray.length);
6345 sendChat(name + " " + kissTypeArray[kissType] + " kisses " + part.name + "'s " + kissArray[lip] + " lip. " + part.name + " blushes shyly.");
6346 }
6347 } else {
6348 sendChat(userNotFound);
6349 }
6350
6351 } else if (cmd == cmdChar+"slap") { //slap command
6352 var target = msg.a.substring(cmd.length).trim();
6353 var part = getUser(target.toLowerCase());
6354 if (target == "") {
6355 sendChat("Usage "+cmdChar+"slap name_here.");
6356 return;
6357 }
6358 if (part) {
6359 if (part.name == name) {
6360 sendChat("You cannot slap yourself, that would be awkward.");
6361 return;
6362 }
6363 sendChat(name + " slapped " + part.name);
6364 } else {
6365 sendChat(userNotFound);
6366 }
6367
6368 } else if (cmd == cmdChar+"cuddle") { //cuddle command
6369 var target = msg.a.substring(cmd.length).trim();
6370 var part = getUser(target.toLowerCase());
6371 if (target == "") {
6372 sendChat("Usage "+cmdChar+"cuddle name_here.");
6373 return;
6374 }
6375 if (part) {
6376 if (part.name == name) {
6377 sendChat("You cannot cuddle yourself, you lonely fuck!");
6378 return;
6379 }
6380 var cuddleArray = ['tightly cuddles', 'softly cuddles', 'shyly cuddles', 'tenderly cuddles', 'cuddles'];
6381 var cuddle = Math.floor(Math.random() * cuddleArray.length);
6382 sendChat(name + " " + cuddleArray[cuddle] + " " + part.name + ".");
6383 } else {
6384 sendChat(userNotFound);
6385 }
6386
6387 } else if (cmd == cmdChar+"hug") { //hug command
6388 var target = msg.a.substring(cmd.length).trim();
6389 var part = getUser(target.toLowerCase());
6390 if (target == "") {
6391 sendChat("Usage "+cmdChar+"hug name_here.");
6392 return;
6393 }
6394 if (part) {
6395 if (part.name == name) {
6396 sendChat("You cannot hug yourself, hug a cuddly anon.");
6397 return;
6398 }
6399 var hugArray = [' tightly squeezes ', ' sprints up and hugs ', ' shyly hugs ', ' gently caresses ', ' tounge hugs '];
6400 var hug = Math.floor(Math.random() * hugArray.length);
6401 sendChat(name + hugArray[hug] + part.name + ".");
6402 } else {
6403 sendChat(userNotFound);
6404 }
6405
6406 } else if (cmd == cmdChar+"rape") { //rape command
6407 var target = msg.a.substring(cmd.length).trim();
6408 var part = getUser(target.toLowerCase());
6409 if (target == "") {
6410 sendChat("Usage "+cmdChar+"rape name_here.");
6411 return;
6412 }
6413 if (part) {
6414 if (part.name == name) {
6415 sendChat("You cannot rape yourself, rape the Anonymous people.");
6416 return;
6417 }
6418 sendChat(name + " raped " + part.name + " ᶘᵒᴥᵒᶅ");
6419 } else {
6420 sendChat(userNotFound);
6421 }
6422
6423 } else if (cmd == cmdChar+"gift") { //gift command
6424 var giftArray = ['a cute kitten!', 'a cute puppy!', 'a potato!', 'a pikachu!', 'a brand new Xbox One!', 'a brand new PS4!', '1 million cows!', 'a slice of bacon!', 'a boating license!', 'a bunch of money!', 'some cake!', 'a box inside of a... BOX!', 'a new phone!', 'a new piano!', 'some chicken nuggets!', 'a brand new Wii U!', 'an evil gerbil!', 'a captains ship!', 'some sfoof! (Semolina Turmeric Cake)', 'some pizza!', 'a new laptop!', 'a piece of cotton', 'a spoon', 'a dribbling cat']; //add more... like 100 :D
6425 var randomNumber = Math.floor(Math.random() * giftArray.length);
6426 var target = msg.a.substring(cmd.length).trim();
6427 var part = getUser(target.toLowerCase());
6428 if (target == "") {
6429 sendChat("Usage "+cmdChar+"gift name_here.");
6430 return;
6431 }
6432 if (part) {
6433 if (part.name == name) {
6434 sendChat("You cannot gift yourself, that would be greedy.");
6435 return;
6436 }
6437 sendChat(name + " gave " + part.name + " " + giftArray[randomNumber]);
6438 } else {
6439 sendChat(userNotFound);
6440 }
6441
6442 } else if (cmd == cmdChar+"attack") { //attack command
6443 var attackArray = ['fondue stick', 'piece of bread', 'rubber chicken', 'piano', 'turtle shell', 'lamp', 'Kkitting needle', 'brake cable', 'totally non-harmful piece of string', 'rake', 'shovel', 'birds nest', 'bit of help from gravity', 'sharp stick', 'stick covered in poop', 'can of softdrink (isn’t too soft)', 'disembodied arm', 'candle stick', 'wet iguana', 'duck', 'spoon', 'boat oar', 'large rock', 'sharp triangle', 'trumpet', 'toy car', 'buzz-saw', 'computer keyboard', 'piece of Ed and Megan’s love', 'scratched CD', 'shoe lace', 'assault rifle', 'Mini-Uzi', 'piece of paper', 'very angry wet cat', 'slug', 'cylinder of Pringles', 'hairbrush'];
6444 var randomNumber = Math.floor(Math.random() * attackArray.length);
6445 var target = msg.a.substring(cmd.length).trim();
6446 var part = getUser(target.toLowerCase());
6447 if (target == "") {
6448 sendChat("Usage "+cmdChar+"attack name_here.");
6449 return;
6450 }
6451 if (part) {
6452 if (part.name == name) {
6453 sendChat("You cannot attack yourself, attack the Anonymous people.");
6454 return;
6455 }
6456 sendChat(name + " attacked " + part.name + " with a " + attackArray[randomNumber] + ".");
6457 } else {
6458 sendChat(userNotFound);
6459 }
6460
6461 } else if (cmd == cmdChar+"colour" || cmd == cmdChar+"color") { //colour command
6462 //thanks electrashave!
6463 if (msg.a.substring(cmd.length).trim() == '') {
6464 sendChat("Your colour is " + new Color(msg.p.color).getName() + " (" + msg.p.color + ") (You can also type "+cmdChar+"colour name_here)");
6465 return;
6466 }
6467
6468 var target = msg.a.substring(cmd.length).trim();
6469 var part = getUser(target.toLowerCase());
6470
6471 if (part) {
6472 sendChat(part.name + "'s colour is " + new Color(part.color).getName() + " (" + part.color + ")");
6473 } else {
6474 sendChat(userNotFound);
6475 }
6476
6477 } else if (cmd == cmdChar+"unicode") { //unicode command
6478 sendChat("Put some of these in your name: ᴥ◕☀☁☂☃☄★☆☇☈☉☊☋☌☍ツ¢¢☍☎☏☐☑☒☓☔☕☖☗☘☙☚☛☜☝☞☟☠␀☡☢☣☤☥☦☧☨☩☪☫☬☭☮☯─━│┃┎┒┝┫┳┻╋╭╮╯╰╱╲╳╴╵╶╷╸╹╺╻╼╽╾╿☰☱☲☳☴☵☶☷░▒▓▔▁▂▃▄▅▆▇█▉▊▋▌▐ ▍▎▏◘☸☹☺☻☼☽☾☿ ♀♁♂♃♄♅♆♇♈♉♊♋♌♍♎♏♐♑♒♓♔♕♖♗♘♙♚♛♜♝♞♟♠♢♣♤♥♡♦♧♨♩♪♫♬♭♮♯ ๖ۣۜ ∥~∼˜≀π∏ℍℂℕℙℚℝℤℬℰℱℋℐℒℳ℘ℛℓℴℯɨℊℎ√∑∮‖⌊⌉⋕⊤✀✁✂✃✄✆✇✈✉✌✍✎✏✐✑✒✓✔✕✖✗✘✙✚✛✜✝✞✟✠✡✢✣✤✥✦✧✩✪✫✬✭✮✯✰✱✲✳✴✵✶✷✸✹✺✻✼✽✾✿❀❁❂❃❄❅❆❇❈❉❊❋❍❏❐❑❒❖❡❤❥❦❧❶❷❸❹❺❻❼❽❾❿➀➁➂➃➄➅➆➇➈➉➔➘➙➚➛➜➝➞➟➠➡➢➣➤➥➦➧➨➩➪➫➬➭➮➯➰➱➲➳➴➵➶➷➸➹➺➻➼➽➾∧⋉⋊⋈ℵ");
6479
6480 } else if (cmd == cmdChar+"clap" || cmd == cmdChar+"applaud") { //clap command
6481 sendChat(name + " applauds.");
6482
6483 } else if (cmd == cmdChar+"slowclap") { //slow clap command
6484 sendChat(name + " claps slowly in approval");
6485
6486 } else if (cmd == cmdChar+"list") { //list command
6487 var list = "Connected users: ";
6488 for (var id in gClient.ppl) {
6489 list += gClient.ppl[id].name + ", ";
6490 }
6491 sendChat(list);
6492 return;
6493
6494 } else if (cmd == cmdChar+"facepalm") { //facepalm command
6495 sendChat(name + " facepalmed.");
6496
6497 } else if (cmd == cmdChar+"musicsheets" || cmd == cmdChar+"ms") { //musicsheets command
6498 var songArray = ['Logan’s small march: xbm. cbm/ xvj. gj. gj, xbm xbm. cb,/ n,ry k.r wtbk etb,',
6499 'Dramatic song: C E 5 E Y E Y U | S E 5 E 8 U Y U | A E 5 E Y E Y U | (Ctrl M) E 5 E 8 U Y 5',
6500 'Part of Turkich March - [ - o i o i 8 7 i 8 7 y 7 8 y 4 5 t 4 7 y 7 8 i 8 i o - p - [ -',
6501 'C. P. E. Bach Solfeggietto: g c m e 5 r e w m w r u y 5 r 5 e 5 u p = [ p [ p o i u y 5 r',
6502 'Gravity Falls: N V Z V N V Z V N C Z C N C Z C B F Z F B F Z F B F Z F B F Z ',
6503 'My Immortal: z4 tb qi t - t i t f4 tk 48 t - z4 tb qi t o t i t f4 tk 48 t',
6504 'Song of Stroms: v r yi yi b t uo n y ip ip b t uo',
6505 'C minor: c v g n m k l /',
6506 'Skrillex - Scary Monsters: m u y u g9 u [ p 9 y 2 q y 5 nr e 2 m 2 m 2 r u r 2 m y 2 m n',
6507 'B major: x f g b j k l .',
6508 'Colombia Pictures: 8 p 9 y | 4 y 5 e | k / l n | f n g c | acgk',
6509 'Fandango: ttytyt8o ttytytip ttytyt8o ttytytip',
6510 'Eb fun: f n . | g m l | 4 y o | 5 u 9',
6511 'The Entertainer LH: e tup m u9p yn yip tb tup m yu m yu m etup etup',
6512 'Same Love: (Hold G) L M L GC ~ (Hold A) G C G (Hold G) J-M ~ (Hold G) L M L GC ~ (Hold A) G C G (Let go of A) GS',
6513 'Tetris: T W E R R E Q Q E T R E W W E R T E Q Q R Y I U Y T E T R E W W E R T E Q Q',
6514 'Mad World: N8 P 1EU 8 NY U 1E5 R 2 RY 2 RY 8 N P 1EU 8 NY U 1E8 9 2 RY 2 RY',
6515 'E minor: b j m , . / r t',
6516 'Happy Birthday: E E NQR E Y CLT E E CLR E U NQY E E NQP I Y NLT R 9 9 NQI Y CLU NQY',
6517 'Darude Sandstorm: r7i tuo tuo tuo tuo up] tuo tuo tuo tuo up] tuo tuo tuo tuo up] up] uo[ uo[ r7i tuo',
6518 'Yoshi\'s Epic Morrowind: E R 5CGM 5 Y UGL U 9 YSVN 5 R EACG E R 5CGM 5 Y UGL U 9 PGKE 9URM 8YP'];
6519 var randomSong = Math.floor(Math.random() * songArray.length);
6520 sendChat("Songs for PC players: " + sheetURL + " here's a random sample - " + songArray[randomSong] + " (Notes updated 6th June 2015)"); //update when you update link, Logan
6521
6522 } else if (cmd == cmdChar+"suicide") { //suicide command
6523 if (usersDead.indexOf(ids) == -1) {
6524 sendChat(name + " kissed Logan and died x3");
6525 usersDead.push(ids);
6526
6527 } else {
6528 sendChat(name + " is too weak to kiss Logan... Maybe a kiss would wake them up?");
6529 }
6530
6531 } else if (cmd == cmdChar+"kill") { //kill command
6532 var target = msg.a.substring(cmd.length).trim();
6533 var part = getUser(target.toLowerCase());
6534 if (target == "") {
6535 sendChat("Usage "+cmdChar+"kill name_here.");
6536 return;
6537 }
6538 if (part) {
6539 if (part.name == name) {
6540 if (usersDead.indexOf(part._id) == -1) {
6541 sendChat(name + " commitsed suicide!");
6542 usersDead.push(part._id);
6543 } else {
6544 sendChat(name + "'s body twitches... Maybe a kiss would wake them up?");
6545 }
6546 return;
6547 }
6548 if (usersDead.indexOf(part._id) == -1) {
6549 sendChat(name + " killed " + part.name + "!");
6550 usersDead.push(part._id)
6551 } else {
6552 sendChat(part.name + " body twitches... Maybe a kiss would wake them up?");
6553 }
6554 } else {
6555 sendChat(userNotFound);
6556 }
6557
6558 //text art
6559 } else if (cmd == cmdChar+"art") { //art command
6560 sendChat("Small text art (crown not needed): "+cmdChar+"bunny (3 lines), "+cmdChar+"bunny2 (3 lines), "+cmdChar+"bunny3 (3 lines), "+cmdChar+"bunny4 (3 lines), "+cmdChar+"hamster (3 lines), "+cmdChar+"hamster2 (3 lines), "+cmdChar+"table (3 lines). Large text art (crown needed) "+cmdChar+"fishies (9 lines).");
6561
6562 } else if (cmd == cmdChar+"hamster2") { //hamster 2 art command
6563 setTimeout(function() { sendChat("( ) ( )" ); }, 0);
6564 setTimeout(function() { sendChat("(>•.•<)" ); }, 0);
6565 setTimeout(function() { sendChat('(") (")' ); }, 0);
6566
6567 } else if (cmd == cmdChar+"hamster") { //hamster art command
6568 setTimeout(function() { sendChat("( )_( )" ); }, 0);
6569 setTimeout(function() { sendChat("(='.'=)" ); }, 0);
6570 setTimeout(function() { sendChat('(")_(")' ); }, 0);
6571
6572 } else if (cmd == cmdChar+"bunny4") { //bunny 4 art command
6573 setTimeout(function() { sendChat("(\\(\\" ); }, 0);
6574 setTimeout(function() { sendChat("(=\".\")" ); }, 0);
6575 setTimeout(function() { sendChat('("")("")' ); }, 0);
6576
6577 } else if (cmd == cmdChar+"bunny3") { //bunny 3 art command
6578 setTimeout(function() { sendChat("(\\_(\\" ); }, 0);
6579 setTimeout(function() { sendChat("(˚_˚)" ); }, 0);
6580 setTimeout(function() { sendChat("('')('')" ); }, 0);
6581
6582 } else if (cmd == cmdChar+"bunny2") { //bunny 2 art command
6583 setTimeout(function() { sendChat("/)_/)" ); }, 0);
6584 setTimeout(function() { sendChat("(0.0)" ); }, 0);
6585 setTimeout(function() { sendChat("('')('')" ); }, 0);
6586
6587 } else if (cmd == cmdChar+"bunny") { //bunny art command
6588 setTimeout(function() { sendChat("(\\_/)" ); }, 0);
6589 setTimeout(function() { sendChat("(o.o)" ); }, 0);
6590 setTimeout(function() { sendChat("('')('')" ); }, 0);
6591
6592 } else if (cmd == cmdChar+"table") { //table art command
6593 setTimeout(function() { sendChat("(╮°-°)╮┳━━┳" ); }, 0);
6594 setTimeout(function() { sendChat("( ╯°□°)╯ ┻━━┻" ); }, 0);
6595 setTimeout(function() { sendChat("┬──┬ ノ( ゜-゜ノ)" ); }, 0);
6596 //text art
6597
6598 } else if (cmd == cmdChar+"fishies") { //fishies command
6599 if (gClient.isOwner()) {
6600 sendChat("╭━━╮╭━━━┳╮╭╮╭╮╭━━━┳━━━┳╮╭╮╭┳━╮╱╭╮╭━━━┳━━┳━━━┳╮╱╭┳━━┳━━━┳━━━╮ ╭╮" );
6601 sendChat("┃╭╮┃┃╭━╮┃┃┃┃┃┃╰╮╭╮┃╭━╮┃┃┃┃┃┃┃╰╮┃┃┃╭━━┻┫┣┫╭━╮┃┃╱┃┣┫┣┫╭━━┫╭━╮┃ ┃┃" );
6602 sendChat("┃╰╯╰┫┃╱┃┃┃┃┃┃┃╱┃┃┃┃┃╱┃┃┃┃┃┃┃╭╮╰╯┃┃╰━━╮┃┃┃╰━━┫╰━╯┃┃┃┃╰━━┫╰━━╮ ┃┃" );
6603 sendChat("┃╭━╮┃┃╱┃┃╰╯╰╯┃╱┃┃┃┃┃╱┃┃╰╯╰╯┃┃╰╮┃┃┃╭━━╯┃┃╰━━╮┃╭━╮┃┃┃┃╭━━┻━━╮┃ ╰╯" );
6604 sendChat("┃╰━╯┃╰━╯┣╮╭╮╭╯╭╯╰╯┃╰━╯┣╮╭╮╭┫┃╱┃┃┃┃┃╱╱╭┫┣┫╰━╯┃┃╱┃┣┫┣┫╰━━┫╰━╯┃ ╭╮" );
6605 sendChat("╰━━━┻━━━╯╰╯╰╯╱╰━━━┻━━━╯╰╯╰╯╰╯╱╰━╯╰╯╱╱╰━━┻━━━┻╯╱╰┻━━┻━━━┻━━━╯ ╰╯" );
6606 sendChat("╭━━━┳━━━┳━━━┳━━━┳━━━┳━━━┳━━━┳━━━┳━━━┳━━━┳━━━┳━━━┳━━━┳━━━┳━━╮" );
6607 sendChat("╰━━━┻━━━┻━━━┻━━━┻━━━┻━━━┻━━━┻━━━┻━━━┻━━━┻━━━┻━━━┻━━━┻━━━┻━━╯" );
6608 sendChat("><> \\o/" );
6609 } else {
6610 sendChat("I need the crown to show fishies in its entirety!");
6611 }
6612
6613 } else if (cmd == cmdChar+"face") { //face command
6614 var textArray = ['╥﹏╥', '(◕ᴥ◕し)', 'ʕ•ᴥ•ʔ', '(◡‿◡✿)', 'ヽ༼ ಠ益ಠ ༽ノ', '^‿^', 'ᶘ ᵒᴥᵒᶅ', '๏̯͡๏', '^ㅂ^', ' ಠ_ರೃ', '(ノ◕ヮ◕)ノ*:・゚✧', '◕◡◕', 'ಠ▃ಠ', 'ಠ╭╮ಠ', 'ಠ⌣ಠ', 'ಠ◡ಠ', 'ლ(ಠ益ಠლ)', 'ლ(◉◞౪◟◉‵ლ)', '⊙ω⊙', '⊙▂⊙', '╯‵Д′)╯彡┻━┻', '◕ω◕', '⌒▽⌒', '♥◡♥', '。◕‿‿◕。', '。◕ ‿ ◕。', '(´◉◞౪◟◉)', 'Ծ‸ Ծ', '(ᵔᴥᵔ)', '• ε •', '(⌐■_■)', '(┛◉Д◉)┛┻━┻', '(╯°□°)╯︵ ┻━┻ ', '◕ ^ ◕', '(☞゚ ∀゚ )☞', '(づ。◕‿‿◕。)づ', '(ノಠ益ಠ)ノ彡┻━┻', ';一_一', '\(◕ ◡ ◕\)', '°-°', '¶_¶', '( ͡° ͜ʖ ͡°)', '|)^_^(|'];
6615 var randomNumber = Math.floor(Math.random() * textArray.length);
6616 sendChat(textArray[randomNumber]);
6617
6618 } else if (cmd == cmdChar+"say") { //say command
6619 if (message.substring(4).trim() == "") {
6620 sendChat("Usage: "+cmdChar+"say text to say.");
6621 return;
6622 }
6623 sendChat(message.substring(5).trim());
6624
6625 } else if (cmd == cmdChar+"rename") { //rename command
6626 if (message.substring(cmd.length).trim() == 0) {
6627 sendChat('Usage: '+cmdChar+'rename new_name');
6628 return;
6629 }
6630 if (message.substring(7).trim() == 420) {
6631 sendChat('Too high!');
6632 return;
6633 }
6634 if (opped) {
6635 updateName(message.substring(7).trim());
6636 selfName = message.substring(7).trim();
6637
6638 } else {
6639 sendChat(noAccess);
6640 }
6641
6642 } else if (cmd == cmdChar+"welcome") { //welcome command
6643 if (opped) {
6644 if (welcTemp) {
6645 welcTemp = false;
6646 sendChat("Room welcoming disabled.");
6647 } else {
6648 welcTemp = true;
6649 sendChat("Room welcoming enabled.");
6650 }
6651 } else {
6652 sendChat(noAccess);
6653 }
6654 } else if (cmd == cmdChar+"tune") { //tune command
6655 if (opped) {
6656 if (tuneTemp) {
6657 tuneTemp = false;
6658 sendChat("Welcome tune disabled.");
6659 } else {
6660 tuneTemp = true;
6661 sendChat("Welcome tune enabled.");
6662 }
6663 } else {
6664 sendChat(noAccess);
6665 }
6666
6667 } else if (cmd == cmdChar+"ban") { //ban command
6668 var target = msg.a.substring(cmd.length).trim();
6669 var part = getUser(target.toLowerCase());
6670
6671 if (opped) {
6672 if (target == "") {
6673 sendChat("Usage "+cmdChar+"ban name_here.");
6674 return;
6675 }
6676 if (part) {
6677 if (banned.indexOf(part._id) !== -1) {
6678 sendChat(part.name + " is already banned!");
6679 return;
6680 }
6681
6682 if (part._id == selfId) { //Logan
6683 sendChat("Banning " + part.name.substring(0, 4).trim() + "... wait.");
6684 } else if (part._id == "4e28d8736f8a464ada652896") { //Yoshify.
6685 sendChat("You cannot ban " + selfName + "'s friend " + part.name + ".");
6686 } else if (part._id == "d9e6170fd899f2a94adea761") { //StarsPiano
6687 sendChat("You cannot ban " + selfName + "'s friend " + part.name + ".");
6688 } else {
6689 banned.push(part._id);
6690 sendChat(name + " banned " + part.name + ".");
6691 }
6692 } else {
6693 sendChat(userNotFound);
6694 }
6695 } else {
6696 sendChat(noAccess);
6697 }
6698
6699 } else if (cmd == cmdChar+"unban") { //unban command
6700 var target = msg.a.substring(cmd.length).trim();
6701 var part = getUser(target.toLowerCase());
6702
6703 if (opped) {
6704 if (target == "") {
6705 sendChat("Usage "+cmdChar+"unban name_here.");
6706 return;
6707 }
6708 if (part) {
6709 if (banned.indexOf(part._id) == -1) {
6710 sendChat(part.name + " isn't banned!");
6711 return;
6712 }
6713
6714 while (banned.indexOf(part._id) !== -1) {
6715 banned.splice(banned.indexOf(part._id), 1);
6716 sendChat(name + " unbanned " + part.name + ".");
6717 }
6718 while (banned.indexOf(part._id) !== -1) {
6719 delete banned[banned.indexOf(part._id)];
6720 }
6721 } else {
6722 sendChat(userNotFound);
6723 }
6724 } else {
6725 sendChat(noAccess);
6726 }
6727
6728 } else if (cmd == cmdChar+"pardon") { //pardon command
6729 if (mastered || opped) {
6730 banned = [];
6731 sendChat(name + " pardoned everyone from being banned.");
6732 } else {
6733 sendChat(noAccess);
6734 }
6735
6736 } else if (cmd == cmdChar+"op") { //op command
6737 var target = msg.a.substring(cmd.length).trim();
6738 var part = getUser(target.toLowerCase());
6739
6740 if (opped) {
6741 if (target == "") {
6742 sendChat("Usage "+cmdChar+"op name_here.");
6743 return;
6744 }
6745 if (part) {
6746 if (ops.indexOf(part._id) !== -1) {
6747 sendChat(part.name + " is already opped!");
6748 return;
6749 }
6750
6751 sendChat("Opped " + part.name + ".");
6752 ops.push(part._id);
6753
6754 } else {
6755 sendChat(userNotFound);
6756 }
6757 } else {
6758 sendChat(noAccess);
6759 }
6760
6761 } else if (cmd == cmdChar+"deop") { //deop command
6762 var target = msg.a.substring(cmd.length).trim();
6763 var part = getUser(target.toLowerCase());
6764
6765 if (opped) {
6766 if (target == "") {
6767 sendChat("Usage "+cmdChar+"deop name_here.");
6768 return;
6769 }
6770 if (part) {
6771 if (ops.indexOf(part._id) == -1) {
6772 sendChat(part.name + " isn't opped!");
6773 return;
6774 }
6775
6776 if (part._id == selfId) { //Logan
6777 sendChat("You cannot deop " + part.name + ".");
6778 } else if (part._id == "4e28d8736f8a464ada652896") { //Yoshify.
6779 sendChat("You cannot deop " + selfName + "'s friend " + part.name + ".");
6780 } else if (part._id == "d9e6170fd899f2a94adea761") { //StarsPiano
6781 sendChat("You cannot deop " + selfName + "'s friend " + part.name + ".");
6782 } else {
6783 while (ops.indexOf(part._id) !== -1) {
6784 ops.splice(banned.indexOf(part._id), 1); //is this meant to say banned?
6785 }
6786 while (ops.indexOf(part._id) !== -1) {
6787 delete ops[ops.indexOf(part._id)];
6788 }
6789 sendChat("Deopped " + part.name + ".");
6790 }
6791 } else {
6792 sendChat(userNotFound);
6793 }
6794 } else {
6795 sendChat(noAccess);
6796 }
6797 } else if (message.substring(0, 1) == cmdChar) { //alternative error messages
6798 if (message.substring(2).trim() == "") {
6799
6800 } else {
6801 //sendChat("Invalid command. Type !help for a list of commands you have access to."); //shhhhh
6802 }
6803 }
6804 }
6805 botLoaded = true;
6806 });
6807
6808 var Color = function () {
6809 var r, g, b;
6810 if (arguments.length === 1) {
6811 var hexa = arguments[0].toLowerCase();
6812 if (hexa.match(/^#[0-9a-f]{6}$/i)) {
6813 hexa = /^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(hexa);
6814 if (hexa && hexa.length === 4) {
6815 r = parseInt(hexa[1], 16);
6816 g = parseInt(hexa[2], 16);
6817 b = parseInt(hexa[3], 16);
6818 }
6819 }
6820 } else if (arguments.length === 3) {
6821 r = arguments[0];
6822 g = arguments[1];
6823 b = arguments[2];
6824 }
6825 this.r = ~~r || 0;
6826 this.g = ~~g || 0;
6827 this.b = ~~b || 0;
6828 };
6829
6830 Color.prototype.distance = function (color) {
6831 var d = 0;
6832 d += Math.pow(this.r - color.r, 2);
6833 d += Math.pow(this.g - color.g, 2);
6834 d += Math.pow(this.b - color.b, 2);
6835 return Math.abs(Math.sqrt(d));
6836 };
6837
6838 Color.prototype.toHexa = function () {
6839 var r = this.r.toString(16),
6840 g = this.g.toString(16),
6841 b = this.b.toString(16);
6842 if (r.length == 1) r = "0" + r;
6843 if (g.length == 1) g = "0" + g;
6844 if (b.length == 1) b = "0" + b;
6845 return "#" + r + g + b;
6846 };
6847
6848 Color.prototype.getName = function () {
6849 var hexa = this.toHexa();
6850 var low = 256;
6851 var name;
6852 for (var n in Color.map) {
6853 if (!Color.map.hasOwnProperty(n)) continue;
6854 var color = Color.map[n];
6855 if (color.r === this.r && color.g === this.g && color.b === this.b) {
6856 return n;
6857 }
6858 var dist = this.distance(color);
6859 if (dist < low) {
6860 low = dist;
6861 name = n;
6862 }
6863 }
6864 if (!name) name = this.toHexa();
6865 else name = "a shade of " + name;
6866 return name;
6867 };
6868
6869 Color.map = {};
6870
6871 Color.a = function (hexa, name) {
6872 Color.map[name] = new Color(hexa);
6873 };
6874
6875 Color.a("#7CB9E8", "Aero");
6876 Color.a("#C9FFE5", "Aero blue");
6877 Color.a("#B284BE", "African purple");
6878 Color.a("#5D8AA8", "Air Force blue (RAF)");
6879 Color.a("#00308F", "Air Force blue (USAF)");
6880 Color.a("#72A0C1", "Air superiority blue");
6881 Color.a("#AF002A", "Alabama Crimson");
6882 Color.a("#F0F8FF", "Alice blue");
6883 Color.a("#E32636", "Alizarin crimson");
6884 Color.a("#C46210", "Alloy orange");
6885 Color.a("#EFDECD", "Almond");
6886 Color.a("#E52B50", "Amaranth");
6887 Color.a("#F19CBB", "Amaranth pink");
6888 Color.a("#AB274F", "Dark amaranth");
6889 Color.a("#3B7A57", "Amazon");
6890 Color.a("#FF7E00", "Amber");
6891 Color.a("#FF033E", "American rose");
6892 Color.a("#9966CC", "Amethyst");
6893 Color.a("#A4C639", "Android green");
6894 Color.a("#F2F3F4", "Anti-flash white");
6895 Color.a("#CD9575", "Antique brass");
6896 Color.a("#665D1E", "Antique bronze");
6897 Color.a("#915C83", "Antique fuchsia");
6898 Color.a("#841B2D", "Antique ruby");
6899 Color.a("#FAEBD7", "Antique white");
6900 Color.a("#8DB600", "Apple green");
6901 Color.a("#FBCEB1", "Apricot");
6902 Color.a("#00FFFF", "Aqua");
6903 Color.a("#7FFFD4", "Aquamarine");
6904 Color.a("#4B5320", "Army green");
6905 Color.a("#3B444B", "Arsenic");
6906 Color.a("#8F9779", "Artichoke");
6907 Color.a("#B2BEB5", "Ash grey");
6908 Color.a("#87A96B", "Asparagus");
6909 Color.a("#FDEE00", "Aureolin");
6910 Color.a("#6E7F80", "AuroMetalSaurus");
6911 Color.a("#568203", "Avocado");
6912 Color.a("#007FFF", "Azure");
6913 Color.a("#F0FFFF", "Azure mist/web");
6914 Color.a("#89CFF0", "Baby blue");
6915 Color.a("#A1CAF1", "Baby blue eyes");
6916 Color.a("#FEFEFA", "Baby powder");
6917 Color.a("#FF91AF", "Baker-Miller pink");
6918 Color.a("#21ABCD", "Ball blue");
6919 Color.a("#FAE7B5", "Banana Mania");
6920 Color.a("#FFE135", "Banana yellow");
6921 Color.a("#E0218A", "Barbie pink");
6922 Color.a("#7C0A02", "Barn red");
6923 Color.a("#848482", "Battleship grey");
6924 Color.a("#98777B", "Bazaar");
6925 Color.a("#9F8170", "Beaver");
6926 Color.a("#F5F5DC", "Beige");
6927 Color.a("#2E5894", "B'dazzled blue");
6928 Color.a("#9C2542", "Big dip o’ruby");
6929 Color.a("#FFE4C4", "Bisque");
6930 Color.a("#3D2B1F", "Bistre");
6931 Color.a("#967117", "Bistre brown");
6932 Color.a("#CAE00D", "Bitter lemon");
6933 Color.a("#648C11", "Bitter lime");
6934 Color.a("#FE6F5E", "Bittersweet");
6935 Color.a("#BF4F51", "Bittersweet shimmer");
6936 Color.a("#000000", "Black with no soul!");
6937 Color.a("#3D0C02", "Black bean");
6938 Color.a("#253529", "Black leather jacket");
6939 Color.a("#3B3C36", "Black olive");
6940 Color.a("#FFEBCD", "Blanched almond");
6941 Color.a("#A57164", "Blast-off bronze");
6942 Color.a("#318CE7", "Bleu de France");
6943 Color.a("#ACE5EE", "Blizzard Blue");
6944 Color.a("#FAF0BE", "Blond");
6945 Color.a("#0000FF", "Blue");
6946 Color.a("#1F75FE", "Blue (Crayola)");
6947 Color.a("#0093AF", "Blue (Munsell)");
6948 Color.a("#0087BD", "Blue (NCS)");
6949 Color.a("#333399", "Blue (pigment)");
6950 Color.a("#0247FE", "Blue (RYB)");
6951 Color.a("#A2A2D0", "Blue Bell");
6952 Color.a("#6699CC", "Blue-gray");
6953 Color.a("#0D98BA", "Blue-green");
6954 Color.a("#126180", "Blue sapphire");
6955 Color.a("#8A2BE2", "Blue-violet");
6956 Color.a("#5072A7", "Blue yonder");
6957 Color.a("#4F86F7", "Blueberry");
6958 Color.a("#1C1CF0", "Bluebonnet");
6959 Color.a("#DE5D83", "Blush");
6960 Color.a("#79443B", "Bole Brown");
6961 Color.a("#0095B6", "Bondi blue");
6962 Color.a("#E3DAC9", "Bone");
6963 Color.a("#CC0000", "Boston University Red");
6964 Color.a("#006A4E", "Bottle green");
6965 Color.a("#873260", "Boysenberry");
6966 Color.a("#0070FF", "Brandeis blue");
6967 Color.a("#B5A642", "Brass");
6968 Color.a("#CB4154", "Brick red");
6969 Color.a("#1DACD6", "Bright cerulean");
6970 Color.a("#66FF00", "Bright green");
6971 Color.a("#BF94E4", "Bright lavender");
6972 Color.a("#D891EF", "Bright lilac");
6973 Color.a("#C32148", "Bright maroon");
6974 Color.a("#1974D2", "Bright navy blue");
6975 Color.a("#FF007F", "Bright pink");
6976 Color.a("#08E8DE", "Bright turquoise");
6977 Color.a("#D19FE8", "Bright ube");
6978 Color.a("#F4BBFF", "Brilliant lavender");
6979 Color.a("#FF55A3", "Brilliant rose");
6980 Color.a("#FB607F", "Brink pink");
6981 Color.a("#004225", "British racing green");
6982 Color.a("#CD7F32", "Bronze");
6983 Color.a("#737000", "Bronze Yellow");
6984 Color.a("#964B00", "Brown");
6985 Color.a("#6B4423", "Brown-nose");
6986 Color.a("#FFC1CC", "Bubble gum");
6987 Color.a("#E7FEFF", "Bubbles");
6988 Color.a("#F0DC82", "Buff");
6989 Color.a("#7BB661", "Bud green");
6990 Color.a("#480607", "Bulgarian rose");
6991 Color.a("#800020", "Burgundy");
6992 Color.a("#DEB887", "Burlywood");
6993 Color.a("#CC5500", "Burnt orange");
6994 Color.a("#8A3324", "Burnt umber");
6995 Color.a("#BD33A4", "Byzantine");
6996 Color.a("#702963", "Byzantium");
6997 Color.a("#536872", "Cadet");
6998 Color.a("#5F9EA0", "Cadet blue");
6999 Color.a("#91A3B0", "Cadet grey");
7000 Color.a("#006B3C", "Cadmium green");
7001 Color.a("#ED872D", "Cadmium orange");
7002 Color.a("#E30022", "Cadmium red");
7003 Color.a("#FFF600", "Cadmium yellow");
7004 Color.a("#A67B5B", "Cafe au lait");
7005 Color.a("#4B3621", "Cafe noir");
7006 Color.a("#1E4D2B", "Cal Poly green");
7007 Color.a("#A3C1AD", "Cambridge Blue");
7008 Color.a("#EFBBCC", "Cameo pink");
7009 Color.a("#78866B", "Camouflage green");
7010 Color.a("#FFEF00", "Canary yellow");
7011 Color.a("#FF0800", "Candy apple red");
7012 Color.a("#E4717A", "Candy pink");
7013 Color.a("#592720", "Caput mortuum");
7014 Color.a("#C41E3A", "Cardinal");
7015 Color.a("#00CC99", "Caribbean green");
7016 Color.a("#960018", "Carmine");
7017 Color.a("#EB4C42", "Carmine pink");
7018 Color.a("#FF0038", "Carmine red");
7019 Color.a("#FFA6C9", "Carnation pink");
7020 Color.a("#99BADD", "Carolina blue");
7021 Color.a("#ED9121", "Carrot orange");
7022 Color.a("#00563F", "Castleton green");
7023 Color.a("#062A78", "Catalina blue");
7024 Color.a("#703642", "Catawba");
7025 Color.a("#C95A49", "Cedar Chest");
7026 Color.a("#92A1CF", "Ceil");
7027 Color.a("#ACE1AF", "Celadon");
7028 Color.a("#007BA7", "Celadon blue");
7029 Color.a("#2F847C", "Celadon green");
7030 Color.a("#4997D0", "Celestial blue");
7031 Color.a("#EC3B83", "Cerise pink");
7032 Color.a("#2A52BE", "Cerulean blue");
7033 Color.a("#6D9BC3", "Cerulean frost");
7034 Color.a("#007AA5", "CG Blue");
7035 Color.a("#E03C31", "CG Red");
7036 Color.a("#A0785A", "Chamoisee");
7037 Color.a("#F7E7CE", "Champagne");
7038 Color.a("#36454F", "Charcoal");
7039 Color.a("#232B2B", "Charleston green");
7040 Color.a("#E68FAC", "Charm pink");
7041 Color.a("#DFFF00", "Chartreuse");
7042 Color.a("#7FFF00", "Chartreuse (web)");
7043 Color.a("#DE3163", "Cherry");
7044 Color.a("#FFB7C5", "Cherry blossom pink");
7045 Color.a("#954535", "Chestnut");
7046 Color.a("#A8516E", "China rose");
7047 Color.a("#AA381E", "Chinese red");
7048 Color.a("#856088", "Chinese violet");
7049 Color.a("#7B3F00", "Chocolate");
7050 Color.a("#FFA700", "Chrome yellow");
7051 Color.a("#98817B", "Cinereous");
7052 Color.a("#E4D00A", "Citrine");
7053 Color.a("#9FA91F", "Citron");
7054 Color.a("#7F1734", "Claret");
7055 Color.a("#FBCCE7", "Classic rose");
7056 Color.a("#0047AB", "Cobalt");
7057 Color.a("#D2691E", "Cocoa brown");
7058 Color.a("#965A3E", "Coconut");
7059 Color.a("#6F4E37", "Coffee Brown");
7060 Color.a("#9BDDFF", "Columbia blue");
7061 Color.a("#002E63", "Cool black");
7062 Color.a("#8C92AC", "Cool grey");
7063 Color.a("#B87333", "Copper");
7064 Color.a("#AD6F69", "Copper penny");
7065 Color.a("#CB6D51", "Copper red");
7066 Color.a("#996666", "Copper rose");
7067 Color.a("#FF3800", "Coquelicot");
7068 Color.a("#FF7F50", "Coral");
7069 Color.a("#F88379", "Coral pink");
7070 Color.a("#FF4040", "Coral red");
7071 Color.a("#893F45", "Cordovan");
7072 Color.a("#FBEC5D", "Corn Yellow");
7073 Color.a("#B31B1B", "Cornell Red");
7074 Color.a("#6495ED", "Cornflower blue");
7075 Color.a("#FFF8DC", "Cornsilk");
7076 Color.a("#FFF8E7", "Cosmic latte");
7077 Color.a("#FFBCD9", "Cotton candy");
7078 Color.a("#FFFDD0", "Cream");
7079 Color.a("#DC143C", "Crimson");
7080 Color.a("#BE0032", "Crimson glory");
7081 Color.a("#00B7EB", "Cyan");
7082 Color.a("#58427C", "Cyber grape");
7083 Color.a("#FFD300", "Cyber yellow");
7084 Color.a("#FFFF31", "Daffodil");
7085 Color.a("#F0E130", "Dandelion");
7086 Color.a("#00008B", "Dark blue");
7087 Color.a("#666699", "Dark blue-gray");
7088 Color.a("#654321", "Dark brown");
7089 Color.a("#5D3954", "Dark byzantium");
7090 Color.a("#A40000", "Dark candy apple red");
7091 Color.a("#08457E", "Dark cerulean");
7092 Color.a("#986960", "Dark chestnut");
7093 Color.a("#CD5B45", "Dark coral");
7094 Color.a("#008B8B", "Dark cyan");
7095 Color.a("#536878", "Dark electric blue");
7096 Color.a("#B8860B", "Dark goldenrod");
7097 Color.a("#A9A9A9", "Dark gray");
7098 Color.a("#013220", "Dark green");
7099 Color.a("#00416A", "Dark imperial blue");
7100 Color.a("#1A2421", "Dark jungle green");
7101 Color.a("#BDB76B", "Dark khaki");
7102 Color.a("#734F96", "Dark lavender");
7103 Color.a("#534B4F", "Dark liver");
7104 Color.a("#543D37", "Dark liver (horses)");
7105 Color.a("#8B008B", "Dark magenta");
7106 Color.a("#003366", "Dark midnight blue");
7107 Color.a("#4A5D23", "Dark moss green");
7108 Color.a("#556B2F", "Dark olive green");
7109 Color.a("#FF8C00", "Dark orange");
7110 Color.a("#9932CC", "Dark orchid");
7111 Color.a("#779ECB", "Dark pastel blue");
7112 Color.a("#03C03C", "Dark pastel green");
7113 Color.a("#966FD6", "Dark pastel purple");
7114 Color.a("#C23B22", "Dark pastel red");
7115 Color.a("#E75480", "Dark pink");
7116 Color.a("#003399", "Dark powder blue");
7117 Color.a("#4F3A3C", "Dark puce");
7118 Color.a("#872657", "Dark raspberry");
7119 Color.a("#8B0000", "Dark red");
7120 Color.a("#E9967A", "Dark salmon");
7121 Color.a("#560319", "Dark Scarlet");
7122 Color.a("#8FBC8F", "Dark sea green");
7123 Color.a("#3C1414", "Dark sienna");
7124 Color.a("#8CBED6", "Dark sky blue");
7125 Color.a("#483D8B", "Dark slate blue");
7126 Color.a("#2F4F4F", "Dark slate gray");
7127 Color.a("#177245", "Dark spring green");
7128 Color.a("#918151", "Dark tan");
7129 Color.a("#FFA812", "Dark tangerine");
7130 Color.a("#CC4E5C", "Dark terra cotta");
7131 Color.a("#00CED1", "Dark turquoise");
7132 Color.a("#D1BEA8", "Dark vanilla");
7133 Color.a("#9400D3", "Dark violet");
7134 Color.a("#9B870C", "Dark yellow");
7135 Color.a("#00703C", "Dartmouth green");
7136 Color.a("#555555", "Davy's grey");
7137 Color.a("#D70A53", "Debian red");
7138 Color.a("#A9203E", "Deep carmine");
7139 Color.a("#EF3038", "Deep carmine pink");
7140 Color.a("#E9692C", "Deep carrot orange");
7141 Color.a("#DA3287", "Deep cerise");
7142 Color.a("#B94E48", "Deep chestnut");
7143 Color.a("#C154C1", "Deep fuchsia");
7144 Color.a("#004B49", "Deep jungle green");
7145 Color.a("#F5C71A", "Deep lemon");
7146 Color.a("#9955BB", "Deep lilac");
7147 Color.a("#CC00CC", "Deep magenta");
7148 Color.a("#D473D4", "Deep mauve");
7149 Color.a("#355E3B", "Deep moss green");
7150 Color.a("#FFCBA4", "Deep peach");
7151 Color.a("#A95C68", "Deep puce");
7152 Color.a("#843F5B", "Deep ruby");
7153 Color.a("#FF9933", "Deep saffron");
7154 Color.a("#00BFFF", "Deep sky blue");
7155 Color.a("#4A646C", "Deep Space Sparkle");
7156 Color.a("#7E5E60", "Deep Taupe");
7157 Color.a("#66424D", "Deep Tuscan red");
7158 Color.a("#BA8759", "Deer");
7159 Color.a("#1560BD", "Denim");
7160 Color.a("#EDC9AF", "Desert sand");
7161 Color.a("#EA3C53", "Desire");
7162 Color.a("#B9F2FF", "Diamond");
7163 Color.a("#696969", "Dim gray");
7164 Color.a("#9B7653", "Dirt");
7165 Color.a("#1E90FF", "Dodger blue");
7166 Color.a("#D71868", "Dogwood rose");
7167 Color.a("#85BB65", "Dollar bill");
7168 Color.a("#664C28", "Donkey Brown");
7169 Color.a("#00009C", "Duke blue");
7170 Color.a("#E5CCC9", "Dust storm");
7171 Color.a("#EFDFBB", "Dutch white");
7172 Color.a("#E1A95F", "Earth yellow");
7173 Color.a("#555D50", "Ebony");
7174 Color.a("#1B1B1B", "Logan's old colour </3"); //Logan's old colour </3
7175 Color.a("#614051", "Eggplant");
7176 Color.a("#F0EAD6", "Eggshell");
7177 Color.a("#1034A6", "Egyptian blue");
7178 Color.a("#7DF9FF", "Electric blue");
7179 Color.a("#FF003F", "Electric crimson");
7180 Color.a("#00FF00", "Electric green");
7181 Color.a("#6F00FF", "Electric indigo");
7182 Color.a("#CCFF00", "Electric lime");
7183 Color.a("#BF00FF", "Electric purple");
7184 Color.a("#3F00FF", "Electric ultramarine");
7185 Color.a("#FFFF00", "Electric yellow");
7186 Color.a("#50C878", "Emerald");
7187 Color.a("#6C3082", "Eminence");
7188 Color.a("#1B4D3E", "English green");
7189 Color.a("#B48395", "English lavender");
7190 Color.a("#AB4B52", "English red");
7191 Color.a("#563C5C", "English violet");
7192 Color.a("#96C8A2", "Eton blue");
7193 Color.a("#44D7A8", "Eucalyptus");
7194 Color.a("#801818", "Falu red");
7195 Color.a("#B53389", "Fandango");
7196 Color.a("#DE5285", "Fandango pink");
7197 Color.a("#F400A1", "Fashion fuchsia");
7198 Color.a("#E5AA70", "Fawn");
7199 Color.a("#4D5D53", "Feldgrau");
7200 Color.a("#4F7942", "Fern green");
7201 Color.a("#FF2800", "Ferrari Red");
7202 Color.a("#6C541E", "Field drab");
7203 Color.a("#B22222", "Firebrick");
7204 Color.a("#CE2029", "Fire engine red");
7205 Color.a("#E25822", "Flame");
7206 Color.a("#FC8EAC", "Flamingo pink");
7207 Color.a("#F7E98E", "Flavescent"); //Logan's new stupid colour?
7208 Color.a("#EEDC82", "Flax");
7209 Color.a("#A2006D", "Flirt");
7210 Color.a("#FFFAF0", "Floral white");
7211 Color.a("#FFBF00", "Fluorescent orange");
7212 Color.a("#FF1493", "Fluorescent pink");
7213 Color.a("#FF004F", "Folly");
7214 Color.a("#014421", "Forest green");
7215 Color.a("#228B22", "Forest green (web)");
7216 Color.a("#856D4D", "French bistre");
7217 Color.a("#0072BB", "French blue");
7218 Color.a("#FD3F92", "French fuchsia");
7219 Color.a("#86608E", "French lilac");
7220 Color.a("#9EFD38", "French lime");
7221 Color.a("#FD6C9E", "French pink");
7222 Color.a("#4E1609", "French puce");
7223 Color.a("#C72C48", "French raspberry");
7224 Color.a("#F64A8A", "French rose");
7225 Color.a("#77B5FE", "French sky blue");
7226 Color.a("#8806CE", "French violet");
7227 Color.a("#AC1E44", "French wine");
7228 Color.a("#A6E7FF", "Fresh Air");
7229 Color.a("#FF77FF", "Fuchsia pink");
7230 Color.a("#CC397B", "Fuchsia purple");
7231 Color.a("#C74375", "Fuchsia rose");
7232 Color.a("#E48400", "Fulvous");
7233 Color.a("#CC6666", "Fuzzy Wuzzy");
7234 Color.a("#DCDCDC", "Gainsboro");
7235 Color.a("#E49B0F", "Gamboge");
7236 Color.a("#007F66", "Generic viridian");
7237 Color.a("#F8F8FF", "Ghost white");
7238 Color.a("#FE5A1D", "Giants orange");
7239 Color.a("#B06500", "Ginger");
7240 Color.a("#6082B6", "Glaucous");
7241 Color.a("#E6E8FA", "Glitter");
7242 Color.a("#00AB66", "GO green");
7243 Color.a("#D4AF37", "Gold (metallic)");
7244 Color.a("#FFD700", "Gold (web) (Golden)");
7245 Color.a("#85754E", "Gold Fusion");
7246 Color.a("#996515", "Golden brown");
7247 Color.a("#FCC200", "Golden poppy");
7248 Color.a("#FFDF00", "Golden yellow");
7249 Color.a("#DAA520", "Goldenrod");
7250 Color.a("#A8E4A0", "Granny Smith Apple");
7251 Color.a("#6F2DA8", "Grape");
7252 Color.a("#808080", "Gray");
7253 Color.a("#BEBEBE", "Gray (X11 gray)");
7254 Color.a("#465945", "Gray-asparagus");
7255 Color.a("#1CAC78", "Green (Crayola)");
7256 Color.a("#008000", "Green");
7257 Color.a("#00A877", "Green (Munsell)");
7258 Color.a("#009F6B", "Green (NCS)");
7259 Color.a("#00A550", "Green (pigment)");
7260 Color.a("#66B032", "Green (RYB)");
7261 Color.a("#ADFF2F", "Green-yellow");
7262 Color.a("#A99A86", "Grullo");
7263 Color.a("#663854", "Halaya ube");
7264 Color.a("#446CCF", "Han blue");
7265 Color.a("#5218FA", "Beyonce Purple");
7266 Color.a("#E9D66B", "Hansa yellow");
7267 Color.a("#3FFF00", "Harlequin");
7268 Color.a("#C90016", "Harvard crimson");
7269 Color.a("#DA9100", "Harvest gold");
7270 Color.a("#DF73FF", "Heliotrope");
7271 Color.a("#AA98A9", "Heliotrope gray");
7272 Color.a("#F0FFF0", "Honeydew");
7273 Color.a("#006DB0", "Honolulu blue");
7274 Color.a("#49796B", "Chloe's green");
7275 Color.a("#FF1DCE", "Hot magenta");
7276 Color.a("#FF69B4", "Hot pink");
7277 Color.a("#71A6D2", "Iceberg");
7278 Color.a("#FCF75E", "Icterine");
7279 Color.a("#319177", "Illuminating Emerald");
7280 Color.a("#602F6B", "Imperial");
7281 Color.a("#002395", "Imperial blue");
7282 Color.a("#66023C", "Imperial purple");
7283 Color.a("#ED2939", "Imperial red");
7284 Color.a("#B2EC5D", "Inchworm");
7285 Color.a("#4C516D", "Independence");
7286 Color.a("#138808", "India green");
7287 Color.a("#CD5C5C", "Indian red");
7288 Color.a("#E3A857", "Indian yellow");
7289 Color.a("#4B0082", "Indigo");
7290 Color.a("#002FA7", "International Klein Blue");
7291 Color.a("#FF4F00", "International orange (aerospace)");
7292 Color.a("#BA160C", "International orange (engineering)");
7293 Color.a("#C0362C", "International orange (Golden Gate Bridge)");
7294 Color.a("#5A4FCF", "Iris");
7295 Color.a("#F4F0EC", "Isabelline");
7296 Color.a("#009000", "Islamic green");
7297 Color.a("#B2FFFF", "Italian sky blue");
7298 Color.a("#FFFFF0", "Ivory");
7299 Color.a("#00A86B", "Jade");
7300 Color.a("#9D2933", "Japanese carmine");
7301 Color.a("#264348", "Japanese indigo");
7302 Color.a("#5B3256", "Japanese violet");
7303 Color.a("#D73B3E", "Jasper");
7304 Color.a("#A50B5E", "Jazzberry jam");
7305 Color.a("#DA614E", "Jelly Bean");
7306 Color.a("#343434", "Jet");
7307 Color.a("#F4CA16", "Jonquil");
7308 Color.a("#8AB9F1", "Jordy blue");
7309 Color.a("#BDDA57", "June bud");
7310 Color.a("#29AB87", "Jungle green");
7311 Color.a("#4CBB17", "Kelly green");
7312 Color.a("#7C1C05", "Kenyan copper");
7313 Color.a("#3AB09E", "Keppel");
7314 Color.a("#C3B091", "Khaki");
7315 Color.a("#E79FC4", "Kobi");
7316 Color.a("#354230", "Kombu green");
7317 Color.a("#E8000D", "KU Crimson");
7318 Color.a("#087830", "La Salle Green");
7319 Color.a("#D6CADD", "Languid lavender");
7320 Color.a("#26619C", "Lapis lazuli");
7321 Color.a("#A9BA9D", "Laurel green");
7322 Color.a("#CF1020", "Lava");
7323 Color.a("#B57EDC", "Lavender (floral)");
7324 Color.a("#CCCCFF", "Lavender blue");
7325 Color.a("#FFF0F5", "Lavender blush");
7326 Color.a("#C4C3D0", "Lavender gray");
7327 Color.a("#9457EB", "Lavender indigo");
7328 Color.a("#EE82EE", "Lavender magenta");
7329 Color.a("#E6E6FA", "Lavender mist");
7330 Color.a("#FBAED2", "Lavender pink");
7331 Color.a("#967BB6", "Lavender purple");
7332 Color.a("#FBA0E3", "Lavender rose");
7333 Color.a("#7CFC00", "Lawn green");
7334 Color.a("#FFF700", "Lemon");
7335 Color.a("#FFFACD", "Lemon chiffon");
7336 Color.a("#CCA01D", "Lemon curry");
7337 Color.a("#FDFF00", "Lemon glacier");
7338 Color.a("#E3FF00", "Lemon lime");
7339 Color.a("#F6EABE", "Lemon meringue");
7340 Color.a("#FFF44F", "Lemon yellow");
7341 Color.a("#1A1110", "Licorice");
7342 Color.a("#545AA7", "Liberty");
7343 Color.a("#FDD5B1", "Light apricot");
7344 Color.a("#ADD8E6", "Light blue");
7345 Color.a("#B5651D", "Light brown");
7346 Color.a("#E66771", "Light carmine pink");
7347 Color.a("#F08080", "Light coral");
7348 Color.a("#93CCEA", "Light cornflower blue");
7349 Color.a("#F56991", "Light crimson");
7350 Color.a("#E0FFFF", "Light cyan");
7351 Color.a("#FF5CCD", "Light deep pink");
7352 Color.a("#C8AD7F", "Light French beige");
7353 Color.a("#F984EF", "Light fuchsia pink");
7354 Color.a("#FAFAD2", "Light goldenrod yellow");
7355 Color.a("#D3D3D3", "Light gray");
7356 Color.a("#90EE90", "Light green");
7357 Color.a("#FFB3DE", "Light hot pink");
7358 Color.a("#F0E68C", "Light khaki");
7359 Color.a("#D39BCB", "Light medium orchid");
7360 Color.a("#ADDFAD", "Light moss green");
7361 Color.a("#E6A8D7", "Light orchid");
7362 Color.a("#B19CD9", "Light pastel purple");
7363 Color.a("#FFB6C1", "Light pink");
7364 Color.a("#E97451", "Light red ochre");
7365 Color.a("#FFA07A", "Light salmon");
7366 Color.a("#FF9999", "Light salmon pink");
7367 Color.a("#20B2AA", "Light sea green");
7368 Color.a("#87CEFA", "Light sky blue");
7369 Color.a("#778899", "Light slate gray");
7370 Color.a("#B0C4DE", "Light steel blue");
7371 Color.a("#B38B6D", "Light taupe");
7372 Color.a("#FFFFE0", "Light yellow");
7373 Color.a("#C8A2C8", "Lilac");
7374 Color.a("#BFFF00", "Lime");
7375 Color.a("#32CD32", "Lime green");
7376 Color.a("#9DC209", "Limerick");
7377 Color.a("#195905", "Prostitute green");
7378 Color.a("#FAF0E6", "Linen");
7379 Color.a("#6CA0DC", "Little boy blue");
7380 Color.a("#B86D29", "Liver (dogs)");
7381 Color.a("#6C2E1F", "Liver");
7382 Color.a("#987456", "Liver chestnut");
7383 Color.a("#FFE4CD", "Lumber");
7384 Color.a("#E62020", "Lust");
7385 Color.a("#FF00FF", "Magenta");
7386 Color.a("#CA1F7B", "Magenta (dye)");
7387 Color.a("#D0417E", "Magenta (Pantone)");
7388 Color.a("#FF0090", "Magenta (process)");
7389 Color.a("#9F4576", "Magenta haze");
7390 Color.a("#AAF0D1", "Magic mint");
7391 Color.a("#F8F4FF", "Magnolia");
7392 Color.a("#C04000", "Mahogany");
7393 Color.a("#6050DC", "Majorelle Blue");
7394 Color.a("#0BDA51", "Malachite");
7395 Color.a("#979AAA", "Manatee");
7396 Color.a("#FF8243", "Mango Tango");
7397 Color.a("#74C365", "Mantis"); //The colour of Mantis (#78cb53) - new fav colour
7398 Color.a("#880085", "Mardi Gras");
7399 Color.a("#800000", "Maroon");
7400 Color.a("#E0B0FF", "Mauve");
7401 Color.a("#915F6D", "Mauve taupe");
7402 Color.a("#EF98AA", "Mauvelous");
7403 Color.a("#4C9141", "May green");
7404 Color.a("#73C2FB", "Maya blue");
7405 Color.a("#E5B73B", "Golden");
7406 Color.a("#66DDAA", "Medium aquamarine");
7407 Color.a("#0000CD", "Medium blue");
7408 Color.a("#E2062C", "Medium candy apple red");
7409 Color.a("#AF4035", "Medium carmine");
7410 Color.a("#035096", "Medium electric blue");
7411 Color.a("#1C352D", "Medium jungle green");
7412 Color.a("#BA55D3", "Medium orchid");
7413 Color.a("#9370DB", "Medium purple");
7414 Color.a("#BB3385", "Medium red-violet");
7415 Color.a("#AA4069", "Medium ruby");
7416 Color.a("#3CB371", "Medium sea green");
7417 Color.a("#80DAEB", "Medium sky blue");
7418 Color.a("#7B68EE", "Medium slate blue");
7419 Color.a("#C9DC87", "Medium spring bud");
7420 Color.a("#00FA9A", "Medium spring green");
7421 Color.a("#674C47", "Medium taupe");
7422 Color.a("#48D1CC", "Medium turquoise");
7423 Color.a("#D9603B", "Pale vermilion");
7424 Color.a("#F8B878", "Mellow apricot");
7425 Color.a("#F8DE7E", "Mellow yellow");
7426 Color.a("#FDBCB4", "Melon");
7427 Color.a("#0A7E8C", "Metallic Seaweed");
7428 Color.a("#9C7C38", "Metallic Sunburst");
7429 Color.a("#E4007C", "Mexican pink");
7430 Color.a("#191970", "Midnight blue");
7431 Color.a("#004953", "Midnight green (eagle green)");
7432 Color.a("#FFC40C", "Mikado yellow");
7433 Color.a("#E3F988", "Mindaro");
7434 Color.a("#3EB489", "Mint");
7435 Color.a("#F5FFFA", "Mint cream");
7436 Color.a("#98FF98", "Mint green");
7437 Color.a("#FFE4E1", "Misty rose");
7438 Color.a("#73A9C2", "Moonstone blue");
7439 Color.a("#AE0C00", "Mordant red 19");
7440 Color.a("#8A9A5B", "Moss green");
7441 Color.a("#30BA8F", "Mountain Meadow");
7442 Color.a("#997A8D", "Mountbatten pink");
7443 Color.a("#18453B", "MSU Green");
7444 Color.a("#306030", "Mughal green");
7445 Color.a("#C54B8C", "Mulberry");
7446 Color.a("#FFDB58", "Mustard");
7447 Color.a("#317873", "Myrtle green");
7448 Color.a("#F6ADC6", "Nadeshiko pink");
7449 Color.a("#2A8000", "Napier green");
7450 Color.a("#FFDEAD", "Navajo white");
7451 Color.a("#000080", "Navy");
7452 Color.a("#FFA343", "Neon Carrot");
7453 Color.a("#FE4164", "Neon fuchsia");
7454 Color.a("#39FF14", "Neon green");
7455 Color.a("#214FC6", "New Car");
7456 Color.a("#D7837F", "New York pink");
7457 Color.a("#A4DDED", "Non-photo blue");
7458 Color.a("#059033", "North Texas Green");
7459 Color.a("#E9FFDB", "Nyanza");
7460 Color.a("#0077BE", "Ocean Boat Blue");
7461 Color.a("#CC7722", "Ochre");
7462 Color.a("#43302E", "Old burgundy");
7463 Color.a("#CFB53B", "Old gold");
7464 Color.a("#FDF5E6", "Old lace");
7465 Color.a("#796878", "Old lavender");
7466 Color.a("#673147", "Old mauve");
7467 Color.a("#867E36", "Old moss green");
7468 Color.a("#C08081", "Old rose");
7469 Color.a("#808000", "Olive");
7470 Color.a("#6B8E23", "Olive Drab #3");
7471 Color.a("#3C341F", "Olive Drab #7");
7472 Color.a("#9AB973", "Olivine");
7473 Color.a("#353839", "Onyx");
7474 Color.a("#B784A7", "Opera mauve");
7475 Color.a("#FF7F00", "Orange");
7476 Color.a("#FF7538", "Orange (Crayola)");
7477 Color.a("#FF5800", "Orange (Pantone)");
7478 Color.a("#FB9902", "Orange (RYB)");
7479 Color.a("#FFA500", "Orange (web)");
7480 Color.a("#FF9F00", "Orange peel");
7481 Color.a("#FF4500", "Orange-red");
7482 Color.a("#DA70D6", "Orchid");
7483 Color.a("#F2BDCD", "Orchid pink");
7484 Color.a("#FB4F14", "Orioles orange");
7485 Color.a("#414A4C", "Outer Space");
7486 Color.a("#FF6E4A", "Outrageous Orange");
7487 Color.a("#002147", "Oxford Blue");
7488 Color.a("#990000", "Crimson Red");
7489 Color.a("#006600", "Pakistan green");
7490 Color.a("#273BE2", "Palatinate blue");
7491 Color.a("#682860", "Palatinate purple");
7492 Color.a("#BCD4E6", "Pale aqua");
7493 Color.a("#AFEEEE", "Pale blue");
7494 Color.a("#987654", "Pale brown");
7495 Color.a("#9BC4E2", "Pale cerulean");
7496 Color.a("#DDADAF", "Pale chestnut");
7497 Color.a("#DA8A67", "Pale copper");
7498 Color.a("#ABCDEF", "Pale cornflower blue");
7499 Color.a("#E6BE8A", "Pale gold");
7500 Color.a("#EEE8AA", "Pale goldenrod");
7501 Color.a("#98FB98", "Pale green");
7502 Color.a("#DCD0FF", "Pale lavender");
7503 Color.a("#F984E5", "Pale magenta");
7504 Color.a("#FADADD", "Pale pink");
7505 Color.a("#DDA0DD", "Pale plum");
7506 Color.a("#DB7093", "Nipple");
7507 Color.a("#96DED1", "Pale robin egg blue");
7508 Color.a("#C9C0BB", "Pale silver");
7509 Color.a("#ECEBBD", "Pale spring bud");
7510 Color.a("#BC987E", "Pale taupe");
7511 Color.a("#78184A", "Pansy purple");
7512 Color.a("#009B7D", "Paolo Veronese green");
7513 Color.a("#FFEFD5", "Papaya whip");
7514 Color.a("#E63E62", "Paradise pink");
7515 Color.a("#AEC6CF", "Pastel blue");
7516 Color.a("#836953", "Pastel brown");
7517 Color.a("#CFCFC4", "Pastel gray");
7518 Color.a("#77DD77", "Pastel green");
7519 Color.a("#F49AC2", "Pastel magenta");
7520 Color.a("#FFB347", "Pastel orange");
7521 Color.a("#DEA5A4", "Pastel pink");
7522 Color.a("#B39EB5", "Pastel purple");
7523 Color.a("#FF6961", "Pastel red");
7524 Color.a("#CB99C9", "Pastel violet");
7525 Color.a("#FDFD96", "Pastel yellow");
7526 Color.a("#FFE5B4", "Peach");
7527 Color.a("#FFCC99", "Peach-orange");
7528 Color.a("#FFDAB9", "Peach puff");
7529 Color.a("#FADFAD", "Peach-yellow");
7530 Color.a("#D1E231", "Pear");
7531 Color.a("#EAE0C8", "Pearl");
7532 Color.a("#88D8C0", "Dolphin Aqua");
7533 Color.a("#B768A2", "Pearly purple");
7534 Color.a("#E6E200", "Peridot");
7535 Color.a("#1C39BB", "Persian blue");
7536 Color.a("#00A693", "Persian green");
7537 Color.a("#32127A", "Persian indigo");
7538 Color.a("#D99058", "Persian orange");
7539 Color.a("#F77FBE", "Persian pink");
7540 Color.a("#701C1C", "Persian plum");
7541 Color.a("#CC3333", "Persian red");
7542 Color.a("#FE28A2", "Persian rose");
7543 Color.a("#EC5800", "Persimmon");
7544 Color.a("#CD853F", "Peru");
7545 Color.a("#000F89", "Phthalo blue");
7546 Color.a("#123524", "Phthalo green");
7547 Color.a("#45B1E8", "Picton blue");
7548 Color.a("#C30B4E", "Pictorial carmine");
7549 Color.a("#FDDDE6", "Piggy pink");
7550 Color.a("#01796F", "Pine green");
7551 Color.a("#FFC0CB", "Pink");
7552 Color.a("#D74894", "Pink (Pantone)");
7553 Color.a("#FFDDF4", "Pink lace");
7554 Color.a("#D8B2D1", "Pink lavender");
7555 Color.a("#FF9966", "Pink-orange");
7556 Color.a("#E7ACCF", "Pink pearl");
7557 Color.a("#F78FA7", "Pink Sherbet");
7558 Color.a("#93C572", "Pistachio");
7559 Color.a("#E5E4E2", "Platinum");
7560 Color.a("#8E4585", "Plum");
7561 Color.a("#BE4F62", "Popstar");
7562 Color.a("#FF5A36", "Portland Orange");
7563 Color.a("#B0E0E6", "Powder blue");
7564 Color.a("#FF8F00", "Princeton orange");
7565 Color.a("#003153", "Prussian blue");
7566 Color.a("#DF00FF", "Psychedelic purple");
7567 Color.a("#CC8899", "Puce");
7568 Color.a("#644117", "Pullman Brown (UPS Brown)");
7569 Color.a("#FF7518", "Pumpkin");
7570 Color.a("#800080", "Purple");
7571 Color.a("#9F00C5", "Purple (Munsell)");
7572 Color.a("#A020F0", "Purple");
7573 Color.a("#69359C", "Purple Heart");
7574 Color.a("#9678B6", "Purple mountain majesty");
7575 Color.a("#4E5180", "Purple navy");
7576 Color.a("#FE4EDA", "Purple pizzazz");
7577 Color.a("#50404D", "Purple taupe");
7578 Color.a("#9A4EAE", "Purpureus");
7579 Color.a("#51484F", "Quartz");
7580 Color.a("#436B95", "Queen blue");
7581 Color.a("#E8CCD7", "Queen pink");
7582 Color.a("#8E3A59", "Quinacridone magenta");
7583 Color.a("#FF355E", "Radical Red");
7584 Color.a("#FBAB60", "Rajah");
7585 Color.a("#E30B5D", "Raspberry");
7586 Color.a("#E25098", "Raspberry pink");
7587 Color.a("#B3446C", "Raspberry rose");
7588 Color.a("#826644", "Raw umber");
7589 Color.a("#FF33CC", "Razzle dazzle rose");
7590 Color.a("#E3256B", "Razzmatazz");
7591 Color.a("#8D4E85", "Razzmic Berry");
7592 Color.a("#FF0000", "Red");
7593 Color.a("#EE204D", "Red (Crayola)");
7594 Color.a("#F2003C", "Red (Munsell)");
7595 Color.a("#C40233", "Red (NCS)");
7596 Color.a("#ED1C24", "Red (pigment)");
7597 Color.a("#FE2712", "Red (RYB)");
7598 Color.a("#A52A2A", "Red-brown");
7599 Color.a("#860111", "Red devil");
7600 Color.a("#FF5349", "Red-orange");
7601 Color.a("#E40078", "Red-purple");
7602 Color.a("#C71585", "Red-violet");
7603 Color.a("#A45A52", "Redwood");
7604 Color.a("#522D80", "Regalia");
7605 Color.a("#002387", "Resolution blue");
7606 Color.a("#777696", "Rhythm");
7607 Color.a("#004040", "Rich black");
7608 Color.a("#F1A7FE", "Rich brilliant lavender");
7609 Color.a("#D70040", "Rich carmine");
7610 Color.a("#0892D0", "Rich electric blue");
7611 Color.a("#A76BCF", "Rich lavender");
7612 Color.a("#B666D2", "Rich lilac");
7613 Color.a("#B03060", "Rich maroon");
7614 Color.a("#444C38", "Rifle green");
7615 Color.a("#704241", "Deep Roast coffee");
7616 Color.a("#00CCCC", "Robin egg blue");
7617 Color.a("#8A7F80", "Rocket metallic");
7618 Color.a("#838996", "Roman silver");
7619 Color.a("#F9429E", "Rose bonbon");
7620 Color.a("#674846", "Rose ebony");
7621 Color.a("#B76E79", "Rose gold");
7622 Color.a("#FF66CC", "Rose pink");
7623 Color.a("#C21E56", "Rose red");
7624 Color.a("#905D5D", "Rose taupe");
7625 Color.a("#AB4E52", "Rose vale");
7626 Color.a("#65000B", "Rosewood");
7627 Color.a("#D40000", "Rosso corsa");
7628 Color.a("#BC8F8F", "Rosy brown");
7629 Color.a("#0038A8", "Royal azure");
7630 Color.a("#002366", "Royal blue");
7631 Color.a("#4169E1", "Royal light blue");
7632 Color.a("#CA2C92", "Royal fuchsia");
7633 Color.a("#7851A9", "Royal purple");
7634 Color.a("#FADA5E", "Royal yellow");
7635 Color.a("#CE4676", "Ruber");
7636 Color.a("#D10056", "Rubine red");
7637 Color.a("#E0115F", "Ruby");
7638 Color.a("#9B111E", "Ruby red");
7639 Color.a("#FF0028", "Ruddy");
7640 Color.a("#BB6528", "Ruddy brown");
7641 Color.a("#E18E96", "Ruddy pink");
7642 Color.a("#A81C07", "Rufous");
7643 Color.a("#80461B", "Russet");
7644 Color.a("#679267", "Russian green");
7645 Color.a("#32174D", "Russian violet");
7646 Color.a("#B7410E", "Rust");
7647 Color.a("#DA2C43", "Rusty red");
7648 Color.a("#8B4513", "Saddle brown");
7649 Color.a("#FF6700", "Safety orange (blaze orange)");
7650 Color.a("#EED202", "Safety yellow");
7651 Color.a("#F4C430", "Saffron");
7652 Color.a("#BCB88A", "Sage");
7653 Color.a("#23297A", "St. Patrick's blue");
7654 Color.a("#FA8072", "Salmon");
7655 Color.a("#FF91A4", "Salmon pink");
7656 Color.a("#C2B280", "Sand");
7657 Color.a("#ECD540", "Sandstorm");
7658 Color.a("#F4A460", "Sandy brown");
7659 Color.a("#92000A", "Sangria");
7660 Color.a("#507D2A", "Sap green");
7661 Color.a("#0F52BA", "Sapphire");
7662 Color.a("#0067A5", "Sapphire blue");
7663 Color.a("#CBA135", "Satin sheen gold");
7664 Color.a("#FF2400", "Scarlet");
7665 Color.a("#FFD800", "School bus yellow");
7666 Color.a("#76FF7A", "Screamin' Green");
7667 Color.a("#006994", "Sea blue");
7668 Color.a("#2E8B57", "Sea green");
7669 Color.a("#321414", "Seal brown");
7670 Color.a("#FFF5EE", "Seashell");
7671 Color.a("#FFBA00", "Selective yellow");
7672 Color.a("#704214", "Sepia");
7673 Color.a("#8A795D", "Shadow");
7674 Color.a("#778BA5", "Shadow blue");
7675 Color.a("#FFCFF1", "Shampoo");
7676 Color.a("#009E60", "Shamrock green");
7677 Color.a("#8FD400", "Sheen Green");
7678 Color.a("#D98695", "Shimmering Blush");
7679 Color.a("#FC0FC0", "Shocking pink");
7680 Color.a("#882D17", "Sienna");
7681 Color.a("#C0C0C0", "Silver");
7682 Color.a("#ACACAC", "Silver chalice");
7683 Color.a("#5D89BA", "Silver Lake blue");
7684 Color.a("#C4AEAD", "Silver pink");
7685 Color.a("#BFC1C2", "Silver sand");
7686 Color.a("#CB410B", "Sinopia");
7687 Color.a("#007474", "Skobeloff");
7688 Color.a("#87CEEB", "Sky blue");
7689 Color.a("#CF71AF", "Sky magenta");
7690 Color.a("#6A5ACD", "Slate blue");
7691 Color.a("#708090", "Slate gray");
7692 Color.a("#C84186", "Smitten");
7693 Color.a("#738276", "Smoke");
7694 Color.a("#933D41", "Smokey topaz");
7695 Color.a("#100C08", "Smoky black");
7696 Color.a("#FFFAFA", "Snow");
7697 Color.a("#CEC8EF", "Soap");
7698 Color.a("#893843", "Solid pink");
7699 Color.a("#757575", "Sonic silver");
7700 Color.a("#9E1316", "Spartan Crimson");
7701 Color.a("#1D2951", "Space cadet");
7702 Color.a("#807532", "Spanish bistre");
7703 Color.a("#0070B8", "Spanish blue");
7704 Color.a("#D10047", "Spanish carmine");
7705 Color.a("#E51A4C", "Spanish crimson");
7706 Color.a("#989898", "Spanish gray");
7707 Color.a("#009150", "Spanish green");
7708 Color.a("#E86100", "Spanish orange");
7709 Color.a("#F7BFBE", "Spanish pink");
7710 Color.a("#E60026", "Spanish red");
7711 Color.a("#4C2882", "Spanish violet");
7712 Color.a("#007F5C", "Spanish viridian");
7713 Color.a("#0FC0FC", "Spiro Disco Ball");
7714 Color.a("#A7FC00", "Spring bud");
7715 Color.a("#00FF7F", "Spring green");
7716 Color.a("#007BB8", "Star command blue");
7717 Color.a("#4682B4", "Steel blue");
7718 Color.a("#CC33CC", "Steel pink");
7719 Color.a("#4F666A", "Stormcloud");
7720 Color.a("#E4D96F", "Straw");
7721 Color.a("#FC5A8D", "Strawberry");
7722 Color.a("#FFCC33", "Sunglow");
7723 Color.a("#E3AB57", "Sunray");
7724 Color.a("#FAD6A5", "Sunset");
7725 Color.a("#FD5E53", "Sunset orange");
7726 Color.a("#CF6BA9", "Super pink");
7727 Color.a("#D2B48C", "Tan");
7728 Color.a("#F94D00", "Tangelo");
7729 Color.a("#F28500", "Tangerine");
7730 Color.a("#FFCC00", "Tangerine yellow");
7731 Color.a("#483C32", "Dark Grayish Brown");
7732 Color.a("#8B8589", "Taupe gray");
7733 Color.a("#D0F0C0", "Tea green");
7734 Color.a("#F4C2C2", "Tea rose");
7735 Color.a("#008080", "Teal");
7736 Color.a("#367588", "Teal blue");
7737 Color.a("#99E6B3", "Teal deer");
7738 Color.a("#00827F", "Teal green");
7739 Color.a("#CF3476", "Telemagenta");
7740 Color.a("#CD5700", "Tenne");
7741 Color.a("#E2725B", "Terra cotta");
7742 Color.a("#D8BFD8", "Thistle");
7743 Color.a("#DE6FA1", "Thulian pink");
7744 Color.a("#FC89AC", "Tickle Me Pink");
7745 Color.a("#0ABAB5", "Tiffany Blue");
7746 Color.a("#E08D3C", "Tiger's eye");
7747 Color.a("#DBD7D2", "Timberwolf");
7748 Color.a("#EEE600", "Titanium yellow");
7749 Color.a("#FF6347", "Tomato");
7750 Color.a("#746CC0", "Toolbox");
7751 Color.a("#FFC87C", "Topaz");
7752 Color.a("#FD0E35", "Tractor red");
7753 Color.a("#00755E", "Tropical rain forest");
7754 Color.a("#0073CF", "True Blue");
7755 Color.a("#417DC1", "Tufts Blue");
7756 Color.a("#FF878D", "Tulip");
7757 Color.a("#DEAA88", "Tumbleweed");
7758 Color.a("#B57281", "Turkish rose");
7759 Color.a("#40E0D0", "Turquoise");
7760 Color.a("#00FFEF", "Turquoise blue");
7761 Color.a("#A0D6B4", "Turquoise green");
7762 Color.a("#7C4848", "Tuscan red");
7763 Color.a("#C09999", "Tuscany");
7764 Color.a("#8A496B", "Twilight lavender");
7765 Color.a("#0033AA", "UA blue");
7766 Color.a("#D9004C", "UA red");
7767 Color.a("#8878C3", "Ube");
7768 Color.a("#536895", "UCLA Blue");
7769 Color.a("#FFB300", "UCLA Gold");
7770 Color.a("#3CD070", "UFO Green");
7771 Color.a("#120A8F", "Ultramarine");
7772 Color.a("#4166F5", "Ultramarine blue");
7773 Color.a("#FF6FFF", "Ultra pink");
7774 Color.a("#635147", "Umber");
7775 Color.a("#FFDDCA", "Unbleached silk");
7776 Color.a("#5B92E5", "United Nations blue");
7777 Color.a("#B78727", "University of California Gold");
7778 Color.a("#FFFF66", "Unmellow yellow");
7779 Color.a("#7B1113", "UP Maroon");
7780 Color.a("#AE2029", "Upsdell red");
7781 Color.a("#E1AD21", "Urobilin");
7782 Color.a("#004F98", "USAFA blue");
7783 Color.a("#F77F00", "University of Tennessee Orange");
7784 Color.a("#D3003F", "Utah Crimson");
7785 Color.a("#F3E5AB", "Vanilla");
7786 Color.a("#F38FA9", "Vanilla ice");
7787 Color.a("#C5B358", "Vegas gold");
7788 Color.a("#C80815", "Venetian red");
7789 Color.a("#43B3AE", "Verdigris");
7790 Color.a("#E34234", "Medium vermilion");
7791 Color.a("#D9381E", "Vermilion");
7792 Color.a("#8F00FF", "Violet");
7793 Color.a("#7F00FF", "Violet (color wheel)");
7794 Color.a("#8601AF", "Violet (RYB)");
7795 Color.a("#324AB2", "Logie Bear");
7796 Color.a("#F75394", "Violet-red");
7797 Color.a("#40826D", "Viridian");
7798 Color.a("#009698", "Viridian green");
7799 Color.a("#922724", "Vivid auburn");
7800 Color.a("#9F1D35", "Vivid burgundy");
7801 Color.a("#DA1D81", "Vivid cerise");
7802 Color.a("#CC00FF", "Vivid orchid");
7803 Color.a("#00CCFF", "Vivid sky blue");
7804 Color.a("#FFA089", "Vivid tangerine");
7805 Color.a("#9F00FF", "Vivid violet");
7806 Color.a("#004242", "Warm black");
7807 Color.a("#A4F4F9", "Waterspout");
7808 Color.a("#645452", "Wenge");
7809 Color.a("#F5DEB3", "Wheat");
7810 Color.a("#FFFFFF", "White");
7811 Color.a("#F5F5F5", "White smoke");
7812 Color.a("#A2ADD0", "Wild blue yonder");
7813 Color.a("#D470A2", "Wild orchid");
7814 Color.a("#FF43A4", "Wild Strawberry");
7815 Color.a("#FC6C85", "Wild watermelon");
7816 Color.a("#FD5800", "Willpower orange");
7817 Color.a("#A75502", "Windsor tan");
7818 Color.a("#722F37", "Wine");
7819 Color.a("#C9A0DC", "Wisteria");
7820 Color.a("#C19A6B", "Wood brown");
7821 Color.a("#738678", "Xanadu");
7822 Color.a("#0F4D92", "Yale Blue");
7823 Color.a("#1C2841", "Yankees blue");
7824 Color.a("#FCE883", "Yellow Crayola");
7825 Color.a("#EFCC00", "Yellow Munsell");
7826 Color.a("#FEDF00", "Yellow Pantone");
7827 Color.a("#FEFE33", "Yellow");
7828 Color.a("#9ACD32", "Yellow Green");
7829 Color.a("#FFAE42", "Yellow Orange");
7830 Color.a("#FFF000", "Yellow rose");
7831 Color.a("#0014A8", "Zaffre");
7832 Color.a("#2C1608", "Zinnwaldite brown");
7833 Color.a("#39A78E", "Zomp");
7834
7835 // where it receives the message
7836 gClient.on("a", function (msg) {
7837 chat.receive(msg);
7838 });
7839
7840 $("#chat input").on("focus", function (evt) {
7841 releaseKeyboard();
7842 $("#chat").addClass("chatting");
7843 chat.scrollToBottom();
7844 });
7845
7846 $(document).mousedown(function (evt) {
7847 if (!$("#chat").has(evt.target).length > 0) {
7848 chat.blur();
7849 }
7850 });
7851
7852 document.addEventListener("touchstart", function (event) {
7853 for (var i in event.changedTouches) {
7854 var touch = event.changedTouches[i];
7855 if (!$("#chat").has(touch.target).length > 0) {
7856 chat.blur();
7857 }
7858 }
7859 });
7860
7861 $(document).on("keydown", function (evt) {
7862 if ($("#chat").hasClass("chatting")) {
7863 if (evt.keyCode == 27) {
7864 chat.blur();
7865 evt.preventDefault();
7866 evt.stopPropagation();
7867 } else if (evt.keyCode == 13) {
7868 $("#chat input").focus();
7869 }
7870 } else if (!gModal && (evt.keyCode == 27 || evt.keyCode == 13)) {
7871 $("#chat input").focus();
7872 }
7873 });
7874
7875 $("#chat input").on("keydown", function (evt) {
7876 if (evt.keyCode == 13) {
7877 var message = $(this).val();
7878
7879 // ♥ // local commands // ♥ //
7880
7881 if (message.length == 0) { //close chat if no input
7882 chat.blur();
7883
7884 } else if (message.substring(0, 6).toLowerCase() == cmdChar+"lhelp" || message.substring(0, 6).toLowerCase() == "!lhelp") { //local command list
7885 // thanks Someguy!
7886 localMsg("Local Commands: "+cmdChar+"name, "+cmdChar+"svol (speech volume), "+cmdChar+"spitch (speech pitch), "+cmdChar+"srate (speech speed), "+cmdChar+"sdefault, "+cmdChar+"lobby, "+cmdChar+"juggle (juggles the crown if you have it), "+cmdChar+"givefish (gives fish to fishlord), "+cmdChar+"fishlord (sets person who receives fish), "+cmdChar+"mathcheat (auto answers any "+cmdChar+"math question after a short delay)");
7887 $(this).val(""); //empties chatbox
7888 chat.blur(); //closes chat
7889
7890 } else if (message.substring(0, 5).toLowerCase() == cmdChar+"name" || message.substring(0, 5).toLowerCase() == "!name") { //name
7891 if (message.substring(5).trim() == "") {
7892 msgBox('Rename', 'Usage: '+cmdChar+'name new_name.', 3000, '#piano');
7893
7894 } else {
7895 gClient.sendArray([{
7896 "m": "userset",
7897 "set": {
7898 "name": message.substring(5).trim()
7899 }
7900 }]);
7901 selfName = message.substring(5).trim();
7902 msgBox('Renamed', message.substring(5).trim(), 3000, '#piano');
7903 }
7904 $(this).val("");
7905 chat.blur();
7906
7907 } else if (message.substring(0, 5).toLowerCase() == cmdChar+"svol" || message.substring(0, 5).toLowerCase() == "!svol") { //speech volume
7908 var speechVolumeTEMP = message.substring(6).trim()
7909 if (isNaN(speechVolumeTEMP) || speechVolumeTEMP > 1 || speechVolumeTEMP < 0 || speechVolumeTEMP == '') {
7910 msgBox('Speech Volume [usage]', 'Please enter a number no greater than 1 and no less than 0.', 5000, '#piano');
7911 $(this).val("");
7912 chat.blur();
7913 return;
7914
7915 } else {
7916 speechVolume = speechVolumeTEMP; //sets new variable value
7917 msgBox('Speech Volume', speechVolume, 3000, '#piano');
7918
7919 $(this).val("");
7920 chat.blur();
7921 }
7922
7923 } else if (message.substring(0, 7).toLowerCase() == cmdChar+"spitch" || message.substring(0, 7).toLowerCase() == "!spitch") { //speech pitch
7924 var speechPitchTEMP = message.substring(8).trim()
7925 if (isNaN(speechPitchTEMP) || speechPitchTEMP > 2 || speechPitchTEMP < 0 || speechPitchTEMP == '') {
7926 msgBox('Speech Pitch [usage]', 'Please enter a number no greater than 2 and no less than 0.', 5000, '#piano');
7927 $(this).val("");
7928 chat.blur();
7929 return;
7930
7931 } else {
7932 speechPitch = message.substring(8).trim() //sets new variable value
7933 msgBox('Pitch', speechPitch, 3000, '#piano');
7934 $(this).val("");
7935 chat.blur();
7936 }
7937
7938 } else if (message.substring(0, 6).toLowerCase() == cmdChar+"srate" || message.substring(0, 6).toLowerCase() == "!srate") { //speech rate
7939 var speechRateTEMP = message.substring(7).trim()
7940 if (isNaN(speechRateTEMP) || speechRateTEMP > 2 || speechRateTEMP < 0 || speechRateTEMP == '') {
7941 msgBox('Speech Pitch [usage]', 'Please enter a number no greater than 2 and no less than 0.', 5000, '#piano');
7942 $(this).val("");
7943 chat.blur();
7944 return;
7945
7946 } else {
7947 speechRate = message.substring(7).trim() //sets new variable value
7948 msgBox('Rate', speechRate, 3000, '#piano');
7949 $(this).val("");
7950 chat.blur();
7951 }
7952
7953 } else if (message.substring(0, 9).toLowerCase() == cmdChar+"sdefault" || message.substring(0, 9).toLowerCase() == "!sdefault") { //speech default
7954 speechVolume = 0.5; //default volume for spoken text
7955 speechPitch = 1; //default pitch for spoken text
7956 speechRate = 1; //default speed for spoken text
7957 msgBox('Speech Default', 'Volume, pitch and rate all reset.', 3000, '#piano');
7958 $(this).val("");
7959 chat.blur();
7960
7961 } else if (message.substring(0, 6).toLowerCase() == cmdChar+"lobby" || message.substring(0, 6).toLowerCase() == "!lobby") { //lobby
7962 if (gClient.isOwner()) {
7963 var lobbyConfirm = prompt("Are you sure you want to turn this room into a lobby?\nThis cannot be undone.\n\nEnter \"Yes\" below to continue.");
7964 if (lobbyConfirm == "Yes") {
7965 MPP.client.sendArray([{m: "chset", set: {lobby: true}}]);
7966 msgBox('Room is now a lobby', '', 3000, '#piano');
7967 } else {
7968 alert("Incorrectly entered text or you cancled.");
7969 }
7970
7971 } else {
7972 alert("You're not the owner of this room!");
7973 }
7974
7975 $(this).val("");
7976 chat.blur();
7977
7978 } else if (message.substring(0, 9).toLowerCase() == cmdChar+"givefish" || message.substring(0, 9).toLowerCase() == "!givefish") { //give fish
7979 giveFish = !giveFish;
7980 if (!giveFish) {
7981 msgBox('Give Fish', 'Off', 3000, '#piano');
7982
7983 } else {
7984 msgBox('Give Fish', 'On', 3000, '#piano');
7985 }
7986
7987 $(this).val("");
7988 chat.blur();
7989
7990 } else if (message.substring(0, 9).toLowerCase() == cmdChar+"fishlord" || message.substring(0, 9).toLowerCase() == "!fishlord") { //fish lord
7991 fishLord = message.substring(10).trim();
7992 if (fishLord == '') {
7993 msgBox('Fish Lord [usage]', cmdChar+'fishlord name_here', 3000, '#piano');
7994 $(this).val("");
7995 chat.blur();
7996 return;
7997 }
7998 msgBox('Fish Lord', 'Fish lord: ' + fishLord, 3000, '#piano');
7999 $(this).val("");
8000 chat.blur();
8001
8002 } else if (message.substring(0, 7).toLowerCase() == cmdChar+"juggle" || message.substring(0, 7).toLowerCase() == "!juggle") { //juggle
8003 function jugglePls() {
8004 juggling = setInterval(function() {
8005 gClient.sendArray([{
8006 m: "chown"
8007 }]);
8008 }, 2100); //2300 is good for just the dropping of it
8009 }
8010
8011 if (juggle) {
8012 juggle = false;
8013 clearInterval(juggling);
8014
8015 gClient.sendArray([{
8016 m: "chown",
8017 id: gClient.participantId
8018 }]);
8019 msgBox('Juggle Crown', 'Off', 2000, '#piano');
8020
8021 } else {
8022 juggle = true;
8023 jugglePls();
8024 msgBox('Juggle Crown', 'On', 2000, '#piano');
8025 }
8026
8027 $(this).val("");
8028 chat.blur();
8029
8030 } else if (message.substring(0, 10).toLowerCase() == cmdChar+"mathcheat" || message.substring(0, 10).toLowerCase() == "!mathcheat") { //juggle
8031 if (mathCheat) {
8032 mathCheat = false;
8033 msgBox('Math Cheats', 'Off', 2000, '#piano');
8034 } else {
8035 mathCheat = true;
8036 msgBox('Math Cheats', 'On', 2000, '#piano');
8037 }
8038
8039 $(this).val("");
8040 chat.blur();
8041
8042 // ♥ // local commands // ♥ //
8043
8044 } else if (message.length <= 512) {
8045 if (!meow && !leet) {
8046 //console.log("Triggered first");
8047 chat.send(message);
8048 $(this).val("");
8049 chat.blur();
8050 }
8051 if (message.substring(0,1).trim() != "!" && message.substring(0,1).trim() != "/" && message.substring(0,1).trim() != cmdChar) {
8052 if (meow) {
8053 //thanks electrashave!
8054 leet = false;
8055 var words = ['meow', 'meow', 'mew', 'purr'];
8056 var final = '';
8057 for (var i = 0; words.length > i; i++) {
8058 final += words[Math.floor(Math.random()*words.length)] + ' ';
8059 }
8060 final = final.toLowerCase();
8061 final = final.charAt(0).toUpperCase() + final.slice(1).trim() + '. *' + message.trim() + '*';
8062 chat.send(final);
8063 $(this).val("");
8064 chat.blur();
8065
8066 } else if (!leet){
8067 $(this).val("");
8068 chat.blur();
8069 }
8070
8071 if (leet) {
8072 meow = false;
8073 var alpha1 = "abcdefghijklmnopqrstuvwxyz0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789~`?-=[]\;'\",./_+{}|:<>!@#$%^&*()♥°¬";
8074 var alpha2 = "4bcd3fgh1jklmn0pqrstuvwxyz0123456789 4BCD3FGH1JKLMN0PQRSTUVWXYZ0123456789~`?-=[]\;'\",./_+{}|:<>!@#$%^&*()♥°¬";
8075 var str = message;
8076 var newstr = '';
8077 for (var i = 0; i < str.length; i++) {
8078 charPos = alpha1.indexOf(str.charAt(i));
8079 newstr += alpha2.charAt(charPos);
8080 }
8081 chat.send(newstr);
8082 $(this).val("");
8083 chat.blur();
8084
8085 } else if (!meow) {
8086 $(this).val("");
8087 chat.blur();
8088 }
8089
8090 } else if (meow || leet) {
8091 //console.log("Triggered final");
8092 chat.send(message);
8093 $(this).val("");
8094 chat.blur();
8095 }
8096
8097 }
8098
8099 evt.preventDefault();
8100 evt.stopPropagation();
8101 } else if (evt.keyCode == 27) {
8102 chat.blur();
8103 evt.preventDefault();
8104 evt.stopPropagation();
8105 } else if (evt.keyCode == 9) {
8106 evt.preventDefault();
8107 evt.stopPropagation();
8108 }
8109 });
8110
8111 return {
8112 show: function () {
8113 $("#chat").fadeIn();
8114 },
8115
8116 hide: function () {
8117 $("#chat").fadeOut();
8118 },
8119
8120 clear: function () {
8121 if (clearChat) {
8122 $("#chat li").remove();
8123 return;
8124 }
8125 },
8126
8127 scrollToBottom: function () {
8128 var ele = $("#chat ul").get(0);
8129 ele.scrollTop = ele.scrollHeight;
8130 },
8131
8132 blur: function () {
8133 if ($("#chat").hasClass("chatting")) {
8134 $("#chat input").get(0).blur();
8135 $("#chat").removeClass("chatting");
8136 chat.scrollToBottom();
8137 captureKeyboard();
8138 }
8139 },
8140
8141 send: function (message) {
8142 gClient.sendArray([{
8143 m: "a",
8144 message: message
8145 }]);
8146 },
8147
8148
8149 receive: function (msg) {
8150 if (gChatMutes.indexOf(msg.p._id) != -1) return;
8151 msg.a = msg.a.replace(/</g, '<');
8152 msg.p.name = msg.p.name.replace(/</g, '<');
8153 content = msg.a.replace(/((https?\:\/\/|ftp\:\/\/)|(www\.))(\S+)(\w{2,4})(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/gi, function(url) {
8154 nice = url;
8155 if( url.match('^https?:\/\/') ) nice = nice.replace(/^https?:\/\//i,'')
8156 else url = 'http://' + url;
8157
8158 return '<a target="_blank" style="text-decoration: none;" href="'+ url +'">'+ url +'</a>';
8159 });
8160 var final = content;
8161
8162 var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
8163
8164 var li = $('<li><span class="name"/><span style="position: initial!important;" class="message"/>');
8165
8166 li.find(".name").html(msg.p.name + afterName); //fix for <3 showing up as lt;3 using .text instead of .html -thanks Someguy
8167 if (debug) {
8168 li.find(".name").html("[" + msg.p._id + "--- " + msg.p.name + afterName);
8169 }
8170 if (timeStamp) {
8171 li.find(".name").html(getTime() + " --- " + msg.p.name + afterName);
8172 }
8173 li.find(".message").html(
8174 "<span class='msg_'>"+ final + "</span>"
8175 );
8176
8177 li.css("color", msg.p.color || "green");
8178
8179 $("#chat ul").append(li);
8180
8181 var eles = $("#chat ul li").get();
8182 for (var i = 1; i <= 50 && i <= eles.length; i++) {
8183 eles[eles.length - i].style.opacity = 0.5 - (i * 0.03); //chat fade
8184 }
8185 if (eles.length > 50) {
8186 eles[0].style.display = "none";
8187 }
8188 if (eles.length > chatLimit) { //max chat log history default was 256
8189 $(eles[0]).remove();
8190 }
8191 updateChatLength(eles.length);
8192
8193 // scroll to bottom if not "chatting" or if not scrolled up
8194 if (!$("#chat").hasClass("chatting")) {
8195 chat.scrollToBottom();
8196 } else {
8197 var ele = $("#chat ul").get(0);
8198 if (ele.scrollTop > ele.scrollHeight - ele.offsetHeight - 50)
8199 chat.scrollToBottom();
8200 }
8201 if (debug2) {
8202 // test
8203 //idea to fix, I think it's the way you += the string. You need to replace the orginial with nothing then add the extra chars
8204 //length of msg: $('#chat li .msg_').get(0).innerHTML.length
8205 var myString = $('#chat li:last .msg_').get(0).innerHTML;
8206 var cut = myString.length;
8207 console.log("length: " + cut);
8208 var myArray = myString.split("");
8209 var loopTimer = 70;
8210 console.log('before loop ' + myString);
8211 $('#chat li:last .msg_').get(0).innerHTML = myString.substring(cut, cut);
8212 var frameLooper = setInterval( function() {
8213 console.log('looping ' + myString);
8214 if(myArray.length > 0) {
8215 $('#chat li:last .msg_').get(0).innerHTML += myArray.shift();
8216 } else {
8217 clearInterval(frameLooper);
8218 console.log('clearing loop ' + myString);
8219 return false;
8220 }
8221 }, loopTimer);
8222 console.log('done ' + myString);
8223
8224 //$('#chat li:last .msg_').get(0).innerHTML
8225
8226 // test
8227 }
8228
8229
8230 }
8231 };
8232
8233 })();
8234
8235
8236 clearChatFunc = function() {
8237 chat.clear();
8238 updateChatLength(0);
8239 }
8240
8241
8242 // use midi bridge (old one started here)
8243 $("#blah-btn").on("click", function (evt) {
8244 var pRoom = prompt("Enter the name of your lobby...", hotkeyRoom);
8245 if (!pRoom) return;
8246 var room_name = pRoom;
8247 changeRoom(room_name, "right", {
8248 "visible": true,
8249 "chat": true,
8250 "crownsolo": false,
8251 "lobby": true
8252 });
8253 });
8254
8255 // use midi bridge (old one ended here)
8256
8257
8258 // New MIDI
8259 var gWebMidiWorking;
8260 (function() {
8261
8262 MIDI_TRANSPOSE = -12;
8263
8264 var MIDI_KEY_NAMES = ["a-1", "as-1", "b-1"];
8265 var bare_notes = "c cs d ds e f fs g gs a as b".split(" ");
8266 for(var oct = 0; oct < 7; oct++) {
8267 for(var i in bare_notes) {
8268 MIDI_KEY_NAMES.push(bare_notes[i] + oct);
8269 }
8270 }
8271 MIDI_KEY_NAMES.push("c7");
8272
8273 if (navigator.requestMIDIAccess) {
8274 navigator.requestMIDIAccess().then(
8275 function(midi) {
8276 console.log(midi);
8277 if(midi.inputs.size > 0) {
8278 var inputs = midi.inputs.values();
8279 for(var input_it = inputs.next(); input_it && !input_it.done; input_it = inputs.next()) {
8280 var input = input_it.value;
8281 console.log(input);
8282 input.onmidimessage = function(evt) {
8283 var channel = evt.data[0] & 0xf;
8284 var cmd = evt.data[0] >> 4;
8285 var note_number = evt.data[1];
8286 var vel = evt.data[2];
8287 //console.log(channel, cmd, note_number, vel);
8288 if(cmd == 8 || (cmd == 9 && vel == 0)) {
8289 // NOTE_OFF
8290 release(MIDI_KEY_NAMES[note_number - 9 + MIDI_TRANSPOSE]);
8291 } else if(cmd == 9) {
8292 // NOTE_ON
8293 press(MIDI_KEY_NAMES[note_number - 9 + MIDI_TRANSPOSE], vel / 100);
8294 } else if(cmd == 11) {
8295 // CONTROL_CHANGE
8296 if(!gAutoSustain) {
8297 if(note_number == 64) {
8298 if(vel > 0) {
8299 pressSustain();
8300 } else {
8301 releaseSustain();
8302 }
8303 }
8304 }
8305 }
8306 };
8307 if(!gWebMidiWorking) {
8308 gWebMidiWorking = true;
8309 new Notification({title:"Nice!", text:"Web MIDI is going.", duration:2000}); //MIDI working
8310 }
8311 }
8312 } else {
8313 console.log("no midi inputs");
8314 gWebMidiWorking = false;
8315 }
8316 if(gMidiOutTest && midi.outputs.size > 0) {
8317 var outputs = midi.outputs.values();
8318 for(var output_it = outputs.next(); output_it && !output_it.done; output_it = outputs.next()) {
8319 var output = output_it.value;
8320 console.log(output);
8321 }
8322 gMidiOutTest = function(note_name, vel, delay_ms) {
8323 var note_number = MIDI_KEY_NAMES.indexOf(note_name);
8324 if(note_number == -1) return;
8325 note_number = note_number + 9 - MIDI_TRANSPOSE;
8326
8327 var outputs = midi.outputs.values();
8328 for(var output_it = outputs.next(); output_it && !output_it.done; output_it = outputs.next()) {
8329 var output = output_it.value;
8330 output.send([0x90, note_number, vel], window.performance.now() + delay_ms);
8331 }
8332 }
8333 }
8334 },
8335 function(err){
8336 console.log(err);
8337 gWebMidiWorking = false;
8338 } );
8339 }
8340 })();
8341
8342
8343
8344 //More button
8345 (function () {
8346 var loaded = false;
8347 $("#social").fadeIn(250);
8348 $("#more-button").click(function () {
8349 //stuff goes between here and..
8350 if (leet) {
8351 leet = false;
8352 } else {
8353 leet = true;
8354 }
8355 msgBox('1337 Mode', ''+leet, 2000, '#piano');
8356 });
8357 })();
8358
8359
8360 //api
8361 //window.MPP
8362 MPP = {
8363 press: press,
8364 release: release,
8365 piano: gPiano,
8366 client: gClient,
8367 chat: chat,
8368 msgBox: msgBox,
8369 SoundSelector: gSoundSelector
8370 };
8371
8372
8373});
8374//main end
8375
8376//Thanks B@K$
8377MPP.client.sendArray = function(arr) {
8378 if (arr[0].m == "m") {
8379 logie = this;
8380 logie.participantUpdate({
8381 id: logie.participantId
8382 , x: parseFloat(arr[0].x)
8383 , y: parseFloat(arr[0].y)
8384 , m: "m"
8385 });
8386 }
8387 this.send(JSON.stringify(arr));
8388}
8389
8390// miscellaneous HTML changes
8391 // default place holder for chat
8392 $("#chat .translate").attr("placeholder", "")
8393
8394// miscellaneous HTML changes
8395
8396//♥ Test Button ♥
8397//button 4
8398function updateChatLength(num) {
8399 document.getElementById("4-btn").innerHTML = "Msgs: " + num;
8400}
8401$("body #bottom .relative").append('<div id="4-btn" class="ugly-button 4_btn" style="position: fixed;bottom: 29px;right: 5px;width: 100px; text-align:center"; title="Messages shown in chat">Msgs: 0</div>');
8402$("#4-btn").click(function(){
8403 var yayNayChat = confirm("Do you want to clear the chat?");
8404
8405 if (yayNayChat) {
8406 clearChat = true;
8407 clearChatFunc();
8408 clearChat = false;
8409 }
8410});
8411
8412//♥ button 5
8413$("body #bottom .relative").append('<div id="5-btn" class="ugly-button 5_btn" style="position: fixed;color: red;bottom: 2px;right: 5px;width: 10px"; title="Debug Toggle">♥</div>');
8414$("#5-btn").click(function(){
8415 if (debug) {
8416 //off
8417 debug = false;
8418 document.getElementById("5-btn").style.color = "red";
8419 } else {
8420 //on
8421 debug = true;
8422 document.getElementById("5-btn").style.color = "green";
8423 }
8424});
8425
8426//♥ button 6
8427$("body #bottom .relative").append('<div id="6-btn" class="ugly-button 6_btn" style="position: fixed;color: orange;bottom: 2px;right: 30px;width: 10px"; title="I love you :3">♥</div>');
8428$("#6-btn").click(function(){
8429 document.getElementById("6-btn").style.color = Col();
8430 //nothing as of now
8431});
8432
8433//♥ button 7
8434$("body #bottom .relative").append('<div id="7-btn" class="ugly-button 7_btn" style="position: fixed;color: yellow;bottom: 2px;right: 55px;width: 10px"; title="I love you :3">♥</div>');
8435$("#7-btn").click(function(){
8436 document.getElementById("7-btn").style.color = Col();
8437 //nothing as of now
8438});
8439
8440//♥ button 8
8441$("body #bottom .relative").append('<div id="8-btn" class="ugly-button 8_btn" style="position: fixed;color: green;bottom: 2px;right: 80px;width: 10px"; title="I love you :3">♥</div>');
8442$("#8-btn").click(function(){
8443 document.getElementById("8-btn").style.color = Col();
8444 //nothing as of now
8445});
8446
8447//♥ button 9
8448$("body #bottom .relative").append('<div id="9-btn" class="ugly-button 9_btn" style="position: fixed;color: blue;bottom: 2px;right: 105px;width: 10px"; title="I love you :3">♥</div>');
8449$("#9-btn").click(function(){
8450 document.getElementById("9-btn").style.color = Col();
8451 //nothing as of now
8452});
8453
8454//♥ button 10
8455$("body #bottom .relative").append('<div id="10-btn" class="ugly-button 10_btn" style="position: fixed;color: indigo;bottom: 2px;right: 130px;width: 10px"; title="I love you :3">♥</div>');
8456$("#10-btn").click(function(){
8457 document.getElementById("10-btn").style.color = Col();
8458 //nothing as of now
8459});
8460
8461//♥ button 11
8462$("body #bottom .relative").append('<div id="11-btn" class="ugly-button 11_btn" style="position: fixed;color: violet;bottom: 2px;right: 155px;width: 10px"; title="I love you :3">♥</div>');
8463$("#11-btn").click(function(){
8464 document.getElementById("11-btn").style.color = Col();
8465 //nothing as of now
8466});
8467
8468//♥ button 12
8469$("body #bottom .relative").append('<div id="12-btn" class="ugly-button 12_btn" style="position: fixed;color: indigo;bottom: 2px;right: 180px;width: 10px"; title="Debug Toggle">♥</div>');
8470$("#12-btn").click(function(){
8471 document.getElementById("12-btn").style.color = Col();
8472 //nothing as of now
8473});
8474
8475//♥ button 13
8476$("body #bottom .relative").append('<div id="13-btn" class="ugly-button 13_btn" style="position: fixed;color: blue;bottom: 2px;right: 205px;width: 10px"; title="I love you :3">♥</div>');
8477$("#13-btn").click(function(){
8478 document.getElementById("13-btn").style.color = Col();
8479 //nothing as of now
8480});
8481
8482//♥ button 14
8483$("body #bottom .relative").append('<div id="14-btn" class="ugly-button 14_btn" style="position: fixed;color: green;bottom: 2px;right: 230px;width: 10px"; title="I love you :3">♥</div>');
8484$("#14-btn").click(function(){
8485 document.getElementById("14-btn").style.color = Col();
8486 //nothing as of now
8487});
8488
8489//♥ button 15
8490$("body #bottom .relative").append('<div id="15-btn" class="ugly-button 15_btn" style="position: fixed;color: yellow;bottom: 2px;right: 255px;width: 10px"; title="I love you :3">♥</div>');
8491$("#15-btn").click(function(){
8492 document.getElementById("15-btn").style.color = Col();
8493 //nothing as of now
8494});
8495
8496//♥ button 16
8497$("body #bottom .relative").append('<div id="16-btn" class="ugly-button 16_btn" style="position: fixed;color: orange;bottom: 2px;right: 280px;width: 10px"; title="I love you :3">♥</div>');
8498var playingMid = false;
8499document.getElementById("16-btn").style.color = "red";
8500$("#16-btn").click(function(){
8501 if (!playingMid) {
8502 //MIDIjs.play('http://localhost:3000/midis/logan.mid');
8503 playingMid = true;
8504 document.getElementById("16-btn").style.color = "green";
8505 } else {
8506 //MIDIjs.stop();
8507 document.getElementById("16-btn").style.color = "red";
8508 playingMid = false;
8509 }
8510});
8511
8512//♥ button 17
8513$("body #bottom .relative").append('<div id="17-btn" class="ugly-button 17_btn" style="position: fixed;color: red;bottom: 2px;right: 305px;width: 10px"; title="Spin :3">♥</div>');
8514var spinning = false;
8515document.getElementById("17-btn").style.color = "red";
8516$("#17-btn").click(function(){
8517 if (spinning) {
8518 document.getElementById("17-btn").style.color = "red";
8519 $("#piano").removeClass("spin");
8520 spinning = false;
8521 } else {
8522 document.getElementById("17-btn").style.color = "green";
8523 $("#piano").addClass("spin");
8524 spinning = true;
8525 }
8526});
8527
8528//♥ button 18
8529$("body #bottom .relative").append('<div id="18-btn" class="ugly-button 18_btn" style="position: fixed;color: orange;bottom: 2px;right: 330px;width: 10px"; title="Bm">♥</div>');
8530$("#18-btn").click(function(){
8531 document.getElementById("18-btn").style.color = Col();
8532 MPP.press("b1", volume); MPP.press("fs2", volume); MPP.press("d2", volume); MPP.press("b2", volume); MPP.press("b-1", volume);
8533});
8534
8535//♥ button 19
8536$("body #bottom .relative").append('<div id="19-btn" class="ugly-button 19_btn" style="position: fixed;color: yellow;bottom: 2px;right: 355px;width: 10px"; title="B">♥</div>');
8537$("#19-btn").click(function(){
8538 document.getElementById("19-btn").style.color = Col();
8539 MPP.press("b1", volume); MPP.press("fs2", volume); MPP.press("ds2", volume); MPP.press("b2", volume); MPP.press("b-1", volume);
8540});
8541
8542//♥ button 20
8543$("body #bottom .relative").append('<div id="20-btn" class="ugly-button 20_btn" style="position: fixed;color: green;bottom: 2px;right: 380px;width: 10px"; title="F#7(3rd inv)">♥</div>');
8544$("#20-btn").click(function(){
8545 document.getElementById("20-btn").style.color = Col();
8546 MPP.press("cs2", volume); MPP.press("e2", volume); MPP.press("as2", volume); MPP.press("fs0", volume);
8547});
8548
8549//♥ button 21
8550$("body #bottom .relative").append('<div id="21-btn" class="ugly-button 21_btn" style="position: fixed;color: blue;bottom: 2px;right: 405px;width: 10px"; title="C#m">♥</div>');
8551$("#21-btn").click(function(){
8552 document.getElementById("21-btn").style.color = Col();
8553 MPP.press("cs2", volume); MPP.press("e2", volume); MPP.press("gs2", volume); MPP.press("cs0", volume);
8554});
8555
8556//♥ button 22
8557$("body #bottom .relative").append('<div id="22-btn" class="ugly-button 22_btn" style="position: fixed;color: indigo;bottom: 2px;right: 430px;width: 10px"; title="Csus(#4 #5)">♥</div>');
8558$("#22-btn").click(function(){
8559 document.getElementById("22-btn").style.color = Col();
8560 MPP.press("c2", volume); MPP.press("fs2", volume); MPP.press("gs2", volume);
8561});
8562
8563//♥ button 23
8564$("body #bottom .relative").append('<div id="23-btn" class="ugly-button 23_btn" style="position: fixed;color: violet;bottom: 2px;right: 455px;width: 10px"; title="E(2nd inv)">♥</div>');
8565$("#23-btn").click(function(){
8566 document.getElementById("23-btn").style.color = Col();
8567 MPP.press("b1", volume); MPP.press("e2", volume); MPP.press("gs2", volume);
8568});
8569
8570//♥ button 24
8571$("body #bottom .relative").append('<div id="24-btn" class="ugly-button 24_btn" style="position: fixed;bottom: 28px;right: 1072px;width: 10px"; title="cmd symbol">!</div>');
8572$("#24-btn").click(function(){
8573 setCmdChar();
8574 updateCmdChar(cmdChar);
8575
8576});
8577
8578// le label
8579$("body").append('<div id="resource-label" style="position: fixed; bottom: 529px; right: 17px;">Resource Monitor</div>');
8580
8581// thanks http://stackoverflow.com/users/165737/anurag
8582$("body #resource-label").css("fontSize", "11px");
8583
8584console.log(window.performance.now() - startUpDelay);
8585//END OF SCRIPT// //END OF SCRIPT// //END OF SCRIPT// //END OF SCRIPT// //END OF SCRIPT// //END OF SCRIPT/