· 6 years ago · Mar 02, 2020, 04:46 AM
1// ==UserScript==
2// @name rip electra 2.00
3// @namespace http://www.multiplayerpiano.com/
4// @notice This was originally made by electrashave. And furthermore edited by LoganNZL
5// @Version 5.2
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==
11var startUpDelay = window.performance.now();
12
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 = false;
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 = "228" //version. saves time instead of changing all throughout script
176var selfName = "Fallen | Pc Keyboard"; //your name
177var keyword = "logan"; //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 = "5e67c13fa905df1c52b2f382"; //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 = "][_, ([]) ][_,"; //the name of the numpad 2 lobby room to be created
182var randNoteColour = true; //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 useDefaultSounds = true; //change this to true if the piano is grey and the notes are not loading <-- READ IF YOU HAVE SOUND PROBLEMS
192var cmdChar = '!'; //the symbol you want chat commands to use ! was default (note trim() if you run into problems Logan)
193var autoFollow = false; //auto follow user's mouses (needs to be true for strict follow)
194
195var strictMode = false; //only lets peoople with (); at the end of their name use the bot
196
197//speech settings
198 var speechStatus = false; //read chat by default or use numpad 7 to toggle
199 var speechVolume = 1; //0.5 //default volume for spoken text
200 var speechPitch = 1; //default pitch for spoken text
201 var speechRate = 1; //default speed for spoken text
202 var autoChange = false; //Auto change lang
203 var voices;
204//speech settings
205
206//$("body").css('cursor','url(http://static.tumblr.com/c07b69a007660c9d85e65fd98d03bdbb/u8lqlti/RjRnh9jhe/tumblr_static_dmtjjg29joooc4cwwkskwkwcs.gif), auto');
207
208//audio settings
209 //var alertSound = new Audio('http://localhost:3000/sounds/alert.mp3'); //alert!
210 var alertSound = new Audio('http://localhost:3000/sounds/alert(mario).mp3'); //alert mario!
211 var yeySound = new Audio('http://localhost:3000/sounds/yey.mp3'); //yey!
212 var friendSound = new Audio('http://localhost:3000/sounds/friendJoin.mp3'); //friendJoin
213
214 alertSound.volume = 0.05; //still bloody scares me
215
216 var alertName = true; //plays mp3 when your name is said in chat (edit your name there)
217//audio settings
218
219//voice
220 var Voice = new webkitSpeechRecognition();
221 var getVoices = setInterval(()=>{
222 voices = speechSynthesis.getVoices();
223 if(voices.length > 1) clearInterval(getVoices);
224 }, 600)
225//voice
226
227var debug = false; //toggle ids next to names in chat
228var 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.
229//end of basic settings
230//tests
231
232/*
233!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}}])});
234!js i=1; foo = setInterval(() => { move(i+=1,i+=1); i > 100 ? ( clearInterval(foo), move(50,50) ) : true }, 60);
235
236a = setInterval( function() {
237 if (fSpeed >= 1) {
238 fSpeed = -1
239 } else {
240 fSpeed += 0.1
241 }
242}, 300)
243
244*/
245
246//tests
247keysArray = ['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'];
248var MIDI_TRANSPOSE;
249var followId = null;
250var following = false;
251
252// 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
253// 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
254var database = {}; //use for something like storing IDs Logan
255var food_calories = 0; //tracks calories of food consumed
256var drink_calories = 0; //tracks calories of liquid consumed
257var fishCaught = 0; //tracks your fish caught
258var naughty = 0; //tracks how many times the bot has been sworn at
259var jokeGens = 0; //tracks the number of generated jokes
260var octTemp = 1; //incremental number for number of octaves
261var susTemp = true; //boolean for sustain toggling
262var rollTemp = false; //now includes MIDI supported multi-note. Thanks Josh!
263var volume = 0.5; //volume for all (if not most) notes played by you
264var transLvl = 0; //electrashave's transposition
265var delPlay = false; //for delay play
266var delays = 150; //delay
267var delTime = 1000; //amount of delay
268var copyNotes = false; //copy other's notes
269var ignoreNotes = false; //ignore notes default setting
270var politePlay = false; //doesn't send your notes so you can play while others are without interrupting
271var testflipN = false; //for Yoshify's speech to text
272var testflipP = false; //for cursor pong hotkey
273var testflipB = false; //for cursor bunny hotkey
274var testflipF = false; //for cursor follow hotkey
275var incognito = false; //turn this on to be incognito by default
276var juggle = false; //crown juggling
277var listening = false; //setting for speech to text, leave false so hotkey is off by default
278var alertOnFriendJoin = true; //sends a message in chat when a friend joins
279var crownSoloToggle = false; //toggle for hotkey
280var roomVisibleToggle = true; //toggle for hotkey
281var usersAsleep = []; //x3
282var usersDead = []; //x.x
283var giveFish = false; //toggle for !fishlord whether or not it gives fish out
284var fishLord = ""; //name of person whom receives fish if you're giving out fish
285var clearing = false; //used when clearing chat to stop spamming
286var Lvel = false; //for muting PC notes
287var meow = false; //meow meow meow meow meow meow meow meow meow
288var leet = false; //h3ll0, my n4m3 is l0g4n :3
289var animName = false; //hey hey, cuddlepet. how're you?
290var asked = false; //for !math
291var hardEnglish = true; //for !mtype difficulty
292var hardLength = 30;
293var askedEnglish = false; //for !mtype
294var sentence; //for !mtype
295var mathDiff = 2 //default difficulty for !math
296var mathDiffTxt = "Medium"; //for difficulty in text
297var mathAnswered = 0; //amount of answered questions
298var mathSkipped = 0; //amount of skipped questions
299var mathCheat = false; //c'mon >:3
300var tabbedIn = false; //for notifications only if tabbed in
301var botLoaded = false; //used for detecting if bot is loaded
302var mouseNote = false; //Chacha's mouse note thing :3
303var ouch = false; //ouch
304var ouchN = 10; //ouchNumber
305var ouchD = 0; //ouchDelay
306var lolNo = false; //no
307var sayIt = false; //Google says hi!
308var clearChat = false; //will switch to true for a few seconds when you click message count button to clear chat. Otherwise chat log is retained
309
310//my theme (if you'd like it just ask I'll upload a "friendly" version that doesn't use anything from localhost)
311$('head').append('<link rel="stylesheet" type="text/css" href="http://localhost:3000/scripts/style.css"/>');
312
313// end of advanced settings
314
315// localStorage
316var L = localStorage;
317
318// Meowpuff delerations
319if (L.MDB) {
320 var MDB = JSON.parse(L.MDB);
321 console.log('successfully loaded MDB');
322
323} else {
324 var MDB = {};
325 console.log('created new MDB');
326}
327
328var meowNeP = "You have insufficient funds for "; //not enough meow points
329
330//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)
331for (var idObj in MDB) {
332 for (var prop in MDB[idObj]) {
333 if (MDB[idObj]['meowing'] === true) MDB[idObj]['meowing'] = false;
334 }
335}
336
337// functions start //
338
339// get random interger
340function randNum(min, max) {
341 return Math.round(Math.random() * (max - min) + min);
342};
343
344// get random string
345function randStr(strLength) {
346 var str = "";
347 var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
348
349 for (var i=0; i < strLength; i++)
350 str += chars.charAt(Math.floor(Math.random() * chars.length));
351
352 return str;
353};
354
355// thanks SomeGuy and electrashave!
356function localMsg(msg) { //<3
357 MPP.client.emit('a', { m: 'a', a: msg, p: { name: "Clefairy", color: 'rgb(255, 88, 202)' }});
358};
359
360// thanks Yoshify!
361function capitalizeFirstLetter(string) {
362 return string.charAt(0).toUpperCase() + string.slice(1);
363};
364
365// date ahoy!
366function getTime() {
367 var date = new Date(); //constructor
368 var hours = date.getHours(); //hours
369 var minutes = date.getMinutes(); //minutes
370 var seconds = date.getSeconds(); //seconds
371 if (hours <= 9) hours = '0' + hours; //fix awkwardness..
372 if (minutes <= 9) minutes = '0' + minutes;
373 if (seconds <= 9) seconds = '0' + seconds;
374 return hours + ':' + minutes + ':' + seconds; //return the time formatted
375};
376
377// let's have a chat
378function say(phrase) {
379 boop = new Audio('http://ssl.gstatic.com/dictionary/static/sounds/de/0/' + phrase + '.mp3');
380 boop.play();
381};
382
383// update the cmdChar
384function updateCmdChar(cmd) {
385 document.getElementById("24-btn").innerHTML = cmd;
386}
387
388
389
390// thanks Someguy!
391function Col(){
392 return ('#'+Math.floor(Math.random()*16777215).toString(16));
393};
394
395// thanks B@K$!
396function randomUser() { //Math.round <- was (floor is more reliable)
397 return MPP.client.ppl[Object.keys(MPP.client.ppl)[Math.floor(Math.random() * MPP.client.channel.count)]].name;
398};
399
400// thanks Ramid!
401function move(x, y){
402 MPP.client.sendArray([{ m: "m", x: x, y: y}]);
403}
404
405// (thanks for showing me Someguy)
406(function() {
407 var script = document.createElement('script');
408 script.onload = function() {
409 var stats = new Stats();
410 stats.domElement.style.cssText = ' position: fixed; top: 50px; right: 28px; z-index:10000';
411 document.body.appendChild(stats.domElement);
412 requestAnimationFrame(function loop() {
413 stats.update();
414 requestAnimationFrame(loop)
415 });
416 };
417 script.src = '//rawgit.com/mrdoob/stats.js/master/build/stats.min.js';
418 document.head.appendChild(script);
419})()
420
421// thanks electrashave!
422function similar(first, second, percent) {
423 if (first === null || second === null || typeof first === 'undefined' || typeof second === 'undefined') {
424 return 0;
425 }
426
427 first += '';
428 second += '';
429
430 var pos1 = 0,
431 pos2 = 0,
432 max = 0,
433 firstLength = first.length,
434 secondLength = second.length,
435 p, q, l, sum;
436
437 max = 0;
438
439 for (p = 0; p < firstLength; p++) {
440 for (q = 0; q < secondLength; q++) {
441 for (l = 0;
442 (p + l < firstLength) && (q + l < secondLength) && (first.charAt(p + l) === second.charAt(q + l)); l++)
443 ;
444 if (l > max) {
445 max = l;
446 pos1 = p;
447 pos2 = q;
448 }
449 }
450 }
451
452 sum = max;
453
454 if (sum) {
455 if (pos1 && pos2) {
456 sum += similar(first.substr(0, pos1), second.substr(0, pos2));
457 }
458
459 if ((pos1 + max < firstLength) && (pos2 + max < secondLength)) {
460 sum += similar(first.substr(pos1 + max, firstLength - pos1 - max), second.substr(pos2 + max,
461 secondLength - pos2 - max));
462 }
463 }
464
465 if (!percent) {
466 return sum;
467 } else {
468 return (sum * 200) / (firstLength + secondLength);
469 }
470}
471
472// thanks electrashave!
473function getUser(target) {
474 for (var id in MPP.client.ppl) {
475 if (!MPP.client.ppl.hasOwnProperty(id)) continue;
476 var part = MPP.client.ppl[id];
477 if (part.name.toLowerCase().indexOf(target) !== -1 || similar(part.name.toLowerCase(), target.toLowerCase(), 1) >= 60) {
478 return part;
479 break;
480 }
481 }
482}
483
484var z = 0;
485var follow = setInterval(function () {
486 if (following) {
487 for (var _id in MPP.client.ppl) {
488 if (!MPP.client.ppl.hasOwnProperty(_id)) continue; //if the id is yours do not follow yourself
489 var part = MPP.client.ppl[_id];
490 if (!followId) return;
491 if (part._id === followId) { //follows only that ID
492 var angle = (z) * (Math.PI/fDegree);
493 MPP.client.sendArray([{
494 m: "m",
495 x: part.x + Math.sin(angle)*fRadius,
496 y: part.y + Math.cos(angle)*fRadius
497 }]);
498 z += fSpeed;
499 }
500 }
501 }
502}, 1);
503
504// functions end //
505
506// midi btn
507$("body #bottom .relative").append('<div id="blah-btn" class="ugly-button blah_btn" style="position: absolute;bottom: 25px;right: 832px;width: 100px"; title="Creates a new lobby">New Lobby...</div>');
508
509
510// event listners start //
511
512window.addEventListener("beforeunload", function(event) {
513 if (closeCheck) {
514 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.";
515 }
516});
517// event listners end //
518
519$(function () {
520
521 var test_mode = (window.location.hash && window.location.hash.match(/^(?:#.+)*#test(?:#.+)*$/i));
522
523 //var gSeeOwnCursor = (window.location.hash && window.location.hash.match(/^(?:#.+)*#seeowncursor(?:#.+)*$/i));
524 //var lSeeOwnCursor = true; //silly
525
526 var gMidiOutTest = (window.location.hash && window.location.hash.match(/^(?:#.+)*#midiout(?:#.+)*$/i));
527
528 if (!Array.prototype.indexOf) {
529 Array.prototype.indexOf = function (elt) {
530 var len = this.length >>> 0;
531 var from = Number(arguments[1]) || 0;
532 from = (from < 0) ? Math.ceil(from) : Math.floor(from);
533 if (from < 0) from += len;
534 for (; from < len; from++) {
535 if (from in this && this[from] === elt) return from;
536 }
537 return -1;
538 };
539 }
540
541 window.requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame || function (cb) {
542 setTimeout(cb, 1000 / 30); //60
543 };
544
545 //thanks electrashave!
546 function msgBox(about, info, duration, target) {
547 window.gAlert = new Notification({
548 title: about,
549 html: info,
550 target: target,
551 duration: duration
552 });
553 }
554
555 setCmdChar = function() {
556 var promptChar = prompt('Enter a new symbol to be used for commands. (currently ' + cmdChar + ')', cmdChar);
557 cmdChar = promptChar.substring(0,1).toLowerCase();
558 msgBox('CMD symbol set to', ''+cmdChar, 2000, '#piano');
559 };
560
561
562
563 var DEFAULT_VELOCITY = 0.5;
564
565
566
567
568 var TIMING_TARGET = 1000;
569
570
571
572
573 // Utility
574
575 ////////////////////////////////////////////////////////////////
576
577
578
579 var Rect = function (x, y, w, h) {
580 this.x = x;
581 this.y = y;
582 this.w = w;
583 this.h = h;
584 this.x2 = x + w;
585 this.y2 = y + h;
586 };
587 Rect.prototype.contains = function (x, y) {
588 return (x >= this.x && x <= this.x2 && y >= this.y && y <= this.y2);
589 };
590
591 // performing translation
592
593 ////////////////////////////////////////////////////////////////
594
595 var Translation = (function () {
596 var strings = {
597 "people are playing": {
598 "pt": "pessoas est√£o jogando",
599 "es": "personas est√°n jugando",
600 "ru": "—á–µ–ª–æ–≤–µ–∫ –∏–≥—Ä–∞–µ—Ç",
601 "fr": "personnes jouent",
602 "ja": "人が遊んでいる",
603 "de": "Leute spielen",
604 "zh": "人被打",
605 "nl": "mensen spelen",
606 "pl": "osób grają",
607 "hu": "ember j√°tszik"
608 },
609 "New Room...": {
610 "pt": "Nova Sala ...",
611 "es": "Nueva sala de...",
612 "ru": "–ù–æ–≤—ã–π –Ω–æ–º–µ—Ä...",
613 "ja": "新しい部屋",
614 "zh": "新房间",
615 "nl": "nieuwe Kamer",
616 "hu": "√∫j szoba"
617 },
618 "room name": {
619 "pt": "nome da sala",
620 "es": "sala de nombre",
621 "ru": "–Ω–∞–∑–≤–∞–Ω–∏–µ –∫–æ–º–Ω–∞—Ç—ã",
622 "fr": "nom de la chambre",
623 "ja": "ルーム名",
624 "de": "Raumnamen",
625 "zh": "房间名称",
626 "nl": "kamernaam",
627 "pl": "nazwa pokój",
628 "hu": "szoba neve"
629 },
630 "Visible (open to everyone)": {
631 "pt": "Visível (aberto a todos)",
632 "es": "Visible (abierto a todo el mundo)",
633 "ru": "Visible (–æ—Ç–∫—Ä—ã—Ç—ã–π –¥–ª—è –≤—Å–µ—Ö)",
634 "fr": "Visible (ouvert à tous)",
635 "ja": "目に見える(誰にでも開いている)",
636 "de": "Sichtbar (offen für alle)",
637 "zh": "可见(向所有人开放)",
638 "nl": "Zichtbaar (open voor iedereen)",
639 "pl": "Widoczne (otwarte dla wszystkich)",
640 "hu": "Látható (nyitott mindenki számára)"
641 },
642 "Enable Chat": {
643 "pt": "Ativar bate-papo",
644 "es": "Habilitar chat",
645 "ru": "–í–∫–ª—é—á–∏—Ç—å —á–∞—Ç",
646 "fr": "Activer discuter",
647 "ja": "チャットを有効にする",
648 "de": "aktivieren Sie chatten",
649 "zh": "启用聊天",
650 "nl": "Chat inschakelen",
651 "pl": "Włącz czat",
652 "hu": "a csevegést"
653 }
654 // todo: it, tr, th, sv, ar, fi, nb, da, sv, he, cs, ko, ro, vi, id, nb, el, sk, bg, lt, sl, hr
655 // todo: Connecting, Offline mode, input placeholder, Notifications
656 };
657
658 var setLanguage = function (lang) {
659 language = lang
660 };
661
662 var getLanguage = function () {
663 if (window.navigator && navigator.language && navigator.language.length >= 2) {
664 return navigator.language.substr(0, 2).toLowerCase();
665 } else {
666 return "en";
667 }
668 };
669
670 var get = function (text, lang) {
671 if (typeof lang === "undefined") lang = language;
672 var row = strings[text];
673 if (row == undefined) return text;
674 var string = row[lang];
675 if (string == undefined) return text;
676 return string;
677 };
678
679 var perform = function (lang) {
680 if (typeof lang === "undefined") lang = language;
681 $(".translate").each(function (i, ele) {
682 var th = $(this);
683 if (ele.tagName && ele.tagName.toLowerCase() == "input") {
684 if (typeof ele.placeholder != "undefined") {
685 th.attr("placeholder", get(th.attr("placeholder"), lang))
686 }
687 } else {
688 th.text(get(th.text(), lang));
689 }
690 });
691 };
692
693 var language = getLanguage();
694
695 return {
696 setLanguage: setLanguage,
697 getLanguage: getLanguage,
698 get: get,
699 perform: perform
700 };
701 })();
702
703 Translation.perform();
704
705
706
707
708 // AudioEngine classes
709
710 ////////////////////////////////////////////////////////////////
711
712 var AudioEngine = function () {};
713
714 AudioEngine.prototype.init = function (cb) {
715 this.volume = 0.6;
716 this.sounds = {};
717 return this;
718 };
719
720 AudioEngine.prototype.load = function (id, url, cb) {};
721
722 AudioEngine.prototype.play = function () {};
723
724 AudioEngine.prototype.stop = function () {};
725
726 AudioEngine.prototype.setVolume = function (vol) {
727 this.volume = vol;
728 };
729
730
731 AudioEngineSM2 = function () {};
732
733 AudioEngineSM2.prototype = new AudioEngine();
734
735 AudioEngineSM2.prototype.init = function (cb) {
736 AudioEngine.prototype.init.call(this);
737
738 window.SM2_DEFER = true;
739 var script = document.createElement("script");
740 script.src = "/soundmanager2/soundmanager2.js";
741
742 var loaded = false;
743 script.onload = function () {
744 if (loaded) return;
745 if (typeof SoundManager === "undefined") {
746 setTimeout(script.onload, 4000);
747 return;
748 }
749 loaded = true;
750
751 //sound manager settings
752 window.soundManager = new SoundManager();
753 soundManager.url = "/soundmanager2/";
754 soundManager.debugMode = test_mode ? true : false;
755 soundManager.useHTML5Audio = false;
756 soundManager.flashVersion = 9;
757 soundManager.multiShot = true;
758 soundManager.useHighPerformance = true;
759 soundManager.beginDelayedInit();
760 if (cb) soundManager.onready(cb);
761 };
762 setTimeout(script.onload, 4000);
763
764 document.body.appendChild(script);
765 return this;
766 };
767
768 AudioEngineSM2.prototype.load = function (id, url, cb) {
769 this.sounds[id] = soundManager.createSound({
770 id: id,
771 url: url,
772 autoLoad: true,
773 volume: this.volume,
774 onload: cb
775 });
776 };
777
778 AudioEngineSM2.prototype.play = function (id, vol, delay_ms) {
779 var self = this;
780 setTimeout(function () {
781 soundManager.play(id, {
782 volume: self.volume * 100.0
783 });
784 }, delay_ms);
785 };
786
787 AudioEngineSM2.prototype.setVolume = function (vol) {
788 AudioEngine.prototype.setVolume.call(this, vol);
789 for (var i in this.sounds) {
790 if (this.sounds.hasOwnProperty(i)) {
791 this.sounds[i].setVolume(this.volume * 100.0);
792 }
793 }
794 };
795
796
797 AudioEngineWeb = function () {};
798
799 AudioEngineWeb.prototype = new AudioEngine();
800
801 AudioEngineWeb.prototype.init = function (cb) {
802 AudioEngine.prototype.init.call(this);
803 this.context = new AudioContext();
804 this.gainNode = this.context.createGain();
805 this.gainNode.connect(this.context.destination);
806 this.gainNode.gain.value = this.volume;
807 this.playings = {};
808 if (cb) setTimeout(cb, 0);
809 return this;
810 };
811
812 AudioEngineWeb.prototype.load = function (id, url, cb) {
813 var audio = this;
814 var req = new XMLHttpRequest();
815 req.open("GET", url);
816 req.responseType = "arraybuffer";
817 req.addEventListener("readystatechange", function (evt) {
818 if (req.readyState !== 4) return;
819 try {
820 audio.context.decodeAudioData(req.response, function (buffer) {
821 audio.sounds[id] = buffer;
822 if (cb) cb();
823 });
824 } catch (e) { //was commented
825 throw new Error(e.message
826 + " / id: " + id
827 + " / url: " + url
828 + " / status: " + req.status
829 + " / ArrayBuffer: " + (req.response instanceof ArrayBuffer)
830 + " / byteLength: " + (req.response && req.response.byteLength ? req.response.byteLength : "undefined"));
831 //was commented
832 new Notification({
833 id: "audio-download-error",
834 title: "Problem",
835 text: "For some reason, an audio download failed with a status of " + req.status + ". " + " I blame antivirus software.",
836 target: "#piano",
837 duration: 10000
838 });
839 }
840 });
841 req.send();
842 };
843
844 AudioEngineWeb.prototype.play = function (id, vol, delay_ms, part_id) {
845 if (!this.sounds.hasOwnProperty(id)) return;
846 var time = this.context.currentTime + (delay_ms / 1000);
847 var source = this.context.createBufferSource();
848 source.buffer = this.sounds[id];
849 var gain = this.context.createGain();
850 gain.gain.value = vol;
851 source.connect(gain);
852 gain.connect(this.gainNode);
853 source.start(time);
854 // Patch from ste-art remedies stuttering under heavy load
855 if (this.playings[id]) {
856 var playing = this.playings[id];
857 playing.gain.gain.setValueAtTime(playing.gain.gain.value, time);
858 playing.gain.gain.linearRampToValueAtTime(0.0, time + 0.1);
859 playing.source.stop(time + 0.1);
860 /*playing.gain.gain.linearRampToValueAtTime(0.0, time + 0.5); //Ray's fix for single notes being pressed multiple times
861 playing.source.stop(time + 0.6);*/
862 }
863 this.playings[id] = {
864 "source": source,
865 "gain": gain,
866 "part_id": part_id
867 };
868 };
869
870 AudioEngineWeb.prototype.stop = function (id, delay_ms, part_id) {
871 if (this.playings.hasOwnProperty(id) && this.playings[id] && this.playings[id].part_id === part_id) {
872 var time = this.context.currentTime + (delay_ms / 1000);
873 var gain = this.playings[id].gain.gain;
874 gain.setValueAtTime(gain.value, time);
875 gain.linearRampToValueAtTime(gain.value * 0.1, time + 0.16);
876 gain.linearRampToValueAtTime(0.0, time + 1.9);
877 this.playings[id].source.stop(time + 2.0);
878 this.playings[id] = null;
879 }
880 };
881
882 AudioEngineWeb.prototype.setVolume = function (vol) {
883 AudioEngine.prototype.setVolume.call(this, vol);
884 this.gainNode.gain.value = this.volume;
885 };
886
887
888
889
890 // VolumeSlider inst
891
892 ////////////////////////////////////////////////////////////////
893
894 var VolumeSlider = function (ele, cb) {
895 this.rootElement = ele;
896 this.cb = cb;
897 var range = document.createElement("input");
898 try {
899 range.type = "range";
900 } catch (e) {
901 // Hello, IE9
902 }
903 if (range.min !== undefined) {
904 this.range = range;
905 this.rootElement.appendChild(range);
906 range.className = "volume-slider"; //volume settings
907 range.min = "0.0";
908 range.max = "1.0";
909 range.step = "0.01";
910 $(range).on("change", function (evt) {
911 cb(range.value);
912 });
913 } else {
914 if (window.console) console.warn("Warning: for some stupid reason there's no volume-slider");
915 // todo
916 }
917 };
918
919 VolumeSlider.prototype.set = function (v) {
920 if (this.range !== undefined) {
921 this.range.value = v;
922 } else {
923 // todo
924 }
925 };
926
927
928
929
930 // Renderer classes
931
932 ////////////////////////////////////////////////////////////////
933
934 var Renderer = function () {};
935
936 Renderer.prototype.init = function (piano) {
937 this.piano = piano;
938 this.resize();
939 return this;
940 };
941
942 Renderer.prototype.resize = function (width, height) {
943 if (typeof width == "undefined") width = $(this.piano.rootElement).width();
944 if (typeof height == "undefined") height = Math.floor(width * 0.2);
945 $(this.piano.rootElement).css({
946 "height": height + "px",
947 marginTop: Math.floor($(window).height() / 2 - height / 2) + "px"
948 });
949 this.width = width;
950 this.height = height;
951 };
952
953 Renderer.prototype.visualize = function (key, color) {};
954
955
956
957
958 var DOMRenderer = function () {
959 Renderer.call(this);
960 };
961
962 DOMRenderer.prototype = new Renderer();
963
964 DOMRenderer.prototype.init = function (piano) {
965 // create keys in dom
966 for (var i in piano.keys) {
967 if (!piano.keys.hasOwnProperty(i)) continue;
968 var key = piano.keys[i];
969 var ele = document.createElement("div");
970 key.domElement = ele;
971 piano.rootElement.appendChild(ele);
972 // "key sharp cs cs2"
973 ele.note = key.note;
974 ele.id = key.note;
975 ele.className = "key " + (key.sharp ? "sharp " : " ") + key.baseNote + " " + key.note + " loading";
976 var table = $('<table width="100%" height="100%" style="pointer-events:none"></table>');
977 var td = $('<td valign="bottom"></td>');
978 table.append(td);
979 td.valign = "bottom";
980 $(ele).append(table);
981 }
982 // add event listeners
983 var mouse_down = false;
984 $(piano.rootElement).mousedown(function (event) {
985 // todo: IE10 doesn't support the pointer-events css rule on the "blips"
986 var ele = event.target;
987 if ($(ele).hasClass("key") && piano.keys.hasOwnProperty(ele.note)) {
988 var key = piano.keys[ele.note];
989 press(key.note);
990 mouse_down = true;
991 event.stopPropagation();
992 };
993 //event.preventDefault();
994 });
995 piano.rootElement.addEventListener("touchstart", function (event) {
996 for (var i in event.changedTouches) {
997 var ele = event.changedTouches[i].target;
998 if ($(ele).hasClass("key") && piano.keys.hasOwnProperty(ele.note)) {
999 var key = piano.keys[ele.note];
1000 press(key.note);
1001 mouse_down = true;
1002 event.stopPropagation();
1003 }
1004 }
1005 //event.preventDefault();
1006 }, false);
1007 $(window).mouseup(function (event) {
1008 mouse_down = false;
1009 });
1010
1011 Renderer.prototype.init.call(this, piano);
1012 return this;
1013 };
1014
1015 DOMRenderer.prototype.resize = function (width, height) {
1016 Renderer.prototype.resize.call(this, width, height);
1017 };
1018
1019 DOMRenderer.prototype.visualize = function (key, color) { //mess with Logan
1020 var k = $(key.domElement);
1021 k.addClass("play");
1022 setTimeout(function () {
1023 k.removeClass("play");
1024 }, 100);
1025 // "blips"
1026 var d = $('<div style="width:100%;height:10%;margin:0;padding:0"> </div>');
1027 d.css("background", color);
1028 k.find("td").append(d);
1029 d.fadeOut(1000, function () {
1030 d.remove();
1031 });
1032 };
1033
1034
1035
1036
1037 var CanvasRenderer = function () {
1038 Renderer.call(this);
1039 };
1040
1041 CanvasRenderer.prototype = new Renderer();
1042
1043 CanvasRenderer.prototype.init = function (piano) {
1044 this.canvas = document.createElement("canvas");
1045 this.ctx = this.canvas.getContext("2d");
1046 piano.rootElement.appendChild(this.canvas);
1047
1048 Renderer.prototype.init.call(this, piano); // calls resize()
1049
1050 // create render loop
1051 var self = this;
1052 var render = function () {
1053 self.redraw();
1054 requestAnimationFrame(render);
1055 };
1056 requestAnimationFrame(render);
1057
1058 // add event listeners
1059 var mouse_down = false;
1060 var last_key = null;
1061 $(piano.rootElement).mousedown(function(event) {
1062 mouse_down = true;
1063 event.preventDefault();
1064
1065 var pos = CanvasRenderer.translateMouseEvent(event);
1066 var hit = self.getHit(pos.x, pos.y);
1067 if(hit) {
1068 press(hit.key.note, volume);
1069 last_key = hit.key;
1070 }
1071 });
1072 piano.rootElement.addEventListener("touchstart", function (event) { //mess with Logan
1073 mouse_down = true;
1074 event.preventDefault();
1075 for (var i in event.changedTouches) {
1076 var pos = CanvasRenderer.translateMouseEvent(event);
1077 var hit = self.getHit(pos.x, pos.y);
1078 if (hit) {
1079 last_key = hit.key;
1080 }
1081 }
1082 }, false);
1083 $(window).mouseup(function (event) {
1084 if (last_key) {
1085 release(last_key.note);
1086 }
1087 mouse_down = false;
1088 last_key = null;
1089 });
1090 $(piano.rootElement).mousemove(function(event) { //enables you to hold mouse and drag across notes.
1091 if(!mouse_down) return;
1092 var pos = CanvasRenderer.translateMouseEvent(event);
1093 var hit = self.getHit(pos.x, pos.y);
1094 if(hit && hit.key != last_key) {
1095 press(hit.key.note, volume);
1096 last_key = hit.key;
1097 release(last_key.note); //fix for sustain ignoring mouse being dragged across keys -Logan
1098 }
1099 });
1100
1101 return this;
1102 };
1103
1104 CanvasRenderer.prototype.resize = function (width, height) {
1105 Renderer.prototype.resize.call(this, width, height);
1106 if (this.width < 52 * 2) this.width = 52 * 2;
1107 if (this.height < this.width * 0.2) this.height = Math.floor(this.width * 0.2);
1108 this.canvas.width = this.width;
1109 this.canvas.height = this.height;
1110
1111 // calculate key sizes
1112 this.whiteKeyWidth = Math.floor(this.width / 52);
1113 this.whiteKeyHeight = Math.floor(this.height * 0.9);
1114 this.blackKeyWidth = Math.floor(this.whiteKeyWidth * 0.75);
1115 this.blackKeyHeight = Math.floor(this.height * 0.5);
1116
1117 this.blackKeyOffset = Math.floor(this.whiteKeyWidth - (this.blackKeyWidth / 2));
1118 this.keyMovement = Math.floor(this.whiteKeyHeight * 0.015);
1119
1120 this.whiteBlipWidth = Math.floor(this.whiteKeyWidth * 0.7);
1121 this.whiteBlipHeight = Math.floor(this.whiteBlipWidth * 0.8);
1122 this.whiteBlipX = Math.floor((this.whiteKeyWidth - this.whiteBlipWidth) / 2);
1123 this.whiteBlipY = Math.floor(this.whiteKeyHeight - this.whiteBlipHeight * 1.2);
1124 this.blackBlipWidth = Math.floor(this.blackKeyWidth * 0.7);
1125 this.blackBlipHeight = Math.floor(this.blackBlipWidth * 0.8);
1126 this.blackBlipY = Math.floor(this.blackKeyHeight - this.blackBlipHeight * 1.2);
1127 this.blackBlipX = Math.floor((this.blackKeyWidth - this.blackBlipWidth) / 2);
1128
1129 // prerender white key
1130 this.whiteKeyRender = document.createElement("canvas");
1131 this.whiteKeyRender.width = this.whiteKeyWidth;
1132 this.whiteKeyRender.height = this.height + 10;
1133 var ctx = this.whiteKeyRender.getContext("2d");
1134 if (ctx.createLinearGradient) {
1135 var gradient = ctx.createLinearGradient(0, 0, 0, this.whiteKeyHeight);
1136 gradient.addColorStop(0, "#eee");
1137 gradient.addColorStop(0.35, "#fff");
1138 gradient.addColorStop(1, "#dad4d4");
1139 ctx.fillStyle = gradient;
1140 } else {
1141 ctx.fillStyle = "#fff";
1142 }
1143 ctx.strokeStyle = "#000";
1144 ctx.lineJoin = "round";
1145 ctx.lineCap = "round";
1146 ctx.lineWidth = 10;
1147 ctx.strokeRect(ctx.lineWidth / 2, ctx.lineWidth / 2, this.whiteKeyWidth - ctx.lineWidth, this.whiteKeyHeight - ctx.lineWidth);
1148 ctx.lineWidth = 2.5; //4 - shadow between the white keys
1149 ctx.fillRect(ctx.lineWidth / 2, ctx.lineWidth / 2, this.whiteKeyWidth - ctx.lineWidth, this.whiteKeyHeight - ctx.lineWidth);
1150
1151 // prerender black key
1152 this.blackKeyRender = document.createElement("canvas");
1153 this.blackKeyRender.width = this.blackKeyWidth + 10;
1154 this.blackKeyRender.height = this.blackKeyHeight + 10;
1155 var ctx = this.blackKeyRender.getContext("2d");
1156 if (ctx.createLinearGradient) {
1157 var gradient = ctx.createLinearGradient(0, 0, 0, this.blackKeyHeight);
1158 gradient.addColorStop(0, "#000");
1159 gradient.addColorStop(1, "#444");
1160 ctx.fillStyle = gradient;
1161 } else {
1162 ctx.fillStyle = "#000";
1163 }
1164 ctx.strokeStyle = "#222";
1165 ctx.lineJoin = "round";
1166 ctx.lineCap = "round";
1167 ctx.lineWidth = 8;
1168 ctx.strokeRect(ctx.lineWidth / 2, ctx.lineWidth / 2, this.blackKeyWidth - ctx.lineWidth, this.blackKeyHeight - ctx.lineWidth);
1169 ctx.lineWidth = 4;
1170 ctx.fillRect(ctx.lineWidth / 2, ctx.lineWidth / 2, this.blackKeyWidth - ctx.lineWidth, this.blackKeyHeight - ctx.lineWidth);
1171
1172 // prerender shadows
1173 this.shadowRender = [];
1174 var y = -this.canvas.height * 2;
1175 for (var j = 0; j < 2; j++) {
1176 var canvas = document.createElement("canvas");
1177 this.shadowRender[j] = canvas;
1178 canvas.width = this.canvas.width;
1179 canvas.height = this.canvas.height;
1180 var ctx = canvas.getContext("2d");
1181 var sharp = j ? true : false;
1182 ctx.lineJoin = "round";
1183 ctx.lineCap = "round";
1184 ctx.lineWidth = 1;
1185 ctx.shadowColor = "rgba(0, 0, 0, 0.5)";
1186 ctx.shadowBlur = this.keyMovement * 3;
1187 ctx.shadowOffsetY = -y + this.keyMovement;
1188 if (sharp) {
1189 ctx.shadowOffsetX = this.keyMovement;
1190 } else {
1191 ctx.shadowOffsetX = 0;
1192 ctx.shadowOffsetY = -y + this.keyMovement;
1193 }
1194 for (var i in this.piano.keys) {
1195 if (!this.piano.keys.hasOwnProperty(i)) continue;
1196 var key = this.piano.keys[i];
1197 if (key.sharp != sharp) continue;
1198
1199 if (key.sharp) {
1200 ctx.fillRect(this.blackKeyOffset + this.whiteKeyWidth * key.spatial + ctx.lineWidth / 2,
1201 y + ctx.lineWidth / 2,
1202 this.blackKeyWidth - ctx.lineWidth, this.blackKeyHeight - ctx.lineWidth);
1203 } else {
1204 ctx.fillRect(this.whiteKeyWidth * key.spatial + ctx.lineWidth / 2,
1205 y + ctx.lineWidth / 2,
1206 this.whiteKeyWidth - ctx.lineWidth, this.whiteKeyHeight - ctx.lineWidth);
1207 }
1208 }
1209 }
1210
1211 // update key rects
1212 for (var i in this.piano.keys) {
1213 if (!this.piano.keys.hasOwnProperty(i)) continue;
1214 var key = this.piano.keys[i];
1215 if (key.sharp) {
1216 key.rect = new Rect(this.blackKeyOffset + this.whiteKeyWidth * key.spatial, 0,
1217 this.blackKeyWidth, this.blackKeyHeight);
1218 } else {
1219 key.rect = new Rect(this.whiteKeyWidth * key.spatial, 0,
1220 this.whiteKeyWidth, this.whiteKeyHeight);
1221 }
1222 }
1223 };
1224
1225 CanvasRenderer.prototype.visualize = function (key, color) {
1226 key.timePlayed = Date.now();
1227 key.blips.push({
1228 "time": key.timePlayed,
1229 "color": color
1230 });
1231 };
1232
1233 CanvasRenderer.prototype.redraw = function () {
1234 var now = Date.now();
1235 var timeLoadedEnd = now - 1000;
1236 var timePlayedEnd = now - 100;
1237 var timeBlipEnd = now - 1000;
1238
1239 this.ctx.save();
1240 this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
1241 // draw all keys
1242 for (var j = 0; j < 2; j++) {
1243 this.ctx.globalAlpha = 1.0; //unloaded keys colour
1244 this.ctx.drawImage(this.shadowRender[j], 0, 0);
1245 var sharp = j ? true : false;
1246 for (var i in this.piano.keys) {
1247 if (!this.piano.keys.hasOwnProperty(i)) continue;
1248 var key = this.piano.keys[i];
1249 if (key.sharp != sharp) continue;
1250
1251 if (!key.loaded) {
1252 this.ctx.globalAlpha = 0.2;
1253 } else if (key.timeLoaded > timeLoadedEnd) {
1254 this.ctx.globalAlpha = ((now - key.timeLoaded) / 1000) * 0.8 + 0.2;
1255 } else {
1256 this.ctx.globalAlpha = 1.0;
1257 }
1258 var y = 0;
1259 if (key.timePlayed > timePlayedEnd) {
1260 y = Math.floor(this.keyMovement - (((now - key.timePlayed) / 100) * this.keyMovement));
1261 }
1262 var x = Math.floor(key.sharp ? this.blackKeyOffset + this.whiteKeyWidth * key.spatial : this.whiteKeyWidth * key.spatial);
1263 var image = key.sharp ? this.blackKeyRender : this.whiteKeyRender;
1264 this.ctx.drawImage(image, x, y);
1265
1266 // render blips
1267 if (key.blips.length) {
1268 var alpha = this.ctx.globalAlpha;
1269 var w, h;
1270 if (key.sharp) {
1271 x += this.blackBlipX;
1272 y = this.blackBlipY;
1273 w = this.blackBlipWidth;
1274 h = this.blackBlipHeight;
1275 } else {
1276 x += this.whiteBlipX;
1277 y = this.whiteBlipY;
1278 w = this.whiteBlipWidth;
1279 h = this.whiteBlipHeight;
1280 }
1281 for (var b = 0; b < key.blips.length; b++) {
1282 var blip = key.blips[b];
1283 if (blip.time > timeBlipEnd) {
1284 this.ctx.fillStyle = blip.color;
1285 this.ctx.globalAlpha = alpha - ((now - blip.time) / 1000);
1286 this.ctx.fillRect(x, y, w, h);
1287 } else {
1288 key.blips.splice(b, 1);
1289 --b;
1290 }
1291 y -= Math.floor(h * 1.1); //blips space apart
1292 }
1293 }
1294 }
1295 }
1296 this.ctx.restore();
1297 };
1298
1299 CanvasRenderer.prototype.getHit = function (x, y) {
1300 for (var j = 0; j < 2; j++) {
1301 var sharp = j ? false : true; // black keys first
1302 for (var i in this.piano.keys) {
1303 if (!this.piano.keys.hasOwnProperty(i)) continue;
1304 var key = this.piano.keys[i];
1305 if (key.sharp != sharp) continue;
1306 if (key.rect.contains(x, y)) {
1307 var v = y / (key.sharp ? this.blackKeyHeight : this.whiteKeyHeight);
1308 v += 0.25;
1309 v *= DEFAULT_VELOCITY;
1310 if (v > 1.0) v = 1.0;
1311 return {
1312 "key": key,
1313 "v": v
1314 };
1315 }
1316 }
1317 }
1318 return null;
1319 };
1320
1321
1322 CanvasRenderer.isSupported = function () {
1323 var canvas = document.createElement("canvas");
1324 return !!(canvas.getContext && canvas.getContext("2d"));
1325 };
1326
1327 CanvasRenderer.translateMouseEvent = function (evt) {
1328 var element = evt.target;
1329 var offx = 0;
1330 var offy = 0;
1331 do {
1332 offx += element.offsetLeft;
1333 offy += element.offsetTop;
1334 } while (element = element.offsetParent);
1335 return {
1336 x: evt.pageX - offx,
1337 y: evt.pageY - offy
1338 }
1339 };
1340
1341
1342
1343
1344 // Pianoctor
1345
1346 ////////////////////////////////////////////////////////////////
1347
1348 var PianoKey = function(note, octave, num) {
1349 this.note = note + octave;
1350 this.baseNote = note;
1351 this.octave = octave;
1352 this.sharp = note.indexOf("s") != -1;
1353 this.loaded = false;
1354 this.timeLoaded = 0;
1355 this.domElement = null;
1356 this.timePlayed = 0;
1357 this.blips = [];
1358 this.num = num; //Ltranspose
1359 };
1360
1361 var Piano = function (rootElement) {
1362
1363 var piano = this;
1364 piano.rootElement = rootElement;
1365 piano.keys = {};
1366
1367 var white_spatial = 0;
1368 var black_spatial = 0;
1369 var black_it = 0;
1370 var black_lut = [2, 1, 2, 1, 1];
1371 var addKey = function(note, octave, num) {
1372 var key = new PianoKey(note, octave, num);
1373 piano.keys[key.note] = key;
1374 if (key.sharp) {
1375 key.spatial = black_spatial;
1376 black_spatial += black_lut[black_it % 5];
1377 ++black_it;
1378 } else {
1379 key.spatial = white_spatial;
1380 ++white_spatial;
1381 }
1382 }
1383 if (test_mode) { //Logan check!
1384 addKey("c", 2);
1385
1386 } else {
1387 addKey("a", -1, 1);
1388 addKey("as", -1, 2);
1389 addKey("b", -1, 3);
1390 var notes = "c cs d ds e f fs g gs a as b".split(" ");
1391 var count = 4;
1392
1393 for(var oct = 0; oct < 7; oct++) {
1394 for(var i in notes) {
1395 addKey(notes[i], oct, count);
1396 count++;
1397 }
1398 }
1399 addKey("c", 7); //default key
1400 addKey("cs", 7); //extra key
1401 addKey("d", 7); //extra key
1402 addKey("ds", 7); //extra key
1403 addKey("e", 7); //extra key
1404
1405 }
1406
1407
1408 var render_engine = CanvasRenderer.isSupported() ? CanvasRenderer : DOMRenderer;
1409 this.renderer = new render_engine().init(this);
1410
1411 $(window).resize(function () {
1412 piano.renderer.resize();
1413 });
1414
1415
1416 window.AudioContext = window.AudioContext || window.webkitAudioContext || undefined;
1417 var audio_engine = (window.AudioContext === undefined) ? AudioEngineSM2 : AudioEngineWeb;
1418
1419 // Firefox 25 supports WebAudio, but a decodeAudioData issue is blocking until 26
1420 // https://bugzilla.mozilla.org/show_bug.cgi?id=865553
1421 var search_str = " Firefox/";
1422 var idx = navigator.userAgent.indexOf(search_str);
1423 if (idx !== -1) {
1424 var version = parseFloat(navigator.userAgent.substring(idx + search_str.length));
1425 if (isNaN(version) || version < 26.0) {
1426 audio_engine = AudioEngineSM2;
1427 }
1428 }
1429
1430 this.audio = new audio_engine().init(function () {
1431 for (var i in piano.keys) {
1432 if (!piano.keys.hasOwnProperty(i)) continue;
1433 (function () {
1434 var key = piano.keys[i];
1435 if (useDefaultSounds) {
1436 piano.audio.load(key.note, "https://raw.githubusercontent.com/rei2hu/piano-sounds/master/kawai/" + key.note + ".wav", function () {
1437 key.loaded = true;
1438 key.timeLoaded = Date.now();
1439 if (key.domElement) // todo: move this to renderer somehow
1440 $(key.domElement).removeClass("loading");
1441 });
1442 } else {
1443 //Lsounds
1444 piano.audio.load(key.note, "https://dl.dropboxusercontent.com/u/24213061/HDPiano/" + key.note + ".wav", function () {
1445 key.loaded = true;
1446 key.timeLoaded = Date.now();
1447 if (key.domElement)
1448 $(key.domElement).removeClass("loading");
1449 });
1450 }
1451 })();
1452 }
1453 });
1454 };
1455
1456 Piano.prototype.play = function(note, vol, participant, delay_ms) {
1457 if(!this.keys.hasOwnProperty(note)) return;
1458 var key = this.keys[note];
1459 if(key.loaded) this.audio.play(key.note, vol, delay_ms, participant.id);
1460 if(typeof gMidiOutTest === "function") gMidiOutTest(key.note, vol * 100, delay_ms);
1461 var self = this;
1462 var jq_namediv = $(typeof participant == "undefined" ? null : participant.nameDiv);
1463 if(jq_namediv) {
1464 setTimeout(function() {
1465 self.renderer.visualize(key, typeof participant == "undefined" ? "yellow" : (participant.color || "#777"));
1466 jq_namediv.addClass("play");
1467 setTimeout(function() {
1468 jq_namediv.removeClass("play");
1469 }, 30);
1470 }, delay_ms);
1471 }
1472 };
1473
1474 Piano.prototype.stop = function(note, participant, delay_ms) {
1475 if(!this.keys.hasOwnProperty(note)) return;
1476 var key = this.keys[note];
1477 if(key.loaded) this.audio.stop(key.note, delay_ms, participant.id);
1478 if(typeof gMidiOutTest === "function") gMidiOutTest(key.note, 0, delay_ms);
1479 };
1480
1481 var gPiano = new Piano(document.getElementById("piano"));
1482
1483 var gAutoSustain = true;
1484 var gSustain = false;
1485
1486 var gHeldNotes = {};
1487 var gSustainedNotes = {};
1488
1489 // roll
1490 function roll(id, vol, i) {
1491 if (octTemp == 1) { //check Logan
1492 gPiano.play(id, vol !== undefined ? vol : DEFAULT_VELOCITY, gClient.getOwnParticipant(), 0);
1493 gClient.startNote(id, vol);
1494 return;
1495 }
1496 setTimeout(function() {
1497 gPiano.play(id, vol !== undefined ? vol : DEFAULT_VELOCITY, gClient.getOwnParticipant(), 0);
1498 gClient.startNote(id, vol);
1499 }, delays + (delays * i));
1500 }
1501 // pressing
1502 function pressing(id, vol) {
1503 if (ouch) {
1504 for (i=0; i <= ouchN; i++) {
1505 setTimeout( function() { gPiano.play(id, vol !== undefined ? vol : DEFAULT_VELOCITY, gClient.getOwnParticipant(), 0);}, ouchD * i);
1506 if (!politePlay) {
1507 setTimeout( function() { gClient.startNote(id, vol);}, ouchD * i)
1508 }
1509 }
1510
1511 } else {
1512 gPiano.play(id, vol !== undefined ? vol : DEFAULT_VELOCITY, gClient.getOwnParticipant(), 0);
1513 if (!politePlay) {
1514 gClient.startNote(id, vol);
1515 }
1516 }
1517 }
1518
1519 // press
1520 function press(id, vol) {
1521 //thanks electrashave!
1522 var pKey = gPiano.keys[id];
1523 for (as in MPP.piano.keys) {
1524 var key = MPP.piano.keys[as];
1525 if (key.num == (pKey.num + transLvl)) {
1526 id = key.note
1527 }
1528 }
1529
1530 if (mouseNote) {
1531 // thanks Chacha!
1532 try {
1533 var rect = gPiano.keys[id].rect;
1534 var t = 900; // 900
1535 var x = (rect.x + rect.x2) / 2; // Position within piano
1536 x /= gPiano.renderer.width; // Position within renderer
1537 x *= 95; // 100% minus left offset (3%) minus right offset (2%)
1538 x += 3; // Left offset of 3%, gives position within window
1539 var y = rect.h; // === rect.y2 - rect.y
1540 y -= gPiano.renderer.height * 0.75; // Center around midpoint between black and white keys.
1541 y /= 10; // Scale to fit the keys. (This is arbitrary since the height of the keys will vary between users anyway.)
1542 y += 50; // Center on middle of screen
1543 x += (Math.random()+Math.random()-1)*0.5; // Alters x slightly each press
1544 y += (Math.random()+Math.random()+Math.random()+Math.random()-2)*2.5; // Alters y slightly each press
1545 setTimeout(()=>gClient.sendArray([{ m: "m", x: x, y: y }]), t); // Wait for t before
1546 } catch (e) {console.log("mouseNote err: " + e)} // If there's an error log it
1547 }
1548
1549 var me = gClient.getOwnParticipant();
1550
1551 if (randNoteColour && !ignoreNotes && !politePlay) {
1552 me = gClient.getOwnParticipant();
1553 me.color = Col();
1554
1555 } else if (ignoreNotes && politePlay) {
1556 randNoteColour = true;
1557 me = gClient.getOwnParticipant();
1558 me.color = "purple";
1559
1560 } else if (ignoreNotes) {
1561 randNoteColour = true;
1562 me = gClient.getOwnParticipant();
1563 me.color = "red";
1564
1565 } else if (politePlay) {
1566 randNoteColour = true;
1567 me = gClient.getOwnParticipant();
1568 me.color = "blue";
1569 }
1570
1571
1572 if (delPlay) {
1573 setTimeout(function() {
1574 gPiano.play(id, vol !== undefined ? vol : DEFAULT_VELOCITY, gClient.getOwnParticipant(), 0);
1575 gClient.startNote(id, vol);
1576 }, delTime);
1577 }
1578
1579 var note = id.replace(/[0-9]/g, '').replace("-", "");
1580 var octave = parseInt(id.replace(/[^\d.]/, '').replace('s', ''));
1581 if (octTemp >= 3) {
1582 if (octTemp > 4) {
1583 octave = octave - 2;
1584 } else {
1585 octave = octave - 1;
1586 }
1587 }
1588 for (i = 0; i < octTemp; i++) {
1589 if (rollTemp) {
1590 roll(note + (octave + i), vol, i);
1591 } else {
1592 pressing(note + (octave + i), vol);
1593 }
1594 }
1595 gHeldNotes[id] = true;
1596 gSustainedNotes[id] = true;
1597
1598 }
1599 // release roll
1600 function releaseRoll(id, i) {
1601 setTimeout(function() {
1602 gPiano.stop(id, gClient.getOwnParticipant(), 0);
1603 gClient.stopNote(id);
1604 gSustainedNotes[id] = false;
1605 }, delays + (delays * i));
1606 }
1607
1608 // releasing
1609 function releasing(id) {
1610 gPiano.stop(id, gClient.getOwnParticipant(), 0);
1611 gClient.stopNote(id);
1612 gSustainedNotes[id] = false;
1613 }
1614
1615 // release
1616 function release(id) {
1617 if (gHeldNotes[id]) {
1618 gHeldNotes[id] = false;
1619 if (gAutoSustain || gSustain) {
1620 gSustainedNotes[id] = true;
1621 } else {
1622 if (gNoteQuota.spend(1)) {
1623 var octave = parseInt(id.replace(/[^\d.]/, '').replace('s', ''));
1624 var note = id.replace(/[0-9]/g, '').replace("-", "");
1625 if (octTemp >= 3) {
1626 if (octTemp > 4) {
1627 octave = octave - 2;
1628 } else {
1629 octave = octave - 1;
1630 }
1631 }
1632 for (i = 0; i < octTemp; i++) {
1633 if (rollTemp) {
1634 releaseRoll(note + (octave + i), i);
1635 } else {
1636 releasing(note + (octave + i));
1637 }
1638 }
1639 }
1640 }
1641 }
1642 }
1643
1644 function pressSustain() {
1645 gSustain = true;
1646 }
1647
1648 function releaseSustain() {
1649 gSustain = false;
1650 if (!gAutoSustain) {
1651 for (var id in gSustainedNotes) {
1652 if (gSustainedNotes.hasOwnProperty(id) && gSustainedNotes[id] && !gHeldNotes[id]) {
1653 if (gNoteQuota.spend(0)) {
1654 gPiano.stop(id, gClient.getOwnParticipant(), 0);
1655 gClient.stopNote(id);
1656 }
1657 }
1658 }
1659 }
1660 }
1661
1662
1663
1664
1665 // internet science
1666
1667 ////////////////////////////////////////////////////////////////
1668
1669 var channel_id = decodeURIComponent(window.location.pathname);
1670 if(channel_id.substr(0, 1) == "/") channel_id = channel_id.substr(1);
1671 if(channel_id.startsWith("piano")) channel_id = channel_id.substr(6);
1672 if(channel_id == "") channel_id = "lobby";
1673
1674 var wssport = window.location.hostname == "www.multiplayerpiano.com" ? 443 : 1234;
1675 var gClient = new Client("ws://" + window.location.hostname + ":" + wssport);
1676 gClient.setChannel(channel_id);
1677 gClient.start();
1678
1679 // Setting status
1680 (function () {
1681 gClient.on("count", function (status) {
1682 $("#status").text(status);
1683 });
1684 gClient.on("count", function (count) {
1685 if (count > 0) {
1686 $("#status").html('<span class="number">' + count + '</span> ' + (count == 1 ? 'player' : 'players'));
1687 document.title = "Loli.dance [v" + botVersion + "] (" + count + ")";
1688 } else {
1689 document.title = "Logan's Bot [v" + botVersion + "]";
1690 }
1691 });
1692 })();
1693
1694 // Handle changes to participants
1695 (function () {
1696 gClient.on("participant added", function (part) {
1697
1698 part.displayX = 0.75; //150
1699 part.displayY = 25; //50
1700
1701 // add nameDiv
1702 var div = document.createElement("div");
1703 div.className = "name";
1704 div.participantId = part.id;
1705 div.textContent = part.name || selfName; // ""
1706 div.style.backgroundColor = part.color || "#777";
1707 if (gClient.participantId === part.id) {
1708 $(div).addClass("me");
1709 }
1710 if (gClient.channel && gClient.channel.crown && gClient.channel.crown.participantId === part.id) {
1711 $(div).addClass("owner");
1712 }
1713 if (gPianoMutes.indexOf(part._id) !== -1) {
1714 $(part.nameDiv).addClass("muted-notes");
1715 }
1716 if (gChatMutes.indexOf(part._id) !== -1) {
1717 $(part.nameDiv).addClass("muted-chat");
1718 }
1719 div.style.display = "none";
1720 part.nameDiv = $("#names")[0].appendChild(div);
1721 $(part.nameDiv).fadeIn(500); //2000
1722
1723 // sort names
1724 var arr = $("#names .name");
1725 arr.sort(function (a, b) {
1726 a = a.style.backgroundColor; // todo: sort based on user id instead
1727 b = b.style.backgroundColor;
1728 if (a > b) return 1;
1729 else if (a < b) return -1;
1730 else return 0;
1731 });
1732 $("#names").html(arr);
1733
1734 // add cursorDiv //gSeeOwnCursor
1735 if (gClient.participantId !== part.id || showOwnMouse) {
1736 var div = document.createElement("div");
1737 div.className = "cursor";
1738 div.style.display = "none";
1739 part.cursorDiv = $("#cursors")[0].appendChild(div);
1740 $(part.cursorDiv).fadeIn(500); //2000
1741
1742 //sets mouse position on join (thanks Josh)
1743 part.cursorDiv.style.left = 46.73 + "%";
1744 part.cursorDiv.style.top = 19.60 + "%";
1745
1746 var div = document.createElement("div");
1747 div.className = "name";
1748 div.style.backgroundColor = part.color || "#777"
1749 div.textContent = part.name || selfName; // ""
1750 part.cursorDiv.appendChild(div);
1751
1752 } else {
1753 part.cursorDiv = undefined;
1754 }
1755 });
1756 gClient.on("participant removed", function (part) { //when the participant leaves
1757 // remove nameDiv
1758 var nd = $(part.nameDiv);
1759 var cd = $(part.cursorDiv);
1760 cd.fadeOut(500); //2000
1761 nd.fadeOut(450, function () { //2000
1762 nd.remove();
1763 cd.remove();
1764 part.nameDiv = undefined;
1765 part.cursorDiv = undefined;
1766 });
1767 });
1768 gClient.on("participant update", function (part) {
1769 var name = part.name || "";
1770 var color = part.color || "#777";
1771 part.nameDiv.style.backgroundColor = color;
1772 part.nameDiv.textContent = name;
1773 $(part.cursorDiv)
1774 .find(".name")
1775 .text(name)
1776 .css("background-color", color);
1777 });
1778 gClient.on("ch", function (msg) {
1779 for (var id in gClient.ppl) {
1780 if (gClient.ppl.hasOwnProperty(id)) {
1781 var part = gClient.ppl[id];
1782 if (part.id === gClient.participantId) {
1783 $(part.nameDiv).addClass("me");
1784 } else {
1785 $(part.nameDiv).removeClass("me");
1786 }
1787 if (msg.ch.crown && msg.ch.crown.participantId === part.id) {
1788 $(part.nameDiv).addClass("owner");
1789 $(part.cursorDiv).addClass("owner");
1790 } else {
1791 $(part.nameDiv).removeClass("owner");
1792 $(part.cursorDiv).removeClass("owner");
1793 }
1794 if (gPianoMutes.indexOf(part._id) !== -1) {
1795 $(part.nameDiv).addClass("muted-notes");
1796 } else {
1797 $(part.nameDiv).removeClass("muted-notes");
1798 }
1799 if (gChatMutes.indexOf(part._id) !== -1) {
1800 $(part.nameDiv).addClass("muted-chat");
1801 } else {
1802 $(part.nameDiv).removeClass("muted-chat");
1803 }
1804 }
1805 }
1806 });
1807 })();
1808
1809
1810 // Handle changes to crown
1811 (function () {
1812 var jqcrown = $('<div id="crown"></div>').appendTo(document.body).hide();
1813 var jqcountdown = $('<span></span>').appendTo(jqcrown);
1814 var countdown_interval;
1815 jqcrown.click(function () {
1816 gClient.sendArray([{
1817 m: "chown",
1818 id: gClient.participantId
1819 }]);
1820 });
1821 gClient.on("ch", function (msg) {
1822 if (msg.ch.crown) {
1823 var crown = msg.ch.crown;
1824 if (!crown.participantId || !gClient.ppl[crown.participantId]) {
1825 var land_time = crown.time + 2000 - gClient.serverTimeOffset;
1826 var avail_time = crown.time + 15000 - gClient.serverTimeOffset;
1827 jqcountdown.text("");
1828 jqcrown.show();
1829 if (land_time - Date.now() <= 0) {
1830 jqcrown.css({
1831 "left": crown.endPos.x + "%",
1832 "top": crown.endPos.y + "%"
1833 });
1834 } else {
1835 jqcrown.css({
1836 "left": crown.startPos.x + "%",
1837 "top": crown.startPos.y + "%"
1838 });
1839 jqcrown.addClass("spin");
1840 jqcrown.animate({
1841 "left": crown.endPos.x + "%",
1842 "top": crown.endPos.y + "%"
1843 }, 2000, "linear", function () {
1844 jqcrown.removeClass("spin");
1845 });
1846 }
1847 clearInterval(countdown_interval);
1848 countdown_interval = setInterval(function () {
1849 var time = Date.now();
1850 if (time >= land_time) {
1851 var ms = avail_time - time;
1852 if (ms > 0) {
1853 jqcountdown.text(Math.ceil(ms / 1000) + "s");
1854 } else {
1855 jqcountdown.text("");
1856 clearInterval(countdown_interval);
1857 }
1858 }
1859 }, 1000);
1860 } else {
1861 jqcrown.hide();
1862 }
1863 } else {
1864 jqcrown.hide();
1865 }
1866 });
1867 gClient.on("disconnect", function () {
1868 jqcrown.fadeOut(2000);
1869 });
1870 })();
1871
1872
1873// Josh's playThing
1874 function playThing(notes, veloc, delay, times) {
1875 setTimeout(function() {
1876 gClient.sendArray([{
1877 m: "n",
1878 t: times,
1879 n: [{
1880 n: notes,
1881 v: veloc
1882 }]
1883 }]);
1884 }, delay);
1885 //console.log(notes);
1886 }
1887
1888
1889// Playing notes
1890 gClient.on("n", function(msg) {
1891 var t = msg.t - gClient.serverTimeOffset + TIMING_TARGET - Date.now();
1892 var participant = gClient.findParticipantById(msg.p);
1893 if (gPianoMutes.indexOf(participant._id) !== -1)
1894 return;
1895 for (var i = 0; i < msg.n.length; i++) {
1896 var note = msg.n[i];
1897 var octave = parseInt(note.n.replace( /[^\d.]/, '').replace('s', ''));
1898 if (octave > 7) {
1899 return;
1900 }
1901 var ms = t + (note.d || 0);
1902 if (ms < 0) {
1903 ms = 0;
1904 } else if (ms > 10000) continue;
1905 if (ignoreNotes) {
1906 if (participant.id == gClient.participantId) {
1907 if (note.s) {
1908 gPiano.stop(note.n, participant, ms);
1909 } else {
1910 var vel = (typeof note.v !== "undefined") ? parseFloat(note.v) : DEFAULT_VELOCITY;
1911 if (vel < 0) vel = 0;
1912 else if (vel > 1) vel = 1;
1913 gPiano.play(note.n, vel, participant, ms);
1914 }
1915 }
1916 } else {
1917 if (note.s) {
1918 gPiano.stop(note.n, participant, ms);
1919 } else {
1920 var vel = (typeof note.v !== "undefined") ? parseFloat(note.v) : DEFAULT_VELOCITY;
1921 if (vel < 0) vel = 0;
1922 else if (vel > 1) vel = 1;
1923 gPiano.play(note.n, vel, participant, ms);
1924 if (copyNotes){
1925 playThing(note.n,vel,note.d||0, t);
1926 }
1927 }
1928 }
1929 }
1930 });
1931
1932 // Send cursor updates
1933 // mouse optimizations by Alex
1934 var mx = 0, last_mx = -2.5, my = 0, last_my = -2.5;
1935 setInterval(function() {
1936 if (Math.abs(mx - last_mx) > 0.1 || Math.abs(my - last_my) > 0.1) {
1937 last_mx = mx;
1938 last_my = my;
1939 if (!incognito){
1940 gClient.sendArray([{m: "m", x: mx, y: my}]);
1941 }
1942 }
1943 }, 50);
1944
1945 $(document).mousemove(function(event) {
1946 mx = ((event.pageX / $(window).width()) * 100).toFixed(2);
1947 my = ((event.pageY / $(window).height()) * 100).toFixed(2);
1948 });
1949
1950 // Animate cursors
1951 setInterval(function() {
1952 for (var id in gClient.ppl) {
1953 if (!gClient.ppl.hasOwnProperty(id)) continue;
1954 var part = gClient.ppl[id];
1955 if (part.cursorDiv && (Math.abs(part.x - part.displayX) > 0.1 || Math.abs(part.y - part.displayY) > 0.1)) {
1956 part.displayX += (part.x - part.displayX) * 0.25;
1957 part.displayY += (part.y - part.displayY) * 0.25;
1958 part.cursorDiv.style.left = part.displayX + "%";
1959 part.cursorDiv.style.top = part.displayY + "%";
1960 if (autoFollow && part._id != selfId) {
1961 followId = part._id;
1962 }
1963 }
1964 }
1965 }, 1);
1966
1967 // Room settings button
1968 (function () {
1969 gClient.on("ch", function (msg) {
1970 if (gClient.isOwner()) {
1971 $("#room-settings-btn").show();
1972 $("#room-settings-btn").animate({opacity:0.7},100); //animates it thanks B@K$
1973 } else {
1974 $("#room-settings-btn").css("display","block"); //shows it
1975 $("#room-settings-btn").animate({opacity:0.3},100);
1976 }
1977 });
1978 $("#room-settings-btn").click(function (evt) { //room settings button
1979 if (gClient.channel && gClient.isOwner()) {
1980 var settings = gClient.channel.settings;
1981 openModal("#room-settings");
1982 setTimeout(function () {
1983 $("#room-settings .checkbox[name=visible]").prop("checked", settings.visible);
1984 $("#room-settings .checkbox[name=chat]").prop("checked", settings.chat);
1985 $("#room-settings .checkbox[name=crownsolo]").prop("checked", settings.crownsolo);
1986 }, 100);
1987 }
1988 });
1989 $("#room-settings .submit").click(function () {
1990 var settings = {
1991 visible: $("#room-settings .checkbox[name=visible]").is(":checked"),
1992 chat: $("#room-settings .checkbox[name=chat]").is(":checked"),
1993 crownsolo: $("#room-settings .checkbox[name=crownsolo]").is(":checked")
1994 };
1995 gClient.sendArray([{
1996 m: "chset",
1997 set: settings
1998 }]);
1999 closeModal();
2000 });
2001 $("#room-settings .drop-crown").click(function () {
2002 gClient.sendArray([{
2003 m: "chown"
2004 }]);
2005 closeModal();
2006 });
2007 })();
2008
2009 // Handle notifications
2010 gClient.on("notification", function (msg) {
2011 new Notification(msg);
2012 });
2013
2014 //cursor float
2015 /*gClient.on("ch", function (msg) {
2016 var chidlo = msg.ch._id.toLowerCase();
2017 if (chidlo === "a" || chidlo.substr() === "a") {
2018 $(".cursor").addClass("floating");
2019 } else {
2020
2021 $(".cursor").addClass("floating");
2022
2023 }
2024 });*/
2025
2026 // Don't forget spin
2027 /*gClient.on("ch", function (msg) {
2028 var chidlo = msg.ch._id.toLowerCase();
2029 if (chidlo === "spin" || chidlo.substr(-5) === "/spin") {
2030 $("#piano").addClass("spin");
2031 } else {
2032 $("#piano").removeClass("spin");
2033 }
2034 });*/
2035
2036 // Crownsolo notice
2037 gClient.on("ch", function (msg) {
2038 if (msg.ch.settings.crownsolo) {
2039 if ($("#crownsolo-notice").length == 0) {
2040 $('<div id="crownsolo-notice">').text('Only owner can play mode').appendTo("body").fadeIn(500);
2041 }
2042 } else {
2043 $("#crownsolo-notice").remove();
2044 }
2045 });
2046 gClient.on("disconnect", function () {
2047 $("#crownsolo-notice").remove();
2048 $("#nochat-notice").remove();
2049 });
2050
2051
2052
2053 var gPianoMutes = ["3ed152147e36d229cf5b7cba", "9b8df25492874a938ce9fb74"];
2054
2055 var gChatMutes = [];
2056
2057 //animated name stuff
2058 if (animName) {
2059 setInterval(function() {
2060 if (heyThereKitty == MPP.client.getOwnParticipant().name) return;
2061 updateName(heyThereKitty); //name to print
2062 if (followId == heyThereKittyId) return;
2063 followId = heyThereKittyId;
2064 }, 2100);
2065 }
2066
2067 // thanks Kappa
2068 /*
2069 var i = 0;
2070 setInterval(function() {
2071 MPP.client.sendArray([{
2072 m: "userset"
2073 , set: {
2074 name: selfName.slice(i % selfName.length) + selfName.slice(0, i++ % selfName.length)
2075 }
2076 }]);
2077 }, 2100)
2078 */
2079
2080 var volume_slider = new VolumeSlider(document.getElementById("volume"), function (v) {
2081 gPiano.audio.setVolume(v);
2082 if (window.localStorage) localStorage.volume = v;
2083 });
2084 volume_slider.set(gPiano.audio.volume);
2085
2086 var Note = function (note, octave) {
2087 this.note = note;
2088 this.octave = octave || 0;
2089 };
2090
2091
2092
2093 var n = function (a, b) {
2094 return {
2095 note: new Note(a, b),
2096 held: false
2097 };
2098 };
2099 //Logan, these are the key bindings for on the piano
2100 var key_binding = {
2101 65: n("gs"),
2102 90: n("a"),
2103 83: n("as"),
2104 88: n("b"),
2105 67: n("c", 1),
2106 70: n("cs", 1),
2107 86: n("d", 1),
2108 71: n("ds", 1),
2109 66: n("e", 1),
2110 78: n("f", 1),
2111 74: n("fs", 1),
2112 77: n("g", 1),
2113 75: n("gs", 1),
2114 188: n("a", 1),
2115 76: n("as", 1),
2116 190: n("b", 1),
2117 191: n("c", 2),
2118 222: n("cs", 2),
2119
2120 49: n("gs", 1),
2121 81: n("a", 1),
2122 50: n("as", 1),
2123 87: n("b", 1),
2124 69: n("c", 2),
2125 52: n("cs", 2),
2126 82: n("d", 2),
2127 53: n("ds", 2),
2128 84: n("e", 2),
2129 89: n("f", 2),
2130 55: n("fs", 2),
2131 85: n("g", 2),
2132 56: n("gs", 2),
2133 73: n("a", 2),
2134 57: n("as", 2),
2135 79: n("b", 2),
2136 80: n("c", 3),
2137 189: n("cs", 3),
2138 219: n("d", 3),
2139 187: n("ds", 3),
2140 221: n("e", 3)
2141 };
2142
2143 var capsLockKey = false; //here are some settings, Logan
2144 var gSustain = false;
2145 var keys = [];
2146 var volTemp = 1;
2147
2148 function handleKeyDown(evt) {
2149 var key = evt.keyCode;
2150 keys[key] = true;
2151
2152 // volume changing
2153 if (keys[107]) {
2154 volume > 0.9 ? volume = 1 : volume += 0.1;
2155 msgBox('Note Volume', 'Volume: ' + parseFloat(volume.toFixed(2)), 1000, '#piano');
2156
2157 } else if (keys[109]) {
2158 volume < 0.1 ? volume = 0 : volume -= 0.1;
2159 msgBox('Note Volume', 'Volume: ' + parseFloat(volume.toFixed(2)), 1000, '#piano');
2160 }
2161 // multi-octave toggling
2162 if (keys[38]) {
2163 octTemp > 6 ? octTemp = 7 : ++octTemp;
2164 msgBox('Multi-octave', 'Level ' + octTemp, 1000, '#piano');
2165
2166 } else if (keys[40]) {
2167 octTemp < 2 ? octTemp = 1 : --octTemp;
2168 msgBox('Multi-octave', 'Level ' + octTemp, 1000, '#piano');
2169 }
2170
2171 // roll toggling
2172 if (keys[35] && rollTemp) {
2173 rollTemp = false;
2174 msgBox('Roll', 'Disabled', 1000, '#piano');
2175
2176 } else if (keys[35] && !rollTemp) {
2177 rollTemp = true;
2178 msgBox('Roll', 'Enabled', 1000, '#piano');
2179 }
2180
2181 // sustain toggling
2182 //Insert key
2183 if (keys[45] && !susTemp) {
2184 msgBox('Sustain', 'Enabled', 1000, '#piano');
2185 susTemp = true;
2186
2187 } else if (keys[45] && susTemp) {
2188 msgBox('Sustain', 'Disabled', 1000, '#piano');
2189 susTemp = false;
2190 }
2191 if (!susTemp) {
2192 gAutoSustain = false;
2193 } else if (susTemp) {
2194 gAutoSustain = true;
2195 }
2196
2197 var code = parseInt(evt.keyCode); //move up and make use of more Logan
2198
2199 //numpad5
2200 if (code == 101 || code == 12) { //delay
2201 delPlay = !delPlay; //swaps it
2202 if (!delPlay) {
2203 msgBox('Delay', 'Disabled', 1000, '#piano');
2204 } else {
2205 msgBox('Delay', 'Enabled', 1000, '#piano');
2206 }
2207 //Pagedown
2208 } else if (code == 34) { //ignore
2209 ignoreNotes = !ignoreNotes;
2210 if (!ignoreNotes) {
2211 msgBox('Ignore Notes', 'Disabled', 1000, '#piano');
2212 } else {
2213 msgBox('Ignore Notes', 'Enabled', 1000, '#piano');
2214 }
2215 //Pageup
2216 } else if (code == 33) { //bot on/off [clean this logan]
2217 if (bot == 2) {
2218 bot = 0;
2219 msgBox('Commands', 'Disabled', 1000, '#piano');
2220 } else if (bot == 0) {
2221 bot = 1;
2222 msgBox('Commands', 'For everyone', 1000, '#piano');
2223 } else if (bot == 1) {
2224 bot = 2;
2225 msgBox('Commands', 'Only for you', 1000, '#piano');
2226 }
2227
2228 //numpad *
2229 } else if (code == 106) { //bot on/off //♥ REMOVE AND JUST MAKE NUMPAD - GO TO 0 ♥//
2230 if (timeStamp) {
2231 timeStamp = false;
2232 msgBox('Timestamps', 'Off', 1000, '#piano');
2233 } else {
2234 timeStamp = true;
2235 msgBox('Timestamps', 'On', 1000, '#piano');
2236 }
2237
2238 //numpad 0
2239 } else if (code == 96) { //reconnect
2240 MPP.client.stop();
2241 MPP.client.start();
2242 msgBox('Reconnecting...', '', 2000, '#piano');
2243
2244 //numpad 1
2245 } else if (code == 97) { //private room
2246 var room_name = randStr(28);
2247 changeRoom(room_name, "right", {
2248 "visible": false,
2249 "chat": true,
2250 "crownsolo": false,
2251 "lobby": false
2252 });
2253 //numpad 2
2254 } else if (code == 98) { //illuminati hotkey (until I find a better use)
2255 if (autoFollow) {
2256 autoFollow = false;
2257 following = false;
2258 followId = null;
2259 msgBox('Auto Follow', 'Off', 2000, '#blah-btn');
2260 } else {
2261 autoFollow = true;
2262 following = true;
2263 msgBox('Auto Follow', 'On', 2000, '#blah-btn');
2264 }
2265 //tab
2266 } else if (code == 9) { //hotkeymsg
2267 tab(); //ring ring..
2268
2269 //ctrl
2270 } else if (code == 17) { //drop crown
2271 gClient.sendArray([{
2272 m: "chown"
2273 }]);
2274 msgBox('Dropping crown', '', 1000, '#piano');
2275
2276 //alt
2277 } else if (code == 18) { //pickup crown
2278 gClient.sendArray([{
2279 m: "chown",
2280 id: gClient.participantId
2281 }]);
2282 msgBox('Picking up crown', '', 1000, '#piano');
2283
2284 //H
2285 } else if (code == 72) { //display help
2286 new Notification({id: "volume", title: "Hotkeys (thanks B@K$ for the design)", html: '\
2287 <h3>๖ۣۜHold to display binds and hotkeys...</h3>\
2288 <font color="#FF0066">Page Up:</font>Turns on/off chat commands (excluding !js and !room)<br />\
2289 <font color="#FF0066">Page Down</font> Ignores everyone elses notes<br />\
2290 <font color="#FF0066">End</font> Toggles rolling on multi-octaves<br />\
2291 <font color="#FF0066">Up/Down Arrows</font> Turns sets number of multi-octave<br />\
2292 <font color="#FF0066">Left/Right Arrows</font> electrashave\'s note transposing<br />\
2293 <font color="#FF0066">Insert</font> Toggles sustain (default was backspace)<br />\
2294 <font color="#FF0066">Backspace</font> Alerts you if someone in the friends list array joins<br />\
2295 <font color="#FF0066">Delete</font> Toggles an alert sound and notifcation if "Logan" is said<br />\
2296 <font color="#FF0066">Home *new</font> Toggles Polite Play Mode<br />\
2297 <font color="#FF0066">\\</font> Speech to text for Chrome (click accept then speak)<br />\
2298 <font color="#FF0066">Spacebar</font> Plays low notes while held<br />\
2299 <font color="#FF0066">~</font> Plays high notes while held<br />\
2300 <font color="#FF0066">Tab</font> Sends hotkey message<br />\
2301 <font color="#FF0066">3</font> Toggles owner only mode (need crown)<br />\
2302 <font color="#FF0066">6</font> Toggles room visibility (need crown)<br />\
2303 <font color="#FF0066">Numpad + -</font> Change note volume<br />\
2304 <font color="#FF0066">Numpad *</font> Toggles timestamps in chat<br />\
2305 <font color="#FF0066">Numpad .</font> Meow meow meow<br />\
2306 <font color="#FF0066">Numpad 0</font> Quick reconnect<br />\
2307 <font color="#FF0066">Numpad 1</font> Play Alone<br />\
2308 <font color="#FF0066">Numpad 2</font> Auto Follow<br />\
2309 <font color="#FF0066">Numpad 3</font> Lenny<br />\
2310 <font color="#FF0066">Numpad 4</font> Toggle Bunny<br />\
2311 <font color="#FF0066">Numpad 5</font> Toggles delay<br />\
2312 <font color="#FF0066">Numpad 6</font> Toggles Pong<br />\
2313 <font color="#FF0066">Numpad 7</font> Toggles text to speech<br />\
2314 <font color="#FF0066">Numpad 8</font> Toggles SomeGuy\'s incognito<br />\
2315 <font color="#FF0066">Alt</font> Picks up the crown<br />\
2316 <font color="#FF0066">Ctrl</font> Drops the crown<br />\
2317 <font color="#FF0066">H</font> Displays displays Hotkeys again<br />\
2318 <font color="#FF3399">!lhelp</font> Displays local commands in chat<br />\
2319 To stop this message displaying every time you start the script search for <font color="#FF0066">i_know_how_to_use_this_bot</font> and change <font color="#CC0000">false</font> to <font color="#0066FF">true</font>.<br />\
2320 ', target: "#blah-btn", duration: 600});
2321
2322//--TEST--TEST--TEST////--TEST--TEST--TEST////--TEST--TEST--TEST//
2323 //numpad .
2324 } else if (code == 110) { //hotkey test
2325 if (meow) {
2326 meow = false;
2327 msgBox('Cat Mode', 'Off', 1000, '#blah-btn');
2328 } else {
2329 meow = true;
2330 msgBox('Cat Mode', 'On', 1000, '#blah-btn');
2331 }
2332
2333
2334//--TEST--TEST--TEST////--TEST--TEST--TEST////--TEST--TEST--TEST//
2335
2336
2337 // ♥ Thanks Josh ♥ //
2338 // \ key
2339 } else if (code == 220) { //Yoshify's speech to text
2340 if (listening) {
2341 listening = false;
2342 Voice.stop();
2343 msgBox('Speech to Text', 'Stopping Capture', 3000, '#blah-btn');
2344 } else {
2345 listening = true;
2346 Voice.start();
2347 msgBox('Speech to Text', 'Listening (press again to send)', 3000, '#blah-btn');
2348 }
2349
2350 //numpad 7
2351 } else if (code == 103) { //speech toggle
2352 if (speechStatus) {
2353 speechStatus = false;
2354 speechSynthesis.cancel();
2355 msgBox('Text to Speech', 'Off', 1000, '#blah-btn');
2356 } else {
2357 speechStatus = true;
2358 msgBox('Text to Speech', 'On', 1000, '#blah-btn');
2359 }
2360 //del
2361 } else if (code == 46) { //alert on name said in chat toggle
2362 if (alertName) {
2363 alertName = false;
2364 msgBox('Alert on key-word', 'Off', 1000, '#blah-btn');
2365 } else {
2366 alertName = true;
2367 msgBox('Alert on key-word', 'On', 1000, '#blah-btn');
2368 }
2369 //home
2370 } else if (code == 36) { //politePlay
2371 if (politePlay) {
2372 politePlay = false;
2373 msgBox('Polite Play', 'Off', 1000, '#blah-btn');
2374 } else {
2375 politePlay = true;
2376 msgBox('Polite Play', 'On (others cannot hear your notes)', 1000, '#blah-btn');
2377 }
2378
2379 //backspace
2380 } else if (code == 8) { //alert on friends join toggle
2381 if (alertOnFriendJoin) {
2382 alertOnFriendJoin = false;
2383 msgBox('Alert on Friend Join', 'Off', 1000, '#blah-btn');
2384 } else {
2385 alertOnFriendJoin = true;
2386 msgBox('Alert on Friend Join', 'On', 1000, '#blah-btn');
2387 }
2388 // 3 key
2389 } else if (code == 51) { //owner only
2390 if (crownSoloToggle) {
2391 crownSoloToggle = false;
2392 MPP.client.sendArray([{m: "chset", set: {crownsolo: false}}]);
2393 msgBox('Owner Only', 'Off', 1000, '#blah-btn');
2394 } else {
2395 crownSoloToggle = true;
2396 MPP.client.sendArray([{m: "chset", set: {crownsolo: true}}]);
2397 msgBox('Owner Only', 'On', 1000, '#blah-btn');
2398 }
2399 // 6 key
2400 } else if (code == 54) { //hide room
2401 if (roomVisibleToggle) {
2402 roomVisibleToggle = false;
2403 MPP.client.sendArray([{m: "chset", set: {visible: false}}]);
2404 msgBox('Room Visible', 'No', 1000, '#blah-btn');
2405 } else {
2406 roomVisibleToggle = true;
2407 MPP.client.sendArray([{m: "chset", set: {visible: true}}]);
2408 msgBox('Room Visible', 'Yes', 1000, '#blah-btn');
2409 }
2410
2411
2412 } else if (code == 104) { //mouse updates
2413 if (incognito) {
2414 incognito = false;
2415 msgBox('Incognito', 'Off', 1000, '#blah-btn');
2416 } else {
2417 incognito = true;
2418 msgBox('Incognito', 'On', 1000, '#blah-btn');
2419 }
2420
2421 } else if (code == 105) { //copy notes
2422 if (copyNotes) {
2423 copyNotes = false;
2424 msgBox('Copy Notes', 'Off', 1000, '#blah-btn');
2425 } else {
2426 copyNotes = true;
2427 msgBox('Copy Notes', 'On', 1000, '#blah-btn');
2428 }
2429
2430 } else if (code == 100) { //cursor bunny
2431 testflipB = !testflipB;
2432 if (!testflipB) {
2433 msgBox('Bunny', 'Off', 1000, '#blah-btn');
2434 } else {
2435 setTimeout(function () {
2436 client = MPP.client;
2437 var bunny = new Bunny(client);
2438 worker.onmessage = function(event)
2439 {
2440 if(event.data.args)
2441 if(event.data.args.action==0){
2442 if(testflipB){ bunny.tick(); }
2443 }
2444 }
2445 worker.postMessage({delay:120,args:{action:0}});
2446 }, 120);
2447
2448
2449 var Bunny = function (client) {
2450 this.client = client;
2451
2452 this.vx = 1.5;
2453 this.vy = 2.2;
2454
2455 var self = this;
2456 self.part = self.client.ppl[self.client.participantId];
2457 client.on("ch", function () {
2458 self.part = self.client.ppl[self.client.participantId];
2459 });
2460 }
2461
2462 Bunny.prototype.tick = function () {
2463 if (!this.client.isConnected() || !this.part) return;
2464 this.part.x += this.vx;
2465 this.part.y += this.vy;
2466 if (this.part.x < 0) {
2467 this.vx = -this.vx;
2468 } else if (this.part.x > 100) {
2469 this.vx = -this.vx;
2470 }
2471 if (this.part.y < 0) {
2472 this.vy = -this.vy;
2473 } else if (this.part.y > 0) { //0 makes the ceiling which it bounces off
2474 this.vy = -this.vy;
2475 }
2476 this.client.sendArray([{
2477 m: "m",
2478 x: this.part.x,
2479 y: this.part.y
2480 }]);
2481 this.client.sendArray([{
2482 m: "m",
2483 x: this.part.x,
2484 y: this.part.y
2485 }]);
2486 worker.postMessage({delay:120,args:{action:0}});
2487 };
2488 msgBox('Bunny', 'On', 1000, '#blah-btn');
2489 }
2490
2491 //msgBox('Pong', 'Off', 1000, '#blah-btn');
2492
2493 } else if (code == 102) { //cursor pong
2494 testflipP = !testflipP;
2495 if (!testflipP) {
2496 msgBox('Pong', 'Off', 1000, '#blah-btn');
2497
2498 } else {
2499 //on
2500 setTimeout(function() {
2501 client = MPP.client;
2502 var pong = new Pong(client);
2503 worker.onmessage = function(event) {
2504 if (event.data.args)
2505 if (event.data.args.action == 0) {
2506 if (testflipP) {
2507 pong.tick();
2508 }
2509 }
2510 }
2511 worker.postMessage({
2512 delay: 60
2513 , args: {
2514 action: 0
2515 }
2516 });
2517 }, 60);
2518
2519
2520 var Pong = function(client) {
2521 this.client = client;
2522
2523 this.vx = 0.1875; //0.75
2524 this.vy = 0.275; //1.1
2525
2526 var self = this;
2527 self.part = self.client.ppl[self.client.participantId];
2528 client.on("ch", function() {
2529 self.part = self.client.ppl[self.client.participantId];
2530 });
2531 }
2532
2533 Pong.prototype.tick = function() {
2534 if (!this.client.isConnected() || !this.part) return;
2535 this.part.x += this.vx;
2536 this.part.y += this.vy;
2537 if (this.part.x < 0) {
2538 this.vx = -this.vx;
2539 } else if (this.part.x > 100) {
2540 this.vx = -this.vx;
2541 }
2542 if (this.part.y < 0) {
2543 this.vy = -this.vy;
2544 } else if (this.part.y > 100) {
2545 this.vy = -this.vy;
2546 }
2547
2548 //x is <--> 100 is --> 0 is <--
2549 //y is ^v 0 is ^ 100 is v
2550
2551 this.vx += Math.random() * 0.1 - 0.05;
2552 this.vy += Math.random() * 0.1 - 0.05;
2553 this.client.sendArray([{ //were two of these
2554 m: "m"
2555 , x: this.part.x
2556 , y: this.part.y
2557 }]);
2558 if (this.part.x < -10 || this.part.y < -10 || this.part.x > 110 || this.part.y > 110) {
2559 this.part.x = 50;
2560 this.part.y = 50;
2561 //resets the velocity when setting position
2562 this.vx = -this.vx;
2563 this.vy = -this.vy;
2564 }
2565 worker.postMessage({
2566 delay: 60
2567 , args: {
2568 action: 0
2569 }
2570 });
2571 };
2572 msgBox('Pong', 'On', 1000, '#blah-btn');
2573 }
2574
2575 } else if (code == 99) { //lenny
2576 var msgTmp = $("input").val(); //retain old text
2577 $("body #chat input").val(msgTmp + " ( ͡◕ ͜ʖ ͡◕)");
2578
2579 //numpad /
2580 } else if (code == 111) { //hotkey spam
2581 for(var key in MPP.piano.keys) MPP.press(key, volume);
2582
2583 //thanks electrashave!
2584 } else if (code == 39) {
2585 transLvl++;
2586 msgBox('Transposing (by electrashave)', 'Transpose level: ' + transLvl, 1000, '#blah-btn');
2587
2588 //thanks electrashave!
2589 } else if (code == 37) {
2590 transLvl--;
2591 msgBox('Transposing (by electrashave)', 'Transpose level: ' + transLvl, 1000, '#blah-btn');
2592 }
2593
2594 if (key_binding[code] !== undefined) {
2595 var binding = key_binding[code];
2596 if (!binding.held) {
2597 binding.held = true;
2598 if (gNoteQuota.spend(0)) {
2599 var note = binding.note;
2600 var octave = 1 + note.octave;
2601 // extra octaves
2602 if (keys[16])++octave;
2603 else if (keys[32])--octave == --octave + -octave;
2604 else if (keys[18])++octave == ++octave + +octave;
2605 else if (keys[192])++octave == ++octave + ++octave;
2606 else if (capsLockKey)--octave;
2607 var note = note.note;
2608 var vol = volume;
2609
2610 if (volume > 5) {
2611 volume = 5;
2612 }
2613 press(note + octave, vol);
2614 }
2615 }
2616
2617 if (++gKeyboardSeq == 3) {
2618 gKnowsYouCanUseKeyboard = true;
2619 if (window.gKnowsYouCanUseKeyboardTimeout) clearTimeout(gKnowsYouCanUseKeyboardTimeout);
2620 if (localStorage) localStorage.knowsYouCanUseKeyboard = true;
2621 if (window.gKnowsYouCanUseKeyboardNotification) gKnowsYouCanUseKeyboardNotification.close();
2622 }
2623
2624 evt.preventDefault();
2625 evt.stopPropagation();
2626 return false;
2627 } else if (code == 20) { // Caps Lock
2628 capsLockKey = true;
2629 evt.preventDefault();
2630 } else if (code === 0x20) { // Space Bar
2631 evt.preventDefault();
2632 } else if (code == 9) { // Tab (don't tab away from the piano)
2633 evt.preventDefault();
2634 } else if (code == 8) { // Backspace (don't navigate Back)
2635 evt.preventDefault();
2636 }
2637 };
2638
2639 //FIX BELOW MESS
2640
2641 var keys = [];
2642
2643 function handleKeyUp(evt) {
2644 var key = evt.keyCode;
2645 keys[key] = false;
2646 var code = parseInt(evt.keyCode);
2647 if (key_binding[code] !== undefined) {
2648 var binding = key_binding[code];
2649 if (binding.held) {
2650 keys[key] = false;
2651 binding.held = false;
2652
2653 if (!gAutoSustain && !gSustain) {
2654 if (gNoteQuota.spend(octTemp)) {
2655 var note = binding.note;
2656 var octave = 1 + note.octave;
2657 // extra octaves
2658 if (keys[16])++octave;
2659 else if (keys[32])--octave == --octave + -octave;
2660 else if (keys[18])++octave == ++octave + +octave;
2661 else if (keys[192])++octave == ++octave + ++octave;
2662 else if (capsLockKey)--octave;
2663 var note = note.note;
2664 release(note + octave); //was missing octave which didn't stop the note - Logan
2665 }
2666 }
2667 }
2668
2669 evt.preventDefault();
2670 evt.stopPropagation();
2671 return false;
2672 } else if (code == 20) { // Caps Lock
2673 capsLockKey = false;
2674 evt.preventDefault();
2675 } else if (code === 0x20) { // Space Bar
2676 evt.preventDefault();
2677 } else if (code == 8) { // Backspace (don't navigate Back)
2678 evt.preventDefault();
2679 }
2680 };
2681
2682 function handleKeyPress(evt) {
2683 evt.preventDefault();
2684 evt.stopPropagation();
2685 if (evt.keyCode == 27 || evt.keyCode == 13) {
2686 //add some stuff here Logan
2687 }
2688 return false;
2689 };
2690
2691 var recapListener = function (evt) {
2692 captureKeyboard();
2693 };
2694
2695 function captureKeyboard() {
2696 $("#piano").off("mousedown", recapListener);
2697 $("#piano").off("touchstart", recapListener);
2698 $(document).on("keydown", handleKeyDown);
2699 $(document).on("keyup", handleKeyUp);
2700 $(window).on("keypress", handleKeyPress);
2701 };
2702
2703 function releaseKeyboard() {
2704 $(document).off("keydown", handleKeyDown);
2705 $(document).off("keyup", handleKeyUp);
2706 $(window).off("keypress", handleKeyPress);
2707 $("#piano").on("mousedown", recapListener);
2708 $("#piano").on("touchstart", recapListener);
2709 };
2710
2711 captureKeyboard();
2712
2713
2714 var velocityFromMouseY = function () {
2715 return 0.1 + (my / 100) * 0.6;
2716 };
2717
2718
2719
2720
2721 // NoteQuota
2722 var gNoteQuota = (function () {
2723 var last_rat = 0;
2724 var nqjq = $("#quota .value");
2725 setInterval(function () {
2726 gNoteQuota.tick();
2727 }, 2000);
2728 return new NoteQuota(function (points) {
2729 // update UI
2730 var rat = (points / this.max) * 100; // 100
2731 if (rat <= last_rat)
2732 nqjq.stop(true, true).css("width", rat.toFixed(0) + "%");
2733 else
2734 nqjq.stop(true, true).animate({
2735 "width": rat.toFixed(0) + "%"
2736 }, 2000, "linear");
2737 last_rat = rat;
2738 });
2739 })();
2740 gClient.on("nq", function (nq_params) {
2741 gNoteQuota.setParams(nq_params);
2742 });
2743 gClient.on("disconnect", function () {
2744 gNoteQuota.setParams(NoteQuota.PARAMS_OFFLINE);
2745 });
2746
2747
2748
2749 // click participant names
2750 (function () {
2751 var ele = document.getElementById("names");
2752 var touchhandler = function (e) {
2753 var target_jq = $(e.target);
2754 if (target_jq.hasClass("name")) {
2755 target_jq.addClass("play");
2756 if (e.target.participantId == gClient.participantId) {
2757 var id = e.target.participantId;
2758 var part = gClient.ppl[id] || null;
2759 if (part) {
2760 participantMenu(part);
2761 e.stopPropagation();
2762 }
2763 } else if (e.target.participantId) {
2764 var id = e.target.participantId;
2765 var part = gClient.ppl[id] || null;
2766 if (part) {
2767 participantMenu(part);
2768 e.stopPropagation();
2769 }
2770 }
2771 }
2772 };
2773 ele.addEventListener("mousedown", touchhandler);
2774 ele.addEventListener("touchstart", touchhandler);
2775 var releasehandler = function (e) {
2776 $("#names .name").removeClass("play");
2777 };
2778 document.body.addEventListener("mouseup", releasehandler);
2779 document.body.addEventListener("touchend", releasehandler);
2780
2781 var removeParticipantMenus = function () {
2782 $(".participant-menu").fadeOut(500);
2783 $(".participantSpotlight").hide(); //what is this?
2784 document.removeEventListener("mousedown", removeParticipantMenus);
2785 document.removeEventListener("touchstart", removeParticipantMenus);
2786 };
2787
2788 var participantMenu = function (part) {
2789 if (!part) return;
2790 removeParticipantMenus();
2791 document.addEventListener("mousedown", removeParticipantMenus);
2792 document.addEventListener("touchstart", removeParticipantMenus);
2793 $("#" + part.id).find(".enemySpotlight").show(); //what is this D:
2794 var menu = $('<div class="participant-menu"></div>');
2795 $("body").append(menu);
2796 // move menu to name position
2797 var jq_nd = $(part.nameDiv);
2798 var pos = jq_nd.position();
2799 menu.css({
2800 "top": pos.top + jq_nd.height() + 15,
2801 "left": pos.left + 6,
2802 "background": part.color || "black"
2803 });
2804 menu.on("mousedown touchstart", function (evt) {
2805 evt.stopPropagation();
2806 var target = $(evt.target);
2807 if (target.hasClass("menu-item")) {
2808 target.addClass("clicked"); //why is this needed?
2809 menu.fadeOut(500, function () {
2810 removeParticipantMenus();
2811 });
2812 }
2813 });
2814 // this spaces stuff out but also can be used for informational purposes
2815 $('<div class="info"></div>').appendTo(menu).text(part._id)
2816 .on("mousedown touchstart", function (evt) {
2817 //prompt("Press CTRL C to copy "+ part.name +"'s ID", part._id);
2818 prompt(part.name.endsWith("s") ? "Press CTRL C to copy "+ part.name +"' ID" : "Press CTRL C to copy "+ part.name +"'s ID", part._id);
2819 });
2820
2821 // added menu items
2822
2823 // rename
2824 if (part._id == gClient.getOwnParticipant()._id) {
2825 $('<div class="menu-item">• Rename</div>').appendTo(menu)
2826 .on("mousedown touchstart", function (evt) {
2827 openModal("#rename", "input[name=name]");
2828 setTimeout(function () {
2829 $("#rename input[name=name]").val(gClient.ppl[gClient.participantId].name);
2830 $("#rename input[name=color]").val(gClient.ppl[gClient.participantId].color);
2831 }, 100);
2832 });
2833 }
2834
2835
2836 // master and unmaster
2837 if (masters.indexOf(part._id) == -1) {
2838 $('<div class="menu-item">• Master</div>').appendTo(menu)
2839 .on("mousedown touchstart", function (evt) {
2840 masters.push(part._id);
2841 gClient.sendArray([{ m: "a", message: "Mastered " + part.name + "."}])
2842 });
2843 } else {
2844 $('<div class="menu-item">• Unmaster</div>').appendTo(menu)
2845 .on("mousedown touchstart", function (evt) {
2846 delete masters[masters.indexOf(part._id)];
2847 gClient.sendArray([{ m: "a", message: "Unmastered " + part.name + "."}])
2848 });
2849 }
2850
2851
2852 // op and deop
2853 if (ops.indexOf(part._id) == -1) {
2854 $('<div class="menu-item">• Op</div>').appendTo(menu)
2855 .on("mousedown touchstart", function (evt) {
2856 ops.push(part._id);
2857 gClient.sendArray([{ m: "a", message: "Opped " + part.name + "."}])
2858 });
2859 } else {
2860 $('<div class="menu-item">• Deop</div>').appendTo(menu)
2861 .on("mousedown touchstart", function (evt) {
2862 delete ops[ops.indexOf(part._id)];
2863 gClient.sendArray([{ m: "a", message: "deopped " + part.name + "."}])
2864 });
2865 }
2866
2867 if (part._id != gClient.getOwnParticipant()._id) {
2868
2869 // follow and rest
2870 if (!followId) {
2871 $('<div class="menu-item">• Follow >.<</div>').appendTo(menu)
2872 .on("mousedown touchstart", function (evt) {
2873 following = true;
2874 followId = part._id;
2875
2876 msgBox('Following', part.name, 2000, '#piano');
2877 });
2878 } else {
2879 $('<div class="menu-item">• Rest <.></div>').appendTo(menu)
2880 .on("mousedown touchstart", function (evt) {
2881 following = false;
2882 followId = null;
2883 msgBox('Stopping', 'Phew...', 2000, '#piano');
2884 });
2885 }
2886
2887 if (gPianoMutes.indexOf(part._id) == -1) {
2888 $('<div class="menu-item">• Mute Notes</div>').appendTo(menu)
2889 .on("mousedown touchstart", function (evt) {
2890 gPianoMutes.push(part._id);
2891 $(part.nameDiv).addClass("muted-notes");
2892 });
2893 } else {
2894 $('<div class="menu-item">• Unmute Notes</div>').appendTo(menu)
2895 .on("mousedown touchstart", function (evt) {
2896 var i;
2897 while ((i = gPianoMutes.indexOf(part._id)) != -1)
2898 gPianoMutes.splice(i, 1);
2899 $(part.nameDiv).removeClass("muted-notes");
2900 });
2901 }
2902 if (gChatMutes.indexOf(part._id) == -1) {
2903 $('<div class="menu-item">• Mute Chat</div>').appendTo(menu)
2904 .on("mousedown touchstart", function (evt) {
2905 gChatMutes.push(part._id);
2906 $(part.nameDiv).addClass("muted-chat");
2907 });
2908 } else {
2909 $('<div class="menu-item">• Unmute Chat</div>').appendTo(menu)
2910 .on("mousedown touchstart", function (evt) {
2911 var i;
2912 while ((i = gChatMutes.indexOf(part._id)) != -1)
2913 gChatMutes.splice(i, 1);
2914 $(part.nameDiv).removeClass("muted-chat");
2915 });
2916 }
2917 if (!(gPianoMutes.indexOf(part._id) >= 0) || !(gChatMutes.indexOf(part._id) >= 0)) {
2918 $('<div class="menu-item">• Mute Completely</div>').appendTo(menu)
2919 .on("mousedown touchstart", function (evt) {
2920 gPianoMutes.push(part._id);
2921 gChatMutes.push(part._id);
2922 $(part.nameDiv).addClass("muted-notes");
2923 $(part.nameDiv).addClass("muted-chat");
2924 });
2925 }
2926 if ((gPianoMutes.indexOf(part._id) >= 0) || (gChatMutes.indexOf(part._id) >= 0)) {
2927 $('<div class="menu-item">• Unmute Completely</div>').appendTo(menu)
2928 .on("mousedown touchstart", function (evt) {
2929 var i;
2930 while ((i = gPianoMutes.indexOf(part._id)) != -1)
2931 gPianoMutes.splice(i, 1);
2932 while ((i = gChatMutes.indexOf(part._id)) != -1)
2933 gChatMutes.splice(i, 1);
2934 $(part.nameDiv).removeClass("muted-notes");
2935 $(part.nameDiv).removeClass("muted-chat");
2936 });
2937 }
2938
2939 // ban and unban
2940
2941
2942 if (gClient.isOwner()) {
2943 $('<div class="menu-item give-crown">• Give Crown</div>').appendTo(menu)
2944 .on("mousedown touchstart", function (evt) {
2945 gClient.sendArray([{
2946 m: "chown",
2947 id: part.id
2948 }]);
2949 });
2950
2951 $('<div class="menu-item kickban">• Kickban</div>').appendTo(menu).on("mousedown touchstart", function (evt)
2952 {
2953 var minutes = prompt ("How many minutes? (0-60)", "60");
2954
2955 if(minutes === null) return;
2956 minutes = parseFloat(minutes) || 0;
2957
2958 var ms = minutes * 60 * 1000;
2959
2960 gClient.sendArray([{m: "kickban", _id: part._id, ms: ms}]);
2961 });
2962 }
2963 }
2964 menu.fadeIn(500);
2965 };
2966 })();
2967
2968 // Notification class
2969
2970 ////////////////////////////////////////////////////////////////
2971
2972 var Notification = function (par) {
2973 EventEmitter.call(this);
2974
2975 var par = par || {};
2976
2977 this.id = "Notification-" + (par.id || Math.random());
2978 this.title = par.title || "";
2979 this.text = par.text || "";
2980 this.html = par.html || "";
2981 this.target = $(par.target || "#piano");
2982 this.duration = par.duration || 30000;
2983
2984 var self = this;
2985 var eles = $("#" + this.id);
2986 if (eles.length > 0) {
2987 eles.remove();
2988 }
2989 this.domElement = $('<div class="notification"><div class="notification-body"><div class="title"></div>' +
2990 '<div class="text"></div></div><div class="x">x</div></div>');
2991 this.domElement[0].id = this.id;
2992 this.domElement.find(".title").text(this.title);
2993 if (this.text.length > 0) {
2994 this.domElement.find(".text").text(this.text);
2995 } else if (this.html.length > 0) {
2996 this.domElement.find(".text").html(this.html);
2997 }
2998 document.body.appendChild(this.domElement.get(0));
2999
3000 this.position();
3001 this.onresize = function () {
3002 self.position();
3003 };
3004 $(window).on("resize", this.onresize);
3005
3006 this.domElement.find(".x").click(function () {
3007 self.close();
3008 });
3009
3010 if (this.duration > 0) {
3011 setTimeout(function () {
3012 self.close();
3013 }, this.duration);
3014 }
3015
3016 return this;
3017 }
3018
3019 mixin(Notification.prototype, EventEmitter.prototype);
3020 Notification.prototype.constructor = Notification;
3021
3022 Notification.prototype.position = function () {
3023 var pos = this.target.offset();
3024 var x = pos.left - (this.domElement.width() / 2) + (this.target.width() / 4);
3025 var y = pos.top - this.domElement.height() - 8;
3026 var width = this.domElement.width();
3027 if (x + width > $("body").width()) {
3028 x -= ((x + width) - $("body").width());
3029 }
3030 if (x < 0) x = 0;
3031 this.domElement.offset({
3032 left: x,
3033 top: y
3034 });
3035 };
3036
3037 Notification.prototype.close = function () {
3038 var self = this;
3039 $(window).off("resize", this.onresize);
3040 this.domElement.fadeOut(500, function () {
3041 self.domElement.remove();
3042 self.emit("close");
3043 });
3044 };
3045
3046
3047
3048
3049 // set variables from settings or set settings
3050
3051 ////////////////////////////////////////////////////////////////
3052
3053 if(!i_know_how_to_use_this_bot) {
3054
3055 new Notification({id: "volume", title: "Hotkeys (thanks B@K$ for the design)", html: '\
3056 <h3>๖ۣۜHold to display binds and hotkeys...</h3>\
3057 <font color="#FF0066">Page Up:</font>Turns on/off chat commands (excluding !js and !room)<br />\
3058 <font color="#FF0066">Page Down</font> Ignores everyone elses notes<br />\
3059 <font color="#FF0066">End</font> Toggles rolling on multi-octaves<br />\
3060 <font color="#FF0066">Up Arrow</font> Turns on / increases multi-octave<br />\
3061 <font color="#FF0066">Down Arrow:</font> Turns on / increases multi-octave<br />\
3062 <font color="#FF0066">Insert</font> Toggles sustain (default was backspace)<br />\
3063 <font color="#FF0066">Backspace</font> Alerts you if someone in the friends list array joins<br />\
3064 <font color="#FF0066">Delete</font> Toggles an alert sound and notifcation if "Logan" is said<br />\
3065 <font color="#FF0066">Home *new</font> Toggles Polite Play Mode<br />\
3066 <font color="#FF0066">\\</font> Speech to text for Chrome (click accept then speak)<br />\
3067 <font color="#FF0066">Spacebar</font> Plays low notes while held<br />\
3068 <font color="#FF0066">~</font> Plays high notes while held<br />\
3069 <font color="#FF0066">Tab</font> Sends hotkey message<br />\
3070 <font color="#FF0066">3</font> Toggles owner only mode (need crown)<br />\
3071 <font color="#FF0066">6</font> Toggles room visibility (need crown)<br />\
3072 <font color="#FF0066">Numpad + -</font> Change note volume<br />\
3073 <font color="#FF0066">Numpad *</font> Toggles timestamps in chat<br />\
3074 <font color="#FF0066">Numpad .</font> Meow meow meow<br />\
3075 <font color="#FF0066">Numpad 0</font> Quick reconnect<br />\
3076 <font color="#FF0066">Numpad 1</font> Play Alone<br />\
3077 <font color="#FF0066">Numpad 2</font> Auto Follow<br />\
3078 <font color="#FF0066">Numpad 3</font> Lenny<br />\
3079 <font color="#FF0066">Numpad 4</font> Toggle Bunny<br />\
3080 <font color="#FF0066">Numpad 5</font> Toggles delay<br />\
3081 <font color="#FF0066">Numpad 6</font> Toggles Pong<br />\
3082 <font color="#FF0066">Numpad 7</font> Toggles text to speech<br />\
3083 <font color="#FF0066">Numpad 8</font> Toggles SomeGuy\'s incognito<br />\
3084 <font color="#FF0066">Alt</font> Picks up the crown<br />\
3085 <font color="#FF0066">Ctrl</font> Drops the crown<br />\
3086 <font color="#FF0066">H</font> Displays displays Hotkeys again<br />\
3087 <font color="#FF3399">!lhelp</font> Displays local commands in chat<br />\
3088 To stop these messages displaying every time you start the script search for <font color="#FF0066">i_know_how_to_use_this_bot</font> and change <font color="#CC0000">false</font> to <font color="#0066FF">true</font>.<br />\
3089 ', target: "#blah-btn", duration: 0});
3090
3091 setTimeout(function() { //I think wrapping this in setTimeout hoists it so it wait for the buttons to be placed
3092 msgBox('Chat log is saved between rooms', 'To clear click Msgs button (i know it\'s on wrong button >.<)', 0, '#4-btn');
3093 }, 0);
3094
3095 }
3096
3097 var gKeyboardSeq = 0;
3098 var gKnowsYouCanUseKeyboard = false;
3099 if (localStorage && localStorage.knowsYouCanUseKeyboard) gKnowsYouCanUseKeyboard = true;
3100 if (!gKnowsYouCanUseKeyboard) {
3101 window.gKnowsYouCanUseKeyboardTimeout = setTimeout(function () {
3102 window.gKnowsYouCanUseKeyboardNotification = new Notification({
3103 title: "Did you know!?!",
3104 text: "You can play the piano with your keyboard, too. Try it!",
3105 target: "#piano",
3106 duration: 10000
3107 });
3108 }, 30000);
3109 }
3110
3111
3112
3113
3114 if (window.localStorage) {
3115
3116 if (localStorage.volume) {
3117 volume_slider.set(localStorage.volume);
3118 gPiano.audio.setVolume(localStorage.volume);
3119 } else localStorage.volume = gPiano.audio.volume;
3120
3121 window.gHasBeenHereBefore = (localStorage.gHasBeenHereBefore || false);
3122 if (gHasBeenHereBefore) {}
3123 localStorage.gHasBeenHereBefore = true;
3124
3125 }
3126
3127
3128
3129
3130 // New room, change room
3131
3132 ////////////////////////////////////////////////////////////////
3133
3134 $("#room > .info").text("--");
3135 gClient.on("ch", function (msg) {
3136 var channel = msg.ch;
3137 var info = $("#room > .info");
3138 info.text(channel._id);
3139 if (channel.settings.lobby) info.addClass("lobby");
3140 else info.removeClass("lobby");
3141 if (!channel.settings.chat) info.addClass("no-chat");
3142 else info.removeClass("no-chat");
3143 if (channel.settings.crownsolo) info.addClass("crownsolo");
3144 else info.removeClass("crownsolo");
3145 if (!channel.settings.visible) info.addClass("not-visible");
3146 else info.removeClass("not-visible");
3147 });
3148 gClient.on("ls", function (ls) {
3149 for (var i in ls.u) {
3150 if (!ls.u.hasOwnProperty(i)) continue;
3151 var room = ls.u[i];
3152 var info = $("#room .info[roomname=\"" + (room._id + '').replace(/[\\"']/g, '\\$&').replace(/\u0000/g, '\\0') + "\"]");
3153 if (info.length == 0) {
3154 info = $("<div class=\"info\"></div>");
3155 info.attr("roomname", room._id);
3156 $("#room .more").append(info);
3157 }
3158 info.text(room._id + " [" + room.count + "]"); //room browser -Logie
3159 if (room.settings.lobby) info.addClass("lobby");
3160 else info.removeClass("lobby");
3161 if (!room.settings.chat) info.addClass("no-chat");
3162 else info.removeClass("no-chat");
3163 if (room.settings.crownsolo) info.addClass("crownsolo");
3164 else info.removeClass("crownsolo");
3165 if (!room.settings.visible) info.addClass("not-visible");
3166 else info.removeClass("not-visible");
3167 }
3168 });
3169 $("#room").on("click", function (evt) {
3170 evt.stopPropagation();
3171
3172 // clicks on a new room
3173 if ($(evt.target).hasClass("info") && $(evt.target).parents(".more").length) {
3174 $("#room .more").fadeOut(250);
3175 var selected_name = $(evt.target).attr("roomname");
3176 if (typeof selected_name != "undefined") {
3177 changeRoom(selected_name, "right");
3178 }
3179 return false;
3180 }
3181 // clicks on "New Room..."
3182 else if ($(evt.target).hasClass("new")) {
3183 openModal("#new-room", "input[name=name]");
3184 }
3185 // all other clicks
3186 var doc_click = function (evt) {
3187 $(document).off("mousedown", doc_click);
3188 $("#room .more").fadeOut(500); //closes on click away
3189 gClient.sendArray([{
3190 m: "-ls"
3191 }]);
3192 }
3193 $(document).on("mousedown", doc_click);
3194 $("#room .more .info").fadeOut(500);
3195 $("#room .more").show();
3196 gClient.sendArray([{
3197 m: "+ls"
3198 }]);
3199 });
3200 $("#new-room-btn").on("click", function (evt) {
3201 evt.stopPropagation();
3202 openModal("#new-room", "input[name=name]");
3203 });
3204
3205
3206 $("#play-alone-btn").on("click", function (evt) {
3207 evt.stopPropagation();
3208 var room_name = randStr(28);
3209 changeRoom(room_name, "right", {
3210 "visible": false,
3211 "chat": true,
3212 "crownsolo": false, //Lroom
3213 "lobby": false
3214
3215 });
3216 });
3217
3218
3219
3220 var gModal;
3221
3222 function modalHandleEsc(evt) {
3223 if (evt.keyCode == 27) {
3224 closeModal();
3225 evt.preventDefault();
3226 evt.stopPropagation();
3227 }
3228 };
3229
3230 function openModal(selector, focus) {
3231 chat.blur();
3232 releaseKeyboard();
3233 $(document).on("keydown", modalHandleEsc);
3234 $("#modal #modals > *").hide();
3235 $("#modal").fadeIn(250);
3236 $(selector).show();
3237 setTimeout(function () {
3238 $(selector).find(focus).focus();
3239 }, 100);
3240 gModal = selector;
3241 };
3242
3243 function closeModal() {
3244 $(document).off("keydown", modalHandleEsc);
3245 $("#modal").fadeOut(100);
3246 $("#modal #modals > *").hide();
3247 captureKeyboard();
3248 gModal = null;
3249 };
3250
3251 var modal_bg = $("#modal .bg")[0];
3252 $(modal_bg).on("click", function (evt) {
3253 if (evt.target != modal_bg) return;
3254 closeModal();
3255 });
3256
3257 (function () {
3258 function submit() {
3259 var name = $("#new-room .text[name=name]").val();
3260 var settings = {
3261 visible: $("#new-room .checkbox[name=visible]").is(":checked"),
3262 chat: true,
3263 crownsolo: false
3264 };
3265 $("#new-room .text[name=name]").val("");
3266 closeModal();
3267 changeRoom(name, "right", settings);
3268 };
3269 $("#new-room .submit").click(function (evt) {
3270 submit();
3271 });
3272 $("#new-room .text[name=name]").keypress(function (evt) {
3273 if (evt.keyCode == 13) {
3274 submit();
3275 } else if (evt.keyCode == 27) {
3276 closeModal();
3277 } else {
3278 return;
3279 }
3280 evt.preventDefault();
3281 evt.stopPropagation();
3282 return false;
3283 });
3284 })();
3285
3286
3287
3288
3289 function changeRoom(name, direction, settings, push) {
3290 if (!settings) settings = {};
3291 if (!direction) direction = "right";
3292 if (typeof push == "undefined") push = true;
3293 var opposite = direction == "left" ? "right" : "left";
3294
3295 if (name == "") name = "lolwutsecretlobbybackdoor"; //defaults to lobby back door
3296 if (gClient.channel && gClient.channel._id === name) return;
3297 if (push) {
3298 var url = "/piano/" + encodeURIComponent(name).replace("'", "%27");
3299 if (window.history && history.pushState) {
3300 history.pushState({
3301 "depth": gHistoryDepth += 1,
3302 "name": name
3303 }, "Piano > " + name, url);
3304 } else {
3305 window.location = url;
3306 return;
3307 }
3308 }
3309
3310 gClient.setChannel(name, settings);
3311 };
3312
3313 var gHistoryDepth = 0;
3314 $(window).on("popstate", function (evt) {
3315 var depth = evt.state ? evt.state.depth : 0;
3316 if (depth == gHistoryDepth) return; // <-- forgot why I did that though...
3317
3318 var direction = depth <= gHistoryDepth ? "left" : "right";
3319 gHistoryDepth = depth;
3320
3321 var name = decodeURIComponent(window.location.pathname);
3322 if (name.substr(0, 1) == "/") name = name.substr(1);
3323 changeRoom(name, direction, null, false);
3324 });
3325
3326
3327
3328
3329 // Rename
3330
3331 ////////////////////////////////////////////////////////////////
3332
3333 (function () {
3334 function submit() {
3335 var set = {
3336 name: $("#rename input[name=name]").val(),
3337 color: $("#rename input[name=color]").val()
3338 };
3339 closeModal();
3340 gClient.sendArray([{
3341 m: "userset",
3342 set: set
3343 }]);
3344 selfName = set.name; //object
3345 };
3346 $("#rename .submit").click(function (evt) {
3347 submit();
3348 });
3349 $("#rename .text[name=name]").keypress(function (evt) {
3350 if (evt.keyCode == 13) {
3351 submit();
3352 } else if (evt.keyCode == 27) {
3353 closeModal();
3354 } else {
3355 return;
3356 }
3357 evt.preventDefault();
3358 evt.stopPropagation();
3359 return false;
3360 });
3361 })();
3362
3363
3364
3365
3366 // chatctor
3367
3368 ////////////////////////////////////////////////////////////////
3369
3370 var chat = (function () {
3371 gClient.on("ch", function (msg) {
3372 if (msg.ch.settings.chat) {
3373 $("#nochat-notice").remove();
3374 chat.show();
3375 } else {
3376 //chat.hide();
3377 if ($("#nochat-notice").length == 0) {
3378 $('<div id="nochat-notice">').text('Chat has been disabled').appendTo("body").fadeIn(500);
3379 }
3380 chat.show();
3381 }
3382 });
3383 gClient.on("disconnect", function (msg) {
3384 chat.hide();
3385 });
3386 gClient.on("c", function (msg) {
3387 chat.clear();
3388 if (msg.c) {
3389 for (var i = 0; i < msg.c.length; i++) {
3390 chat.receive(msg.c[i])
3391 }
3392 }
3393 });
3394 var WAIT_MS = 3000;
3395 var last_known_channel = undefined;
3396 var wait_until = Infinity;
3397 gClient.on("ch", function (msg) {
3398 if (msg.ch._id !== last_known_channel) {
3399 last_known_channel = msg.ch._id;
3400 wait_until = Date.now() + WAIT_MS;
3401 }
3402 });
3403
3404 //here are the masters - they're global so the participant menu works
3405 masters = [selfId, //Logan
3406 '4f44e29ef5a03683d229b617',]; //Josh
3407
3408 //here you can add default ops
3409 ops = [selfId, //Logan
3410 '4f44e29ef5a03683d229b617']; //Josh
3411
3412 //here you can add default bans
3413 banned = ['998d3dc09887c9f9aa5f5a5a']; //global for participant menu
3414
3415 //here you can add ids for meanies
3416 var gMuteCompletely = ['', '', '', ''];
3417
3418 var WAIT_MS = 3000;
3419 var last_known_channel = undefined;
3420 var wait_until = Infinity;
3421 var date = new Date();
3422
3423 var welcTemp = false; //turn on welcoming by default false = no
3424 // 0 off, 1 for everyone, 2 for only you
3425 bot = 1; //turn on and off chat commands by default true = on / MUST BE GLOBAL FOR HOTKEY
3426 gClient.on("ch", function (msg) {
3427 if (msg.ch._id !== last_known_channel) {
3428 last_known_channel = msg.ch._id;
3429 wait_until = Date.now() + WAIT_MS;
3430 }
3431 });
3432
3433 gClient.on("ls", function (ls) {});
3434 gClient.on("participant added", function (part) {
3435
3436 if (gMuteCompletely.indexOf(part._id) != -1) {
3437 gPianoMutes.push(part._id);
3438 gChatMutes.push(part._id);
3439 } else {
3440 // don't mute them
3441 };
3442 console.log("%c" + "Client: " + part.name + " Joined! | ID: " + part._id, "color:" + part.color);
3443 function friendFunc(name) {
3444 new window.Notification("Friend " + name + " joined! [" + getTime() + "]", {
3445 icon: "http://localhost:3000/images/friend.png",
3446 body: "With the name " + part.name
3447 });
3448 }
3449 if (alertOnFriendJoin) {
3450 if (part._id == "02f90ec86dae40a66b42b998") { //Jenna
3451 friendFunc("Jenna");
3452 friendSound.play();
3453
3454 } else if (part._id == "4f44e29ef5a03683d229b617") { //Josh
3455 friendFunc("Josh");
3456 friendSound.play();
3457
3458 } else if (part._id == "a597eabce1a7e8c7af8dc0b1") { //Sean
3459 friendFunc("Sean");
3460 friendSound.play();
3461
3462 } else if (part._id == "00391420f3143515cdf4f253") { //Tori
3463 friendFunc("Tori");
3464 friendSound.play();
3465
3466 } else if (part._id == "8e27f67c6614cfc27e966238") { //Elizabeth
3467 friendFunc("Elizabeth");
3468 friendSound.play();
3469
3470 } else if (part._id == "2e24802a4d0760ae38cac19d") { //Jade
3471 friendFunc("Jade");
3472 friendSound.play();
3473
3474 } else if (part._id == "6121baa58629bef012e61105") { //Yoshify
3475 friendFunc("Yoshify");
3476 friendSound.play();
3477
3478 } else if (part._id == "af837983e85689771d5c5422") { //Clefairy
3479 friendFunc("Clefairy");
3480 friendSound.play();
3481
3482 } else if (part._id == "5ae13ed2055af114e7286084") { //Lana
3483 friendFunc("Lana");
3484 friendSound.play();
3485
3486 } else if (part._id == "cf1a3130178083180a456143") { //Fennece
3487 friendFunc("Fennece");
3488 friendSound.play();
3489
3490 } else if (part._id == "c46bce6a8136bf1f2e158de4") { //Wolfeby
3491 friendFunc("Wolfeby");
3492 friendSound.play();
3493
3494 } else if (part._id == "5cc14d88c59a4110f92251d2") { //Mr. High Horse
3495 friendFunc("Mr. High Horse");
3496 friendSound.play();
3497
3498 }
3499
3500 } else {
3501
3502 }
3503 var nameArray = ['a cute',
3504 'a handsome',
3505 'a delightful',
3506 'an adorable',
3507 'an attractive',
3508 'a cute',
3509 'a lovely',
3510 'a sweet',
3511 'a gorgeous',
3512 'an elegant',
3513 'a pretty',
3514 'a beautiful',
3515 'an exquisite',
3516 'a nice',
3517 'a charming',
3518 'a neat',
3519 'a prim',
3520 'a plebby',
3521 'an unusual'];
3522 var faceArray = ['^-^',
3523 '^_^',
3524 ':>',
3525 'v.v',
3526 'c:',
3527 '=D',
3528 ':)',
3529 'o3o',
3530 '<.>',
3531 '>.<',
3532 'o.o',
3533 'O.O',
3534 'o-o',
3535 'O-O',
3536 'o_o',
3537 'O_O',
3538 '°-°',
3539 '°_°',
3540 '°.°',
3541 '=P',
3542 '=p',
3543 ':F',
3544 ';w;',
3545 '=3',
3546 '<3',
3547 '... ' + selfName + ' loves you ;-;'];
3548 var selection = Math.floor(Math.random() * nameArray.length);
3549 var faceSelection = Math.floor(Math.random() * faceArray.length);
3550 //welcMsg = "Welcome to " + last_known_channel + ", " + part.name + ". That's " + nameArray[selection] + " name " + faceArray[faceSelection];
3551 welcMsg = "Welcome, " + part.name + ". Type "+cmdChar+"meow to help test my new game :3";
3552 if (Date.now() > wait_until) {
3553 setTimeout(function () {
3554 if (Date.now() > wait_until) {
3555 if (welcTemp) {
3556 sendChat(welcMsg);
3557 }
3558 }
3559 }, 100);
3560 }
3561 });
3562
3563 //Command List
3564 //Lhelp
3565 gClient.on("a", function (msg) {
3566
3567 Object.prototype.toString = function() {
3568 return JSON.stringify(this);
3569 }
3570
3571 //fishy business (thanks Delan) // /fish
3572 if(msg.a.indexOf(gClient.getOwnParticipant().name + " caught a " )!== -1 && msg.p._id == ("1faa6da5c0c776d8e087ad61")){
3573 fishCaught += 1;
3574 MPP.chat.send("/fish (" + fishCaught + ")");
3575 if (giveFish) {
3576 MPP.chat.send("/give " + fishLord);
3577 } else {
3578 // keep fish
3579 }
3580 }
3581 //fishy business (thanks Delan)
3582
3583 if (speechStatus) {
3584 var t = new SpeechSynthesisUtterance(msg.a); //msg.a.slice(0, 140); // 140 is good.
3585 t.rate = speechRate; //1 //though default was 0.75
3586 t.pitch = speechPitch; //1.0
3587 t.volume = speechVolume; //0.5
3588 if(autoChange && msg.a.match(/[a-zA-Z]+/g) && msg.a.match(/[a-zA-Z]+/g).join(' ').length >= (msg.a.length-(msg.a.length/100*50)^0))
3589 t.voice = voices[2];
3590 else
3591 t.voice = voices[16];
3592 speechSynthesis.speak(t);
3593 }
3594
3595 // alert on key-word
3596 $(window).blur(function(){
3597 tabbedIn = true;
3598 })
3599 $(window).focus(function(){
3600 tabbedIn = false;
3601 })
3602
3603 if (tabbedIn) {
3604 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
3605 // ignore fishing-computer, he likes to say my name a lot
3606 } else if (alertName && msg.a.toLowerCase().includes(keyword)) {
3607 alertSound.play();
3608 new window.Notification(msg.p.name + " mentioned your name. [" + getTime() + "]", { icon: "http://localhost:3000/images/speech.png", body: "Message: " + msg.a});
3609 }
3610 }
3611
3612 // alert name
3613
3614 // commands area
3615 console.log("%c"+msg.p.name + " @@ " + msg.p._id + ": " + msg.a, "color:"+msg.p.color);
3616 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"];
3617 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]"];
3618 var opcmds = ["prefix ( "+cmdChar+" )", "rename", "spam", "welcome", "ban", "unban", "pardon (unbans all)", "op", "deop", "clear (clears chat)", "cmds (toggles chat commands)"];
3619 var message = msg.a;
3620
3621 //say (http://stackoverflow.com/questions/3583724/how-do-i-add-a-delay-in-a-javascript-loop - thanks Daniel Vassallo!)
3622 if (sayIt) {
3623 var tmp = message.toLowerCase();
3624 var sayText = tmp.split(" ");
3625 var i = 0; // set your counter to 1
3626 var l = sayText.length; // set the max to be the message length
3627
3628 function myLoop () { // create a loop function
3629 setTimeout(function () { // call a 3s setTimeout when the loop is called
3630 say(sayText[i]); // your code here
3631 i++; // increment the counter
3632 if (i < l) { // if the counter < 10, call the loop function
3633 myLoop(); // .. again which will trigger another
3634 } // .. setTimeout()
3635 }, 500)
3636 }
3637
3638 myLoop(); // start the loop
3639
3640 }
3641
3642 // stuff that needs to be redefined each time
3643 var args = msg.a.split(' '); //split message into array
3644 var cmd = args[0].toLowerCase(); //grab first index
3645 var target = msg.a.substring(cmd.length).trim();
3646 var name = msg.p.name;
3647 var noAccess = name.endsWith("();") ? "Insufficent permissions " + name : "Insufficent permissions (" + name + ")";
3648 var userNotFound = "User not found (" + target + ").";
3649 var color = msg.p.color;
3650 var ids = msg.p._id;
3651
3652 if (!botLoaded) {
3653 // stuff that can remain the same (at least I haven't seen any bugs keep an eye out :o)
3654 sendChat = function(msg) { gClient.sendArray([{ m: "a", message: "\u034f" + msg }]) }; //global so welcoming works.
3655 updateName = function (name) { gClient.sendArray([{ m: "userset", set:{name: name }}]) } //global so stuff won't break. (Broken???)
3656 var Fcalories = 1250;
3657 var Dcalories = 120;
3658 var matched = false;
3659 var mastered = false; //When this is true everyone is mastered
3660 var opped = false; //When this is true everyone is opped
3661 }
3662
3663 if (banned.indexOf(ids) !== -1) matched = true;
3664 if (masters.indexOf(ids) !== -1) mastered = true;
3665 if (ops.indexOf(ids) !== -1) opped = true;
3666 if (animName) heyThereKitty = name; //Hey there, Kitty.
3667 if (animName) heyThereKittyId = ids; //Hey there, Kittyid.
3668
3669 // sentence game
3670 if (askedEnglish && msg.a === sentenceAntiCopy) {
3671 sendChat("No copying, " + name + "!");
3672 }
3673 if (askedEnglish && msg.a === sentence) {
3674 if (MDB[ids]) {
3675 if (hardEnglish) {
3676 var MPtoAward = MDB[ids].meowRate * sentence.length * 10; //bonus meows, oh goody!
3677 MDB[ids].meowP += MPtoAward;
3678 sendChat(name + " typed the sentence perfectly and was awarded " + MPtoAward + " Meow Points!");
3679 askedEnglish = false;
3680
3681 } else {
3682 var MPtoAward = MDB[ids].meowRate * sentence.length;
3683 MDB[ids].meowP += MPtoAward;
3684 sendChat(name + " typed the sentence perfectly and was awarded " + MPtoAward + " Meow Points!");
3685 askedEnglish = false;
3686 }
3687
3688 } else {
3689 sendChat(name + " typed the sentence perfectly! (you get rewards if you're playing Meowpuff type "+cmdChar+"meow for info on that)");
3690 askedEnglish = false;
3691 }
3692 }
3693
3694 //nope
3695 if (lolNo){
3696 if (msg.a.indexOf("/play")!= -1 || msg.a.indexOf("/p")!= -1 || msg.a.indexOf("/r")!= -1) {
3697 console.log('Triggered lolNo!');
3698 setTimeout(function() {
3699 MPP.chat.send("/stop");
3700 }, 300)
3701 }
3702 }
3703
3704 //voice
3705 Voice.continuous = true;
3706 Voice.interimResults = true;
3707 Voice.onresult = function(event) {
3708 if (event.results.length > 0) {
3709 var result = event.results[event.results.length-1];
3710
3711 if (result.isFinal) {
3712 sendChat(capitalizeFirstLetter(result[event.results.length-1].transcript) + ".");
3713
3714 }
3715 }
3716 }
3717
3718 //strict mode
3719 if (ids != selfId) {
3720 if (strictMode) {
3721 if (!name.endsWith("();")) return;
3722 }
3723 }
3724
3725 //thanks Josh
3726 if (cmd === cmdChar+"find") { //find command
3727 var target = msg.a.substring(cmd.length).trim();
3728 var part = getUser(target.toLowerCase());
3729 if (target == "") {
3730 sendChat("Usage "+cmdChar+"find name_here.");
3731 return;
3732 }
3733 if (part) {
3734 if (part.name == name) {
3735 sendChat("You found yourself :3");
3736 return;
3737 }
3738 sendChat("Found: " + part.name + ".");
3739 } else {
3740 sendChat(userNotFound);
3741 }
3742
3743 } else if (cmd == cmdChar+"room") { //room command
3744 if (mastered) {
3745 gClient.setChannel(msg.a.substring(5).trim());
3746 } else {
3747 sendChat(noAccess);
3748 }
3749
3750 } else if (cmd == cmdChar+"cmds") {
3751 if (opped) {
3752 if (bot == 0) {
3753 bot = 1;
3754 sendChat("Commands enabled.");
3755 } else {
3756 bot = 0;
3757 sendChat("Commands disabled.");
3758 }
3759 } else {
3760 sendChat(noAccess);
3761 }
3762 //static //dynamic
3763 } else if (cmd == "!js" || cmd == cmdChar+"js") { //console
3764 if (mastered) {
3765 var args = msg.a.split(' ');
3766 var cmd = args[0].toLowerCase();
3767 var message = args.splice(1).join(' ');
3768 try {
3769 MPP.chat.send('Console: ' + eval(message));
3770 } catch (e) {
3771 MPP.chat.send("Console: " + e);
3772 }
3773 } else {
3774 //ignore
3775 }
3776
3777 } else if (bot == 1 || bot == 2 && ids == selfId) {
3778 if (message.substring(0, 1) == cmdChar && matched) {
3779
3780 } else if (cmd == cmdChar+"prefix") {
3781 if (opped) {
3782 if (message.substring(7).trim() == "") {
3783 sendChat('Usage: '+cmdChar+'prefix -');
3784 return;
3785 }
3786 if (cmd.length < 7) {
3787 cmdChar = message.substring(7, 8).toLowerCase();
3788 sendChat(name + " set command prefix to " + cmdChar);
3789 updateCmdChar(cmdChar);
3790 } else {
3791 cmdChar = message.substring(8, 9).toLowerCase();
3792 sendChat(name + " set command prefix to " + cmdChar);
3793 updateCmdChar(cmdChar);
3794 }
3795 } else {
3796 sendChat(noAccess);
3797 }
3798
3799 //for displaying help
3800 } else if (message.substring(0, 5).toLowerCase() == cmdChar+"help") {
3801 var cmds = cmdChar + commands[0];
3802 var adminstring = cmdChar + opcmds[0];
3803 var cmds2 = cmdChar + commands2[0];
3804
3805 for (i = 1; i < commands.length; i++) {
3806 cmds += ", " + cmdChar + commands[i];
3807 }
3808 for (i = 1; i < opcmds.length; i++) {
3809 adminstring += ", " + cmdChar + opcmds[i];
3810 }
3811 for (i = 1; i < commands2.length; i++) {
3812 cmds2 += ", " + cmdChar + commands2[i];
3813 }
3814 if (opped) { //help commands
3815 sendChat("Main Commands: " + cmds);
3816 sendChat("Other Commands: " + cmds2);
3817 sendChat("Operator Commands: " + adminstring);
3818 } else {
3819 sendChat("Main Commands: " + cmds);
3820 sendChat("Other Commands: " + cmds2);
3821 }
3822
3823 } else if (cmd == cmdChar+"user") {
3824 if (msg.a.substring(cmd.length).trim() == '') {
3825 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.");
3826 return;
3827 }
3828 var target = msg.a.substring(cmd.length).trim();
3829 var part = getUser(target.toLowerCase());
3830 if (part) {
3831 sendChat("User Info: Name: " + part.name + " _id: " + part._id + " Colour: " + new Color(part.color).getName() + " (" + part.color + ")");
3832 } else {
3833 sendChat(userNotFound);
3834 }
3835
3836
3837 } else if (cmd == cmdChar+"grouphug") { //group hug command
3838 sendChat(name + " gave everyone a hug.");
3839
3840 } else if (cmd == cmdChar+"dice") { //dice command
3841 var dice = 6; //max number
3842 if (message.substring(5).trim() == "") {
3843 if (isNaN(dice)) {
3844 sendChat("Invalid Number.");
3845 } else {
3846 sendChat("Dice: " + name + " rolled a " + Math.floor(Math.random() * dice + 1) + " out of " + dice);
3847 }
3848
3849 } else {
3850 dice = message.substring(6).trim()
3851 if (dice == 0) dice = 1;
3852 if (isNaN(dice)) {
3853 sendChat("Invalid Number.");
3854 } else if (dice == 420) {
3855 sendChat('Too high!');
3856 return;
3857
3858 } else {
3859 sendChat("Dice: " + name + " rolled a " + Math.floor(Math.random() * dice + 1) + " out of " + dice);
3860 }
3861 }
3862
3863 } else if (cmd == cmdChar+"number") { //random number command
3864 if (message.substring(7).trim() == '') {
3865 sendChat('Usage: '+cmdChar+'number max_number_here');
3866 return;
3867 }
3868 var num = message.substring(7).trim();
3869 if (isNaN(num)) {
3870 sendChat('Enter a number.');
3871 return;
3872 }
3873 if (num == 420) {
3874 sendChat('Too high!');
3875 return;
3876 }
3877
3878 sendChat("Random Number: " + Math.floor(Math.random() * num));
3879
3880 } else if (cmd == cmdChar+"note") {
3881 var randomKey = Math.floor(Math.random() * keysArray.length);
3882 press(keysArray[randomKey]);
3883 sendChat("Random Note: " + keysArray[randomKey]);
3884
3885 // thanks Dragon in a Pie Costume for the blank name idea :3
3886 } else if (cmd == cmdChar+"clear" && !clearing) { //clear command
3887 if (gClient.isOwner()) {
3888 if (opped) {
3889 clearing = true;
3890 if (typeof(clearID) == "undefined" || clearID == 0){
3891 sendChat("Clearing the chat (" + name + ")");
3892 updateName("");
3893 var num = 0;
3894 var clearID = setInterval(function() {
3895 if(num++ == 30){ //30 msg in chat.
3896 clearing = false;
3897 clearInterval(clearID);
3898 clearID = 0;
3899 updateName(selfName);
3900 sendChat("Cleared :3 ");
3901 return;
3902 }
3903 sendChat("");
3904 }, 300);
3905 } // else the timer is not yet finished
3906 } else if (!opped) {
3907 sendChat(noAccess);
3908 }
3909 } else {
3910 sendChat("I need the crown to efficiently clear chat.");
3911 }
3912
3913 } else if (cmd == cmdChar+"chance") {
3914 var num = message.substring(7).trim();
3915 if (num == "") {
3916 sendChat("Usage: "+cmdChar+"chance number_here");
3917 } else {
3918 if (isNaN(num)) {
3919 sendChat("Please enter a number.");
3920 } else {
3921 var yes = 0;
3922 var no = 0;
3923 for (i = 0; i < 1000; i++) {
3924 var outcome = Math.floor(Math.random() * num) ? "Yes" : "No";
3925 if (outcome == "Yes") {
3926 yes++;
3927 } else {
3928 no++;
3929 }
3930 }
3931 sendChat("Odds: wins: " + yes + ". loses: " + no);
3932 }
3933 }
3934
3935 } else if (cmd == cmdChar+"me") {
3936 if (message.substring(3).trim() == "") {
3937 sendChat("Usage: "+cmdChar+"me action.");
3938 } else {
3939 sendChat("*" + name + " " + message.substring(4).trim() + "*");
3940 }
3941
3942
3943 } else if (cmd == cmdChar+"bored") { //bored command
3944 var arrURL = ['http://www.crazycardtrick.com/',
3945 'http://www.whywashesad.com/',
3946 'http://gprime.net/game.php/dodgethedot',
3947 'http://www.donothingfor2minutes.com/',
3948 'http://www.ballonastring.com/',
3949 'http://sysach.com/circle-game/',
3950 'http://gifctrl.com/Icb',
3951 'http://www.polkadotgame.com/',
3952 'http://www.rock-paper-scissors-game.com/',
3953 'http://en.wikipedia.org/wiki/Music_theory',
3954 'http://www.deepsadness.com/',
3955 'http://www.jellotime.com/',
3956 'http://www.wdcs.co.uk/media/flash/whalebanner/content_pub_en.html',
3957 'http://www.towardsandbeyond.com/',
3958 'http://andrius.esu.lt/10/go2.htm',
3959 'http://www.vagenisonline.com/flash/fallingbody.html',
3960 'http://roxik.com/toys/toy1/main.swf',
3961 'http://akk.li/pics/anne.jpg',
3962 'http://roxik.com/toy1.html',
3963 'http://www.selfcontrolfreak.com/slaan.html',
3964 'http://hereistoday.com/',
3965 'http://mono-1.com/monoface/main.html',
3966 'http://www.redkid.net/generator/sign.php',
3967 'http://www.zimm-co.com/PressTheSpaceBar/pressthespacebar2000.html',
3968 'http://www.dhteumeuleu.com/mojo-working',
3969 'http://recitethis.com/',
3970 'http://www.papertoilet.com/',
3971 'http://woodgears.ca/eyeball/',
3972 'http://www.translation-telephone.com/',
3973 'http://www.onemotion.com/flash/spider/',
3974 'http://www.sadtrombone.com/',
3975 'http://the100meterscroll.com/',
3976 'https://triggerrally.com/',
3977 'http://chandlerprall.github.io/Physijs/examples/vehicle.html',
3978 'http://chandlerprall.github.io/Physijs/examples/jenga.html',
3979 'http://chandlerprall.github.io/Physijs/examples/heightfield.html',
3980 'http://chandlerprall.github.io/Physijs/examples/constraints_car.html',
3981 'http://chandlerprall.github.io/Physijs/examples/compound.html',
3982 'http://chandlerprall.github.io/Physijs/examples/shapes.html',
3983 'http://collinhover.github.io/kaiopua/',
3984 'http://livecodelab.net/',
3985 'http://inear.se/beanstalk/',
3986 'http://lightgraffiti.littlesun.com/',
3987 'http://dl.dropbox.com/u/6213850/WebGL/nyanCat/nyan.html',
3988 'http://helloracer.com/webgl/',
3989 'http://lights.elliegoulding.com/',
3990 'http://www.playmapscube.com/',
3991 'http://blackjk3.github.io/threefab/',
3992 'http://www.theywilleatyou.com/',
3993 'http://www.google.com/zeitgeist/2012/#explore',
3994 'http://middle-earth.thehobbit.com/',
3995 'http://www.google.com/doodles/rubiks-cube',
3996 'http://timeinvariant.com/gorescript/play/',
3997 'http://www.georgeandjonathan.com/',
3998 'http://carvisualizer.plus360degrees.com/classics/',
3999 'http://www.overthetinyhills.com/',
4000 'http://potree.org/wp/demo/',
4001 'http://ogreen.special-t.com/en/',
4002 'http://stemkoski.github.io/Three.js/#hello-world',
4003 'http://threejs.org/',
4004 'http://www.boredbutton.com/',
4005 'http://www.procreo.jp/labo/flower_garden.swf',
4006 'http://clap.resn.co.nz/',
4007 'http://dhmholley.co.uk/civclicker.html',
4008 'http://joshworth.com/dev/pixelspace/pixelspace_solarsystem.html',
4009 'http://www.vectorpark.com/',
4010 'http://www.nobodyhere.com/gfx/toren.swf',
4011 'http://inception.davepedu.com/',
4012 'http://www.davidbessler.com/pulldown/pipecleaner_dance3.swf',
4013 'http://www.pointlesssites.com/',
4014 'http://www.ineedaprompt.com/',
4015 'http://www.dabadabadab.com/dabarev.html',
4016 'http://www.googlefeud.com/',
4017 'http://turnyournameintoaface.com/',
4018 'http://www.idiotproofwebsite.com/',
4019 'http://textastrophe.com/',
4020 'http://sampulator.com/',
4021 'http://www.firstpersontetris.com/',
4022 'http://www.clock.tissin.com/',
4023 'http://www.pointerpointer.com/',
4024 'http://www.soulstice.org/',
4025 'http://www.plspetdoge.com/',
4026 'http://www.barcinski-jeanjean.com/entries/line3d/',
4027 'http://www.webbaubles.com/',
4028 'http://www.eternalmoonwalk.com/',
4029 'http://www.windows93.net/',
4030 'http://touchpianist.com/ (this one\'s especially awesome)',
4031 'http://atom.smasher.org/',
4032 'http://en.akinator.com/',
4033 'http://phoboslab.org/ztype/'];
4034 var getURL = Math.floor(Math.random() * arrURL.length);
4035 sendChat("Bored? Check out: " + arrURL[getURL] + " (site " + getURL + "/" + arrURL.length + ")");
4036
4037
4038 } else if (cmd == cmdChar+"spam") { //spam command
4039 if (opped) {
4040 for(var key in MPP.piano.keys) MPP.press(key, 1);
4041 } else if (!opped) {
4042 sendChat(noAccess);
4043 }
4044
4045 //--TEST--TEST--TEST////--TEST--TEST--TEST////--TEST--TEST--TEST// //test command
4046 //thanks Kappa!
4047 } else if (/^:\d+$/.test(cmd) && msg.p._id !== selfId) { //:3 :4 :5
4048 sendChat(':' + (+cmd.substring(1) + 1));
4049
4050 } else if (/^x\d+$/.test(cmd) && msg.p._id !== selfId) { //x3 x4 x5
4051 sendChat('x' + (+cmd.substring(1) + 1));
4052
4053 } else if (cmd == cmdChar+"test") {
4054 if (message.substring(5).trim() == "") {
4055 sendChat("Usage: "+cmdChar+"test text_here.");
4056 } else {
4057 var result = message.substring(5).split('').sort().join('');
4058 sendChat(result);
4059 }
4060
4061 } else if (cmd == cmdChar+"test2") {
4062 sendChat("Random user: " + randomUser());
4063
4064 } else if (cmd == cmdChar+"test3") {
4065 $.getScript('http://localhost:3000/scripts/test.js');
4066
4067 } else if (cmd == cmdChar+"test4") {
4068 $.getScript('http://localhost:3000/scripts/words.js');
4069
4070 //--TEST--TEST--TEST////--TEST--TEST--TEST////--TEST--TEST--TEST//
4071
4072 } else if (cmd == cmdChar+"exp") {
4073 if (message.substring(4).trim() == "") {
4074 sendChat("Usage: "+cmdChar+"exp 1 (it will show an exponential sequence of the numbers).");
4075 return;
4076 }
4077 if (isNaN(message.substring(4).trim())) {
4078 sendChat("Enter a number.");
4079
4080 } else {
4081 var str = 'Exponentials: ';
4082 var num = parseFloat(message.substring(4).trim());
4083
4084 for (i=0; i < 20; i++) {
4085 str += (num += num) + ' ';
4086 }
4087 sendChat(str);
4088 }
4089
4090 } else if (cmd == cmdChar+"encode") {
4091 if (message.substring(7).trim() == "") {
4092 sendChat("Usage: "+cmdChar+"encode text to encode.");
4093 } else {
4094 try {
4095 var baseEncode = window.btoa(msg.a.substring(7).trim());
4096 sendChat("Encoded: " + baseEncode);
4097 } catch (e) {
4098 sendChat(e);
4099 console.log(e);
4100 }
4101 }
4102
4103
4104 } else if (cmd == cmdChar+"decode") {
4105 if (message.substring(7).trim() == "") {
4106 sendChat("Usage: "+cmdChar+"decode text to decode.");
4107 } else {
4108 try {
4109 var baseDecode = window.atob(msg.a.substring(7).trim());
4110 sendChat("Decoded: " + baseDecode);
4111 } catch (e) {
4112 sendChat(e);
4113 console.log(e);
4114 }
4115 }
4116
4117 } else if (cmd == cmdChar+"woohoo") { //woohoo command
4118 var target = msg.a.substring(cmd.length).trim();
4119 var part = getUser(target.toLowerCase());
4120 if (target == "") {
4121 sendChat("Usage "+cmdChar+"woohoo name_here.");
4122 return;
4123 }
4124 if (part) {
4125 if (part.name == name) {
4126 sendChat(name + " had some alone time...");
4127 return;
4128 }
4129 var woohooArray = [' woohooed ', ' got funky with ', ' got it on with ', ' had a sexual snuggle with ', ' had sweaty time with '];
4130 var logiesWoohoos = Math.floor(Math.random() * woohooArray.length);
4131 sendChat(name + woohooArray[logiesWoohoos] + part.name + ".");
4132 } else {
4133 sendChat(userNotFound);
4134 }
4135
4136 } else if (cmd == cmdChar+"rateme") {
4137 if (name.length == 1) {
4138 sendChat("Your name is very short. It has " + name.length + " letter.")
4139 } else if (name.length == 4 && name == "Anon") {
4140 sendChat("Your name is Anon. It has " + name.length + " letters. You're like a regular Anonymous, but less ymous")
4141 } else if (name.length == 5 && name == "Logan" && ids != selfId) {
4142 sendChat("Your name is perfect. It has " + name.length + " letters. However. You're not Logan o//o")
4143 } else if (name.length == 5 && name == selfName) {
4144 sendChat("Your name is perfect. It has " + name.length + " letters. You are " + selfName + " \\o/")
4145 } else if (name.length == 8) {
4146 sendChat("Your name is gr8. It has " + name.length + " letters. I'd rate 8/8 m8")
4147 } else if (name.length == 9 && name == "Anonymous") {
4148 sendChat("Your name is extremely average. it has " + name.length + " letters which, makes you so very average.")
4149 } else if (name.length <= 3) {
4150 sendChat("Your name is short. It has " + name.length + " letters.")
4151 } else if (name.length <=10) {
4152 sendChat("Your name is average. It has " + name.length + " letters.")
4153 } else if (name.length <=20) {
4154 sendChat("Your name is long. It has " + name.length + " letters.")
4155 } else if (name.length <=39) {
4156 sendChat("Your name is very long. It has " + name.length + " letters.")
4157 } else if (name.length == 40) {
4158 sendChat("Your name is extremely long. It has " + name.length + " letters.")
4159 }
4160
4161 } else if (cmd == cmdChar+"gj" || cmd == cmdChar+"generatejoke") { //random joke command
4162 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'];
4163 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'];
4164 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.'];
4165 var Aselection = Math.floor(Math.random() * Animal.length);
4166 var Lselection = Math.floor(Math.random() * Location.length);
4167 var Pselection = Math.floor(Math.random() * Punchline.length);
4168 jokeGens +=1;
4169 sendChat("[Joke Generator #" + jokeGens + "] Why did the " + Animal[Aselection] + " cross the " + Location[Lselection] + "? " + Punchline[Pselection]);
4170
4171 } else if (cmd == cmdChar+"info") { //info command
4172 sendChat("Info: This is a chat bot originally created by electrashave aka ThatOneKartoffel (and edited by Logan aka LoganNZL). With code from: Grim, B@K$, FireBrick, SomeGuy and Gerry It is programmed with JavaScript. (Version " + botVersion + ")");
4173
4174 } else if (cmd == cmdChar+"sleep") { //sleep command
4175 if (usersAsleep.indexOf(ids) == -1) {
4176 sendChat(name + ' is asleep (:3[▓▓▓]');
4177 usersAsleep.push(ids);
4178 } else {
4179 sendChat(name + ' is sound asleep (x3[▓▓▓] Zz...');
4180 }
4181
4182 } else if (cmd == cmdChar+"wake") { //wake command
4183 if (usersAsleep.indexOf(ids) != -1) {
4184 sendChat(name + " woke up (:o[▓▓▓]");
4185 while (usersAsleep.indexOf(ids) !== -1) {
4186 usersAsleep.splice(usersAsleep.indexOf(ids), 1);
4187 }
4188 } else {
4189 sendChat(name + ' is wide already wide awake :o');
4190 }
4191
4192 } else if (cmd == cmdChar+"motd") { //motd command
4193 sendChat(Lmotd);
4194
4195 } else if (cmd == cmdChar+"version") { //version command
4196 sendChat("Version " + botVersion + " Меня спиздил и немножечко модернизировал Лолька Аутист");
4197
4198 } else if (cmd == cmdChar+"time") {
4199 sendChat("The time for me is: " + new Date());
4200
4201 //by electrashave, fixed by Starseed Orion.
4202 } else if (cmd == cmdChar+"calc") {
4203 if (message.substring(5).trim() == "") {
4204 sendChat('Usage: '+cmdChar+'calc 2+4 (+ is addition, - is subtraction, / is division and * is multiplication).');
4205 return;
4206 }
4207
4208 var stuf = message.substring(6).trim();
4209 var mod = stuf.split('%').join('%');
4210 var pie = mod.split('pi').join(Math.PI);
4211 var pie = pie.replace(/[^0-9\*%\/\+\-()<>\.]/g, "");
4212
4213 try {
4214 if (eval(pie) == 420) {
4215 sendChat("Calculator: "+ eval(pie) + " Too high!");
4216 return;
4217 }
4218 sendChat("Calculator: "+ eval(pie));
4219
4220 } catch (e) {
4221 sendChat("Error: " + e);
4222
4223 }
4224
4225 // ♥ // !p made by Firebrick || optimized by B@K$ // ♥ //
4226 } else if (cmd == cmdChar+"p") {
4227 var m = message;
4228 if(m.substring(2).trim() == "") {
4229 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");
4230 }
4231 m = m.slice(3);
4232
4233 var notes = {
4234 "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",
4235 "2":"as2","m":"g2",",":"a2",".":"b2","/":"c3","'":"cs3","q":"a2","w":"b2","e":"c3","4":"cs3","5":"ds3","7":"fs3","8":"gs3","9":"as3",
4236 "-":"cs4","=":"ds4","r":"d3","t":"e3","y":"f3","u":"g3","i":"a3","o":"b3","p":"c4","[":"d4","]":"e4","Z":"a2","A":"gs2","S":"as2",
4237 "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",
4238 ">":"b3",'"':"cs4","?":"c4","Q":"a3","W":"b3","E":"c4","$":"cs4","%":"ds4","&":"fs4","*":"gs4","(":"as4","_":"cs5","+":"ds5","R":"d4",
4239 "T":"e4","Y":"f4","U":"g4","I":"a4","O":"b4","P":"c5","{":"d5","}":"e5"
4240 };
4241
4242 var i=h=0;
4243 var T=300;
4244
4245 while(i<m.length){
4246 setTimeout(function() { press(notes[m[h++]]) }, T);
4247 if(m[i] == "|"){T+=50;}
4248 else if(m[i] == ";"){T+=75;}
4249 else if(m[i] == "`"){T+=125;}
4250 else if(m[i] == " "){T+=200;}
4251 else if(m[i] == "~"){T+=300;}
4252 i++;
4253 }
4254
4255 // ♥ // !p made by Firebrick || optimized by B@K$ // ♥ //
4256
4257
4258 } else if (cmd == cmdChar+"ud") { //TEXTCONVERT COMMAND (Firebrick)//updated version
4259 if (message.length == cmd.length) {
4260 sendChat("Usage: "+cmdChar+"ud text here (converts to upsidedown text).");
4261 } else {
4262 var alpha1 = "zZyYxXwWvVuUtTsSrRqQpPoOnNmMlLkKjJiIhHgGfFeEdDcCbBaA?!.,0987654321 zZʎʎxXʍMʌΛn∩ʇ⊥sSɹᴚbὉdԀoOuNɯWl˥ʞʞɾſıIɥHƃƃɟℲǝƎpᗡɔϽqqɐ∀¿¡˙'068Ɫ9ㄣᔭƐᄅ⇂";
4263 var alpha2 = "zZʎʎxXʍMʌΛn∩ʇ⊥sSɹᴚbὉdԀoOuNɯWl˥ʞʞɾſıIɥHƃƃɟℲǝƎpᗡɔϽqqɐ∀¿¡˙'068Ɫ9ㄣᔭƐᄅ⇂ zZyYxXwWvVuUtTsSrRqQpPoOnNmMlLkKjJiIhHgGfFeEdDcCbBaA?!.,0987654321";
4264 var str = message.substring(cmd.length);
4265 var newstr = '';
4266 for (var i = 0; i < str.length; i++) {
4267 charPos = alpha1.indexOf(str.charAt(i));
4268 newstr += alpha2.charAt(charPos);
4269 }
4270 sendChat("Upside down: " + newstr.split("").reverse().join(""));
4271 }
4272
4273 } else if (cmd == cmdChar+"bubble") {
4274 if (message.length == cmd.length) {
4275 sendChat("Usage: "+cmdChar+"bubble text here.");
4276 } else {
4277 var alpha1 = "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz1234567890,. ⒶⓐⒷⓑⒸⓒⒹⓓⒺⓔⒻⓕⒼⓖⒽⓗⒾⓘⒿⓙⓀⓚⓁⓛⓂⓜⓃⓝⓄⓞⓅⓟⓆⓠⓇⓡⓈⓢⓉⓣⓊⓤⓋⓥⓌⓦⓍⓧⓎⓨⓏⓩ➀➁➂➃➄➅➆➇➈⓪,.";
4278 var alpha2 = "ⒶⓐⒷⓑⒸⓒⒹⓓⒺⓔⒻⓕⒼⓖⒽⓗⒾⓘⒿⓙⓀⓚⓁⓛⓂⓜⓃⓝⓄⓞⓅⓟⓆⓠⓇⓡⓈⓢⓉⓣⓊⓤⓋⓥⓌⓦⓍⓧⓎⓨⓏⓩ➀➁➂➃➄➅➆➇➈⓪,. AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz1234567890,.";
4279 var str = message.substring(cmd.length);
4280 var newstr = '';
4281 for (var i = 0; i < str.length; i++) {
4282 charPos = alpha1.indexOf(str.charAt(i));
4283 newstr += alpha2.charAt(charPos);
4284 }
4285 sendChat("Bubble: " + newstr);
4286 }
4287
4288 // backwards
4289 } else if (cmd == cmdChar+"bw") {
4290 if (message.length == cmd.length) { //add useage for below command
4291 sendChat("Usage: "+cmdChar+"bw text here (converts to backwards text).");
4292 } else {
4293 sendChat("Reverse: " + message.substring(cmd.length).split("").reverse().join(""));
4294 }
4295
4296 // wave
4297 } else if (cmd == cmdChar+"wave") {
4298 if (message.length == cmd.length) {
4299 sendChat("Usage: "+cmdChar+"wave text here.");
4300 } else {
4301 var alpha1 = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890?.,!@ ᗩᕊᑕᕍᙓℱᘐᖺᓰᒎḰᒪᗰﬡᗢᖰᕋᖇᔕ☂⋒ᐯᙡჯ૪ᔓᗩᙖᑕↁᕮℱᘐᕼᓮᒎḰᒪᗰᘉ〇ᖘႳᖇᔕ☂ᑌⅤᙡ᙭ϒᔓ";
4302 var alpha2 = "ᗩᕊᑕᕍᙓℱᘐᖺᓰᒎḰᒪᗰﬡᗢᖰᕋᖇᔕ☂⋒ᐯᙡჯ૪ᔓᗩᙖᑕↁᕮℱᘐᕼᓮᒎḰᒪᗰᘉ〇ᖘႳᖇᔕ☂ᑌⅤᙡ᙭ϒᔓ1234567890?.,!@ abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
4303 var str = message.substring(cmd.length);
4304 var newstr = '';
4305 for (var i = 0; i < str.length; i++) {
4306 charPos = alpha1.indexOf(str.charAt(i));
4307 newstr += alpha2.charAt(charPos);
4308 }
4309 sendChat("Wave: " + newstr);
4310 }
4311
4312
4313 // caps
4314 } else if (cmd == cmdChar+"caps") {
4315 if (message.length == cmd.length) {
4316 sendChat("Usage: "+cmdChar+"caps letters here.");
4317 } else {
4318 var alpha1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz?Æ.,!@:'[]/\|<>-=+* ᴀʙᴄᴅᴇғɢʜɪᴊᴋʟᴍɴᴏᴘǫʀsᴛᴜᴠᴡxʏᴢ";
4319 var alpha2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ᴀʙᴄᴅᴇғɢʜɪᴊᴋʟᴍɴᴏᴘǫʀsᴛᴜᴠᴡxʏᴢ?ᴁ.,!@:'[]/\|<>-=+* abcdefghijklmnopqrstuvwxyz";
4320 var str = message.substring(cmd.length);
4321 var newstr = '';
4322 for (var i = 0; i < str.length; i++) {
4323 charPos = alpha1.indexOf(str.charAt(i));
4324 newstr += alpha2.charAt(charPos);
4325 }
4326 sendChat("Caps: " + newstr);
4327 }
4328
4329 // big text
4330 } else if (cmd == cmdChar+"big") {
4331 if (message.length == cmd.length) {
4332 sendChat("Usage: "+cmdChar+"big letters here.");
4333 } else {
4334 var alpha1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz?-=[]\;'\",./_+{}|:<>!@#$%^&*() ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz";
4335 var alpha2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz?-=[]\;'\",./_+{}|:<>!@#$%^&*() ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz";
4336 var str = message.substring(cmd.length);
4337 var newstr = '';
4338 for (var i = 0; i < str.length; i++) {
4339 charPos = alpha1.indexOf(str.charAt(i));
4340 newstr += alpha2.charAt(charPos);
4341 }
4342 sendChat("Big: " + newstr.substr(1));
4343 }
4344
4345
4346 // bracket
4347 } else if (cmd == cmdChar+"bracket") {
4348 if (message.length == cmd.length) {
4349 sendChat("Usage: "+cmdChar+"bracket letters here.");
4350 } else {
4351 var alpha1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz?-=[]\;'\",./_+{}|:<>!@#$%^&*() ⒜⒝⒞⒟⒠⒡⒢⒣⒤⒥⒦⒧⒨⒩⒪⒫⒬⒭⒮⒯⒰⒱⒲⒳⒴⒵⑴⑵⑶⑷⑸⑹⑺⑻⑼0⒜⒝⒞⒟⒠⒡⒢⒣⒤⒥⒦⒧⒨⒩⒪⒫⒬⒭⒮⒯⒰⒱⒲⒳⒴⒵";
4352 var alpha2 = "⒜⒝⒞⒟⒠⒡⒢⒣⒤⒥⒦⒧⒨⒩⒪⒫⒬⒭⒮⒯⒰⒱⒲⒳⒴⒵⑴⑵⑶⑷⑸⑹⑺⑻⑼0⒜⒝⒞⒟⒠⒡⒢⒣⒤⒥⒦⒧⒨⒩⒪⒫⒬⒭⒮⒯⒰⒱⒲⒳⒴⒵?-=[]\;'\",./_+{}|:<>!@#$%^&*() ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz";
4353 var str = message.substring(cmd.length); //abcde
4354 var newstr = '';
4355 for (var i = 0; i < str.length; i++) {
4356 charPos = alpha1.indexOf(str.charAt(i));
4357 newstr += alpha2.charAt(charPos);
4358 }
4359 sendChat("Bracket: " + newstr);
4360 }
4361
4362 } else if (cmd == cmdChar+"tip" || cmd == cmdChar+"tips") { //tip command
4363 var tipCount = 14;
4364 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!'];
4365 var randomNumber = Math.floor(Math.random() * textArray.length);
4366 sendChat(textArray[randomNumber]);
4367
4368 } else if (cmd == cmdChar+"grammar") { //grammar command
4369 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: '];
4370 var randomNumber = Math.floor(Math.random() * textArray.length);
4371 sendChat(textArray[randomNumber]);
4372
4373 } else if (cmd == cmdChar+"grammer" || cmd == cmdChar+"gramer" || cmd == cmdChar+"gramar") { //grammer command for fun
4374 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!'];
4375 var randomNumber = Math.floor(Math.random() * textArray.length);
4376 sendChat(textArray[randomNumber]);
4377
4378 } else if (cmd == cmdChar+"joke") { //joke command
4379 var textArray = ['You can tune a piano but you can’t tuna fish.',
4380 'What sounds does a Bee make? A B#!', 'What do you get when you drop a piano on an army base? A flat major.',
4381 'A note left form a pianist for his wife: “Gone Chopin, (have Liszt), Bach in a Minuet.”',
4382 'What did the pianist say to a tightrope walker? You better C sharp or you’ll B flat.',
4383 'What do you call a fish musician? A piano tuna.',
4384 'Why was the pianist arrested? Because he got into treble.',
4385 'What’s the difference between a piano and an onion? No one cries when you chop up a piano.',
4386 'Did you hear about the circus fire? It was in tents! (Intense)', 'Two guys walk into a bar... the 3rd guy ducked.',
4387 '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."',
4388 'Yo Mama’s so fat, it takes 2 trains and a bus to get to her good side.',
4389 'What do you get when you drop a piano down a mine shaft? A flat minor.',
4390 'What do you call a grizzly bear with no teeth? A gummy bear.',
4391 'it’s funny how after an argument is over you start to think about more clever shit you could have said.',
4392 'Wifi went down for five minutes, so I had to talk to my family. They seem like nice people.',
4393 'There are plenty of fish in the sea... too bad I suck at fishing.',
4394 '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.',
4395 'How much is this torture device, sir? That\'s a wedding ring...',
4396 'What did the drummer get on his I.Q. Test? Saliva.',
4397 'How does a bass player change a light bulb? He doesn’t. The pianist does it with his left hand.',
4398 'What do you call a beautiful woman on a trombonist’s arm? A tattoo.',
4399 'What is the dynamic range of a bass trombone? On or off.',
4400 'Why did the chicken cross the road? To get away from the bassoon recital.',
4401 'What’s the difference between a bass trombone and a chainsaw? It’s easier to improvise on a chainsaw.',
4402 'Why are a pianist’s fingers like lightning? Because they rarely strike the same place twice.',
4403 'What is Harry Potter’s favourite mint? Dementoes.',
4404 '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',
4405 'What do you call a Jewish pokémon trainer? Ash.',
4406 'What if a girls tonsils were ticklish and when she was giving you head she laughed non stop?',
4407 'I used to be a banker but I lost interest.',
4408 'I’m glad I know sign language, it’s pretty handy.',
4409 'I couldn’t quite remember how to throw a boomerang, but eventually it came back to me.',
4410 'I don’t trust these stairs because they’re always up to something.',
4411 'Why was the painter killed? He dyed in a car accident.',
4412 '[Patient] Doctor, doctor! People keep Ignoring me! [Doctor] Next patient, please.',
4413 'Why did the sperm cross the road? I accidently put on the wrong sock.',
4414 'I\'m guaranteed to shag the missus up the arse tonight. She\'s dyslexic and thinks it\'s Vaseline Day.',
4415 'You can\'t spell "therapist" without "rapist".',
4416 '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!
4417 var randomNumber = Math.floor(Math.random() * textArray.length);
4418 sendChat(textArray[randomNumber]);
4419
4420
4421 //Music theory by Logan
4422 //It's not very optimised and takes up way too much space. I'm not sure how to make it more compact.
4423 //chords
4424 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"music theory" || cmd == cmdChar+"mt") { //music theory command
4425 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!!]");
4426
4427 } else if (cmd == cmdChar+"chords") { //Chords
4428 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!!]");
4429
4430 } else if (cmd == cmdChar+"cmajor") { //C major
4431 sendChat("A major triad is a chord having a root, a major third, and a perfect fifth.");
4432 sendChat("C major triad PC notes - etu");
4433 {setTimeout(function() { press("c2"); press("e2"); press("g2") }, 0);}
4434 {setTimeout(function() { press("c2"); press("e2"); press("g2") }, 3000);}
4435 {setTimeout(function() { press("c2")}, 5000);}
4436 {setTimeout(function() { press("e2")}, 6000);}
4437 {setTimeout(function() { press("g2")}, 7000);}
4438
4439
4440 } else if (cmd == cmdChar+"cdom7") { //C Dominant seventh
4441 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.");
4442 sendChat("C7 PC notes - etu9");
4443 {setTimeout(function() { press("c2"); press("e2"); press("g2"); press("as2") }, 0);}
4444 {setTimeout(function() { press("c2"); press("e2"); press("g2"); press("as2") }, 3000);}
4445 {setTimeout(function() { press("c2")}, 5000);}
4446 {setTimeout(function() { press("e2")}, 6000);}
4447 {setTimeout(function() { press("g2")}, 7000);}
4448 {setTimeout(function() { press("as2")}, 8000);}
4449
4450 } else if (cmd == cmdChar+"cdom7sus4") { //C Dominant seventh suspended 4th
4451 sendChat("A dominant seventh suspended 4th chord is a chord composed of a root, perfect fourth, perfect fifth, and minor seventh.");
4452 sendChat("C7(sus) PC notes - eyu9");
4453 {setTimeout(function() { press("c2"); press("f2"); press("g2"); press("as2") }, 0);}
4454 {setTimeout(function() { press("c2"); press("f2"); press("g2"); press("as2") }, 3000);}
4455 {setTimeout(function() { press("c2")}, 5000);}
4456 {setTimeout(function() { press("f2")}, 6000);}
4457 {setTimeout(function() { press("g2")}, 7000);}
4458 {setTimeout(function() { press("as2")}, 8000);}
4459
4460 } else if (cmd == cmdChar+"cmaj7") { //C major seventh
4461 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).");
4462 sendChat("Cmaj7 PC notes - etuo");
4463 {setTimeout(function() { press("c2"); press("e2"); press("g2"); press("b2") }, 0);}
4464 {setTimeout(function() { press("c2"); press("e2"); press("g2"); press("b2") }, 3000);}
4465 {setTimeout(function() { press("c2")}, 5000);}
4466 {setTimeout(function() { press("e2")}, 6000);}
4467 {setTimeout(function() { press("g2")}, 7000);}
4468 {setTimeout(function() { press("b2")}, 8000);}
4469
4470 } else if (cmd == cmdChar+"cminor") { //C minor
4471 sendChat("A minor triad is a chord having a root, a minor third, and a perfect fifth.");
4472 sendChat("C minor triad PC notes - e5u");
4473 {setTimeout(function() { press("c2"); press("ds2"); press("g2") }, 0);}
4474 {setTimeout(function() { press("c2"); press("ds2"); press("g2") }, 3000);}
4475 {setTimeout(function() { press("c2")}, 5000);}
4476 {setTimeout(function() { press("ds2")}, 6000);}
4477 {setTimeout(function() { press("g2")}, 7000);}
4478
4479 } else if (cmd == cmdChar+"cmin7") { //C minor seventh
4480 sendChat("A minor seventh chord is any non-dominant seventh chord where the \"third\" note is a minor third above the root.");
4481 sendChat("Cmin7 PC notes - e5u9");
4482 {setTimeout(function() { press("c2"); press("ds2"); press("g2"); press("as2") }, 0);}
4483 {setTimeout(function() { press("c2"); press("ds2"); press("g2"); press("as2") }, 3000);}
4484 {setTimeout(function() { press("c2")}, 5000);}
4485 {setTimeout(function() { press("ds2")}, 6000);}
4486 {setTimeout(function() { press("g2")}, 7000);}
4487 {setTimeout(function() { press("as2")}, 8000);}
4488
4489 } else if (cmd == cmdChar+"cminmaj") { //C minor major seventh
4490 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");
4491 sendChat("Cminmaj PC notes - e5uo");
4492 {setTimeout(function() { press("c2"); press("ds2"); press("g2"); press("b2") }, 0);}
4493 {setTimeout(function() { press("c2"); press("ds2"); press("g2"); press("b2") }, 3000);}
4494 {setTimeout(function() { press("c2")}, 5000);}
4495 {setTimeout(function() { press("ds2")}, 6000);}
4496 {setTimeout(function() { press("g2")}, 7000);}
4497 {setTimeout(function() { press("b2")}, 8000);}
4498
4499 } else if (cmd == cmdChar+"cdim") { //C diminished
4500 sendChat("A diminished triad is a triad consisting of two minor thirds above the root.");
4501 sendChat("C diminished triad PC notes - e57");
4502 {setTimeout(function() { press("c2"); press("ds2"); press("fs2") }, 0);}
4503 {setTimeout(function() { press("c2"); press("ds2"); press("fs2") }, 3000);}
4504 {setTimeout(function() { press("c2")}, 5000);}
4505 {setTimeout(function() { press("ds2")}, 6000);}
4506 {setTimeout(function() { press("fs2")}, 7000);}
4507
4508 } else if (cmd == cmdChar+"cdim7") { //C diminished seventh
4509 sendChat("A diminished seventh is an interval produced by narrowing a minor seventh by a chromatic semitone.");
4510 sendChat("Cdim7 PC notes - e57i (this is my favourite chord)");
4511 {setTimeout(function() { press("c2"); press("ds2"); press("fs2"); press("a2") }, 0);}
4512 {setTimeout(function() { press("c2"); press("ds2"); press("fs2"); press("a2") }, 3000);}
4513 {setTimeout(function() { press("c2")}, 5000);}
4514 {setTimeout(function() { press("ds2")}, 6000);}
4515 {setTimeout(function() { press("fs2")}, 7000);}
4516 {setTimeout(function() { press("a2")}, 8000);}
4517
4518 } else if (cmd == cmdChar+"chalfdim") { //C half diminished
4519 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.");
4520 sendChat("Chalfdim PC notes - e579");
4521 {setTimeout(function() { press("c2"); press("ds2"); press("fs2"); press("as2") }, 0);}
4522 {setTimeout(function() { press("c2"); press("ds2"); press("fs2"); press("as2") }, 3000);}
4523 {setTimeout(function() { press("c2")}, 5000);}
4524 {setTimeout(function() { press("ds2")}, 6000);}
4525 {setTimeout(function() { press("fs2")}, 7000);}
4526 {setTimeout(function() { press("as2")}, 8000);}
4527
4528
4529 } else if (cmd == cmdChar+"caug") { //C Augmented
4530 sendChat("An augmented triad is a triad, or chord, consisting of two major thirds (an augmented fifth).");
4531 sendChat("C augmented triad PC notes - et8 (second favourite chord)");
4532 {setTimeout(function() { press("c2"); press("e2"); press("gs2") }, 0);}
4533 {setTimeout(function() { press("c2"); press("e2"); press("gs2") }, 3000);}
4534 {setTimeout(function() { press("c2")}, 5000);}
4535 {setTimeout(function() { press("e2")}, 6000);}
4536 {setTimeout(function() { press("gs2")}, 7000);}
4537
4538 } else if (cmd == cmdChar+"caug7") { //C Augmented seventh
4539 sendChat("An augmented seventh chord is a dominant seventh chord consisting of an augmented triad with a minor seventh.");
4540 sendChat("Caug7 PC notes - et89");
4541 {setTimeout(function() { press("c2"); press("e2"); press("gs2"); press("as2") }, 0);}
4542 {setTimeout(function() { press("c2"); press("e2"); press("gs2"); press("as2") }, 3000);}
4543 {setTimeout(function() { press("c2")}, 5000);}
4544 {setTimeout(function() { press("e2")}, 6000);}
4545 {setTimeout(function() { press("gs2")}, 7000);}
4546 {setTimeout(function() { press("as2")}, 8000);}
4547
4548 } else if (cmd == cmdChar+"caugmaj7") { //C Augmented major seventh
4549 sendChat("An augmented major seventh chord is a nondominant seventh chord and is associated with the augmented scale.");
4550 sendChat("Caugmaj7 PC notes - et8o");
4551 {setTimeout(function() { press("c2"); press("e2"); press("gs2"); press("b2") }, 0);}
4552 {setTimeout(function() { press("c2"); press("e2"); press("gs2"); press("b2") }, 3000);}
4553 {setTimeout(function() { press("c2")}, 5000);}
4554 {setTimeout(function() { press("e2")}, 6000);}
4555 {setTimeout(function() { press("gs2")}, 7000);}
4556 {setTimeout(function() { press("b2")}, 8000);}
4557
4558 } else if (cmd == cmdChar+"csus2") { //C suspended second
4559 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.");
4560 sendChat("Csus2 PC notes - eru");
4561 {setTimeout(function() { press("c2"); press("d2"); press("g2") }, 0);}
4562 {setTimeout(function() { press("c2"); press("d2"); press("g2") }, 3000);}
4563 {setTimeout(function() { press("c2")}, 5000);}
4564 {setTimeout(function() { press("d2")}, 6000);}
4565 {setTimeout(function() { press("g2")}, 7000);}
4566
4567 } else if (cmd == cmdChar+"csus4") { //C suspended fourth
4568 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.");
4569 sendChat("Csus PC notes - eyu");
4570 {setTimeout(function() { press("c2"); press("f2"); press("g2") }, 0);}
4571 {setTimeout(function() { press("c2"); press("f2"); press("g2") }, 3000);}
4572 {setTimeout(function() { press("c2")}, 5000);}
4573 {setTimeout(function() { press("f2")}, 6000);}
4574 {setTimeout(function() { press("g2")}, 7000);}
4575 //chords
4576
4577 //scales
4578 } else if (cmd == cmdChar+"scales") { //Scales
4579 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");
4580
4581 } else if (cmd == cmdChar+"scales2") { //Scales 2
4582 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");
4583
4584 //C scales
4585 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"scale cmajor") { //C major scale
4586 sendChat("The C major scale - it has no flats or sharps - its relative minor is A");
4587 sendChat("The C major PC notes - e r t y u i o p");
4588 {setTimeout(function() { press("c2")}, 0);}
4589 {setTimeout(function() { press("d2")}, 250);}
4590 {setTimeout(function() { press("e2")}, 500);}
4591 {setTimeout(function() { press("f2")}, 750);}
4592 {setTimeout(function() { press("g2")}, 1000);}
4593 {setTimeout(function() { press("a2")}, 1250);}
4594 {setTimeout(function() { press("b2")}, 1500);}
4595 {setTimeout(function() { press("c3")}, 1750);}
4596 {setTimeout(function() { press("b2")}, 2000);}
4597 {setTimeout(function() { press("a2")}, 2250);}
4598 {setTimeout(function() { press("g2")}, 2500);}
4599 {setTimeout(function() { press("f2")}, 2750);}
4600 {setTimeout(function() { press("e2")}, 3000);}
4601 {setTimeout(function() { press("d2")}, 3250);}
4602 {setTimeout(function() { press("c2")}, 3500);}
4603 {setTimeout(function() { press("c2"); press("e2"); press("g2"); press("c3")}, 4000);}
4604
4605 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"scale cminor") { //C minor scale
4606 sendChat("The C minor scale - it has 3 flats - its relative major is Eb");
4607 sendChat("The C minor PC notes - e r 5 y u 8 9 p");
4608 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"]];
4609 var playID = 0;
4610
4611 function playMisc(arr){
4612 //if(playID != 0){clearInterval(playID);}
4613 if(playID != 0) {clearTimeout(playID);playID=0}
4614 var pNum = 0;
4615 var f = function () {
4616 for(var p=1; p<arr[pNum].length; p++){
4617 MPP.press(arr[pNum][p]);
4618 }
4619 if(++pNum >= arr.length) {clearTimeout(playID);playID=0;return;}
4620 setTimeout(f,arr[pNum][0]);
4621 }
4622 setTimeout(f,arr[pNum][0]);
4623 }
4624
4625 //test Play
4626 playMisc(scale_cminor);
4627
4628 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale charminor") { //C harmonic minor scale
4629 sendChat("The C harmonic minor scale - it has 2 flats - it has a major 7th (B)");
4630 sendChat("The C harmonic minor PC notes - e r 5 y u 8 o p");
4631 {setTimeout(function() { press("c2")}, 0);}
4632 {setTimeout(function() { press("d2")}, 250);}
4633 {setTimeout(function() { press("ds2")}, 500);}
4634 {setTimeout(function() { press("f2")}, 750);}
4635 {setTimeout(function() { press("g2")}, 1000);}
4636 {setTimeout(function() { press("gs2")}, 1250);}
4637 {setTimeout(function() { press("b2")}, 1500);}
4638 {setTimeout(function() { press("c3")}, 1750);}
4639 {setTimeout(function() { press("b2")}, 2000);}
4640 {setTimeout(function() { press("gs2")}, 2250);}
4641 {setTimeout(function() { press("g2")}, 2500);}
4642 {setTimeout(function() { press("f2")}, 2750);}
4643 {setTimeout(function() { press("ds2")}, 3000);}
4644 {setTimeout(function() { press("d2")}, 3250);}
4645 {setTimeout(function() { press("c2")}, 3500);}
4646 {setTimeout(function() { press("c2"); press("ds2"); press("g2"); press("c3")}, 4000);}
4647
4648 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale cmelminor") { //C melodic minor scale
4649 sendChat("The C melodic minor scale - it has 1 flat ascending and 3 flats descending - it has two patterns ascending and descending.");
4650 sendChat("The C melodic minor PC notes - e r 5 y u i o p 9 8 u y 5 r e");
4651 {setTimeout(function() { press("c2")}, 0);}
4652 {setTimeout(function() { press("d2")}, 250);}
4653 {setTimeout(function() { press("ds2")}, 500);}
4654 {setTimeout(function() { press("f2")}, 750);}
4655 {setTimeout(function() { press("g2")}, 1000);}
4656 {setTimeout(function() { press("a2")}, 1250);}
4657 {setTimeout(function() { press("b2")}, 1500);}
4658 {setTimeout(function() { press("c3")}, 1750);}
4659 {setTimeout(function() { press("as2")}, 2000);}
4660 {setTimeout(function() { press("gs2")}, 2250);}
4661 {setTimeout(function() { press("g2")}, 2500);}
4662 {setTimeout(function() { press("f2")}, 2750);}
4663 {setTimeout(function() { press("ds2")}, 3000);}
4664 {setTimeout(function() { press("d2")}, 3250);}
4665 {setTimeout(function() { press("c2")}, 3500);}
4666 {setTimeout(function() { press("c2"); press("ds2"); press("g2"); press("c3")}, 4000);}
4667 //C scales
4668
4669 //C# scales
4670 } else if (message.substring(0, 14).toLowerCase() == cmdChar+"scale csmajor") { //C# major scale
4671 sendChat("The C# (sharp) major scale - it has 7 sharps - its relative minor is A#");
4672 sendChat("The C# (sharp) major PC notes - 4 5 y 7 8 9 p -");
4673 {setTimeout(function() { press("cs2")}, 0);}
4674 {setTimeout(function() { press("ds2")}, 250);}
4675 {setTimeout(function() { press("f2")}, 500);}
4676 {setTimeout(function() { press("fs2")}, 750);}
4677 {setTimeout(function() { press("gs2")}, 1000);}
4678 {setTimeout(function() { press("as2")}, 1250);}
4679 {setTimeout(function() { press("c3")}, 1500);}
4680 {setTimeout(function() { press("cs3")}, 1750);}
4681 {setTimeout(function() { press("c3")}, 2000);}
4682 {setTimeout(function() { press("as2")}, 2250);}
4683 {setTimeout(function() { press("gs2")}, 2500);}
4684 {setTimeout(function() { press("fs2")}, 2750);}
4685 {setTimeout(function() { press("f2")}, 3000);}
4686 {setTimeout(function() { press("ds2")}, 3250);}
4687 {setTimeout(function() { press("cs2")}, 3500);}
4688 {setTimeout(function() { press("cs2"); press("f2"); press("gs2"); press("cs3")}, 4000);}
4689
4690 } else if (message.substring(0, 14).toLowerCase() == cmdChar+"scale csminor") { //C# minor scale
4691 sendChat("The C# (sharp) minor scale - it has 4 sharps - its relative major is E");
4692 sendChat("The C# (sharp) major PC notes - f g b j k q . 4");
4693 {setTimeout(function() { press("cs2")}, 0);}
4694 {setTimeout(function() { press("ds2")}, 250);}
4695 {setTimeout(function() { press("e2")}, 500);}
4696 {setTimeout(function() { press("fs2")}, 750);}
4697 {setTimeout(function() { press("gs2")}, 1000);}
4698 {setTimeout(function() { press("a2")}, 1250);}
4699 {setTimeout(function() { press("b2")}, 1500);}
4700 {setTimeout(function() { press("cs3")}, 1750);}
4701 {setTimeout(function() { press("b2")}, 2000);}
4702 {setTimeout(function() { press("a2")}, 2250);}
4703 {setTimeout(function() { press("gs2")}, 2500);}
4704 {setTimeout(function() { press("fs2")}, 2750);}
4705 {setTimeout(function() { press("e2")}, 3000);}
4706 {setTimeout(function() { press("ds2")}, 3250);}
4707 {setTimeout(function() { press("cs2")}, 3500);}
4708 {setTimeout(function() { press("cs2"); press("e2"); press("gs2"); press("cs3")}, 4000);}
4709
4710 } else if (message.substring(0, 17).toLowerCase() == cmdChar+"scale csharminor") { //C# harmonic minor scale
4711 sendChat("The C# (sharp) harmonic minor scale - it has 2 flats - it has a major 7th (C)");
4712 sendChat("The C# (sharp) harmonic minor PC notes - 4 5 t 7 8 i p -");
4713 {setTimeout(function() { press("cs2")}, 0);}
4714 {setTimeout(function() { press("ds2")}, 250);}
4715 {setTimeout(function() { press("e2")}, 500);}
4716 {setTimeout(function() { press("fs2")}, 750);}
4717 {setTimeout(function() { press("gs2")}, 1000);}
4718 {setTimeout(function() { press("a2")}, 1250);}
4719 {setTimeout(function() { press("c3")}, 1500);}
4720 {setTimeout(function() { press("cs3")}, 1750);}
4721 {setTimeout(function() { press("c3")}, 2000);}
4722 {setTimeout(function() { press("a2")}, 2250);}
4723 {setTimeout(function() { press("gs2")}, 2500);}
4724 {setTimeout(function() { press("fs2")}, 2750);}
4725 {setTimeout(function() { press("e2")}, 3000);}
4726 {setTimeout(function() { press("ds2")}, 3250);}
4727 {setTimeout(function() { press("cs2")}, 3500);}
4728 {setTimeout(function() { press("cs2"); press("e2"); press("gs2"); press("cs3")}, 4000);}
4729
4730 } else if (message.substring(0, 17).toLowerCase() == cmdChar+"scale csmelminor") { //C# melodic minor scale
4731 sendChat("The C# (sharp) melodic minor scale - it has 7 sharps ascending and 5 sharps descending - it has two patterns ascending and descending.");
4732 sendChat("The C# (sharp) melodic minor PC notes - 4 5 t 7 8 9 p - o i 8 7 t 5 4");
4733 {setTimeout(function() { press("cs2")}, 0);}
4734 {setTimeout(function() { press("ds2")}, 250);}
4735 {setTimeout(function() { press("e2")}, 500);}
4736 {setTimeout(function() { press("fs2")}, 750);}
4737 {setTimeout(function() { press("gs2")}, 1000);}
4738 {setTimeout(function() { press("as2")}, 1250);}
4739 {setTimeout(function() { press("c3")}, 1500);}
4740 {setTimeout(function() { press("cs3")}, 1750);}
4741 {setTimeout(function() { press("b2")}, 2000);}
4742 {setTimeout(function() { press("a2")}, 2250);}
4743 {setTimeout(function() { press("gs2")}, 2500);}
4744 {setTimeout(function() { press("fs2")}, 2750);}
4745 {setTimeout(function() { press("e2")}, 3000);}
4746 {setTimeout(function() { press("ds2")}, 3250);}
4747 {setTimeout(function() { press("cs2")}, 3500);}
4748 {setTimeout(function() { press("cs2"); press("e2"); press("gs2"); press("cs3")}, 4000);}
4749 //C# scales
4750
4751 //D scales
4752 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"scale dmajor") { //D major scale
4753 sendChat("The D major scale - it has 2 sharps - its relative minor is B");
4754 sendChat("The D major scale PC notes - r t 7 u i o - [");
4755 {setTimeout(function() { press("d2")}, 0);}
4756 {setTimeout(function() { press("e2")}, 250);}
4757 {setTimeout(function() { press("fs2")}, 500);}
4758 {setTimeout(function() { press("g2")}, 750);}
4759 {setTimeout(function() { press("a2")}, 1000);}
4760 {setTimeout(function() { press("b2")}, 1250);}
4761 {setTimeout(function() { press("cs3")}, 1500);}
4762 {setTimeout(function() { press("d3")}, 1750);}
4763 {setTimeout(function() { press("cs3")}, 2000);}
4764 {setTimeout(function() { press("b2")}, 2250);}
4765 {setTimeout(function() { press("a2")}, 2500);}
4766 {setTimeout(function() { press("g2")}, 2750);}
4767 {setTimeout(function() { press("fs2")}, 3000);}
4768 {setTimeout(function() { press("e2")}, 3250);}
4769 {setTimeout(function() { press("d2")}, 3500);}
4770 {setTimeout(function() { press("d2"); press("fs2"); press("a2"); press("d3")}, 4000);}
4771
4772 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"scale dminor") { //D minor scale
4773 sendChat("The D minor scale - it has 2 sharps - its relative major is F");
4774 sendChat("The D minor scale PC notes - r t 7 u i o - [");
4775 {setTimeout(function() { press("d2")}, 0);}
4776 {setTimeout(function() { press("e2")}, 250);}
4777 {setTimeout(function() { press("f2")}, 500);}
4778 {setTimeout(function() { press("g2")}, 750);}
4779 {setTimeout(function() { press("a2")}, 1000);}
4780 {setTimeout(function() { press("as2")}, 1250);}
4781 {setTimeout(function() { press("c3")}, 1500);}
4782 {setTimeout(function() { press("d3")}, 1750);}
4783 {setTimeout(function() { press("c3")}, 2000);}
4784 {setTimeout(function() { press("as2")}, 2250);}
4785 {setTimeout(function() { press("a2")}, 2500);}
4786 {setTimeout(function() { press("g2")}, 2750);}
4787 {setTimeout(function() { press("f2")}, 3000);}
4788 {setTimeout(function() { press("e2")}, 3250);}
4789 {setTimeout(function() { press("d2")}, 3500);}
4790 {setTimeout(function() { press("d2"); press("f2"); press("a2"); press("d3")}, 4000);}
4791
4792 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale dharminor") { //D harmonic minor scale
4793 sendChat("The D harmonic minor scale - it has 2 sharps - it has a major 7th (C#)");
4794 {setTimeout(function() { press("d2")}, 0);}
4795 {setTimeout(function() { press("e2")}, 250);}
4796 {setTimeout(function() { press("f2")}, 500);}
4797 {setTimeout(function() { press("g2")}, 750);}
4798 {setTimeout(function() { press("a2")}, 1000);}
4799 {setTimeout(function() { press("as2")}, 1250);}
4800 {setTimeout(function() { press("cs3")}, 1500);}
4801 {setTimeout(function() { press("d3")}, 1750);}
4802 {setTimeout(function() { press("cs3")}, 2000);}
4803 {setTimeout(function() { press("as2")}, 2250);}
4804 {setTimeout(function() { press("a2")}, 2500);}
4805 {setTimeout(function() { press("g2")}, 2750);}
4806 {setTimeout(function() { press("f2")}, 3000);}
4807 {setTimeout(function() { press("e2")}, 3250);}
4808 {setTimeout(function() { press("d2")}, 3500);}
4809 {setTimeout(function() { press("d2"); press("f2"); press("a2"); press("d3")}, 4000);}
4810
4811 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale dmelminor") { //D melodic minor scale
4812 sendChat("The D melodic minor scale - it has 1 flat ascending and 3 flats descending - it has two patterns ascending and descending.");
4813 {setTimeout(function() { press("d2")}, 0);}
4814 {setTimeout(function() { press("e2")}, 250);}
4815 {setTimeout(function() { press("f2")}, 500);}
4816 {setTimeout(function() { press("g2")}, 750);}
4817 {setTimeout(function() { press("a2")}, 1000);}
4818 {setTimeout(function() { press("b2")}, 1250);}
4819 {setTimeout(function() { press("cs3")}, 1500);}
4820 {setTimeout(function() { press("d3")}, 1750);}
4821 {setTimeout(function() { press("c3")}, 2000);}
4822 {setTimeout(function() { press("as2")}, 2250);}
4823 {setTimeout(function() { press("a2")}, 2500);}
4824 {setTimeout(function() { press("g2")}, 2750);}
4825 {setTimeout(function() { press("f2")}, 3000);}
4826 {setTimeout(function() { press("e2")}, 3250);}
4827 {setTimeout(function() { press("d2")}, 3500);}
4828 {setTimeout(function() { press("d2"); press("f2"); press("a2"); press("d3")}, 4000);}
4829 //D scales
4830
4831 //Eb scales
4832 } else if (message.substring(0, 14).toLowerCase() == cmdChar+"scale ebmajor") { //Eb major scale
4833 sendChat("The Eb (flat) major scale - it has 3 flats - its relative minor is C");
4834 {setTimeout(function() { press("ds2")}, 0);}
4835 {setTimeout(function() { press("f2")}, 250);}
4836 {setTimeout(function() { press("g2")}, 500);}
4837 {setTimeout(function() { press("gs2")}, 750);}
4838 {setTimeout(function() { press("as2")}, 1000);}
4839 {setTimeout(function() { press("c3")}, 1250);}
4840 {setTimeout(function() { press("d3")}, 1500);}
4841 {setTimeout(function() { press("ds3")}, 1750);}
4842 {setTimeout(function() { press("d3")}, 2000);}
4843 {setTimeout(function() { press("c3")}, 2250);}
4844 {setTimeout(function() { press("as2")}, 2500);}
4845 {setTimeout(function() { press("gs2")}, 2750);}
4846 {setTimeout(function() { press("g2")}, 3000);}
4847 {setTimeout(function() { press("f2")}, 3250);}
4848 {setTimeout(function() { press("ds2")}, 3500);}
4849 {setTimeout(function() { press("ds2"); press("g2"); press("as2"); press("ds3")}, 4000);}
4850
4851 } else if (message.substring(0, 14).toLowerCase() == cmdChar+"scale ebminor") { //Eb minor scale
4852 sendChat("The Eb (flat) minor scale - it has 6 flats - its relative major is Gb");
4853 {setTimeout(function() { press("ds2")}, 0);}
4854 {setTimeout(function() { press("f2")}, 250);}
4855 {setTimeout(function() { press("fs2")}, 500);}
4856 {setTimeout(function() { press("gs2")}, 750);}
4857 {setTimeout(function() { press("as2")}, 1000);}
4858 {setTimeout(function() { press("b2")}, 1250);}
4859 {setTimeout(function() { press("cs3")}, 1500);}
4860 {setTimeout(function() { press("ds3")}, 1750);}
4861 {setTimeout(function() { press("cs3")}, 2000);}
4862 {setTimeout(function() { press("b2")}, 2250);}
4863 {setTimeout(function() { press("as2")}, 2500);}
4864 {setTimeout(function() { press("gs2")}, 2750);}
4865 {setTimeout(function() { press("fs2")}, 3000);}
4866 {setTimeout(function() { press("f2")}, 3250);}
4867 {setTimeout(function() { press("ds2")}, 3500);}
4868 {setTimeout(function() { press("ds2"); press("fs2"); press("as2"); press("ds3")}, 4000);}
4869
4870 } else if (message.substring(0, 17).toLowerCase() == cmdChar+"scale ebharminor") { //Eb harmonic minor scale
4871 sendChat("The Eb (flat) harmonic minor scale - it has 5 flats - it has a major 7th (D)");
4872 {setTimeout(function() { press("ds2")}, 0);}
4873 {setTimeout(function() { press("f2")}, 250);}
4874 {setTimeout(function() { press("fs2")}, 500);}
4875 {setTimeout(function() { press("gs2")}, 750);}
4876 {setTimeout(function() { press("as2")}, 1000);}
4877 {setTimeout(function() { press("b2")}, 1250);}
4878 {setTimeout(function() { press("d3")}, 1500);}
4879 {setTimeout(function() { press("ds3")}, 1750);}
4880 {setTimeout(function() { press("d3")}, 2000);}
4881 {setTimeout(function() { press("b2")}, 2250);}
4882 {setTimeout(function() { press("as2")}, 2500);}
4883 {setTimeout(function() { press("gs2")}, 2750);}
4884 {setTimeout(function() { press("fs2")}, 3000);}
4885 {setTimeout(function() { press("f2")}, 3250);}
4886 {setTimeout(function() { press("ds2")}, 3500);}
4887 {setTimeout(function() { press("ds2"); press("fs2"); press("as2"); press("ds3")}, 4000);}
4888
4889 } else if (message.substring(0, 17).toLowerCase() == cmdChar+"scale ebmelminor") { //Eb melodic minor scale
4890 sendChat("The Eb (flat) melodic minor scale - it has 5 flats ascending and 6 flats descending - it has two patterns ascending and descending.");
4891 {setTimeout(function() { press("ds2")}, 0);}
4892 {setTimeout(function() { press("f2")}, 250);}
4893 {setTimeout(function() { press("fs2")}, 500);}
4894 {setTimeout(function() { press("gs2")}, 750);}
4895 {setTimeout(function() { press("as2")}, 1000);}
4896 {setTimeout(function() { press("c3")}, 1250);}
4897 {setTimeout(function() { press("d3")}, 1500);}
4898 {setTimeout(function() { press("ds3")}, 1750);}
4899 {setTimeout(function() { press("cs3")}, 2000);}
4900 {setTimeout(function() { press("b2")}, 2250);}
4901 {setTimeout(function() { press("as2")}, 2500);}
4902 {setTimeout(function() { press("gs2")}, 2750);}
4903 {setTimeout(function() { press("fs2")}, 3000);}
4904 {setTimeout(function() { press("f2")}, 3250);}
4905 {setTimeout(function() { press("ds2")}, 3500);}
4906 {setTimeout(function() { press("ds2"); press("fs2"); press("as2"); press("ds3")}, 4000);}
4907 //Eb scales
4908
4909 //E scales
4910 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"scale emajor") { //E major scale
4911 sendChat("The E major scale - it has 4 sharps - its relative minor is C#");
4912 {setTimeout(function() { press("e2")}, 0);}
4913 {setTimeout(function() { press("fs2")}, 250);}
4914 {setTimeout(function() { press("gs2")}, 500);}
4915 {setTimeout(function() { press("a2")}, 750);}
4916 {setTimeout(function() { press("b2")}, 1000);}
4917 {setTimeout(function() { press("cs3")}, 1250);}
4918 {setTimeout(function() { press("ds3")}, 1500);}
4919 {setTimeout(function() { press("e3")}, 1750);}
4920 {setTimeout(function() { press("ds3")}, 2000);}
4921 {setTimeout(function() { press("cs3")}, 2250);}
4922 {setTimeout(function() { press("b2")}, 2500);}
4923 {setTimeout(function() { press("a2")}, 2750);}
4924 {setTimeout(function() { press("gs2")}, 3000);}
4925 {setTimeout(function() { press("fs2")}, 3250);}
4926 {setTimeout(function() { press("e2")}, 3500);}
4927 {setTimeout(function() { press("e2"); press("gs2"); press("b2"); press("e3")}, 4000);}
4928
4929 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"scale eminor") { //E minor scale
4930 sendChat("The E minor scale - it has 1 sharp - its relative major is G");
4931 {setTimeout(function() { press("e2")}, 0);}
4932 {setTimeout(function() { press("fs2")}, 250);}
4933 {setTimeout(function() { press("g2")}, 500);}
4934 {setTimeout(function() { press("a2")}, 750);}
4935 {setTimeout(function() { press("b2")}, 1000);}
4936 {setTimeout(function() { press("c3")}, 1250);}
4937 {setTimeout(function() { press("d3")}, 1500);}
4938 {setTimeout(function() { press("e3")}, 1750);}
4939 {setTimeout(function() { press("d3")}, 2000);}
4940 {setTimeout(function() { press("c3")}, 2250);}
4941 {setTimeout(function() { press("b2")}, 2500);}
4942 {setTimeout(function() { press("a2")}, 2750);}
4943 {setTimeout(function() { press("g2")}, 3000);}
4944 {setTimeout(function() { press("fs2")}, 3250);}
4945 {setTimeout(function() { press("e2")}, 3500);}
4946 {setTimeout(function() { press("e2"); press("g2"); press("b2"); press("e3")}, 4000);}
4947
4948 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale eharminor") { //E harmonic minor scale
4949 sendChat("The E harmonic minor scale - it has 2 sharps - it has a major 7th (D#)");
4950 {setTimeout(function() { press("e2")}, 0);}
4951 {setTimeout(function() { press("fs2")}, 250);}
4952 {setTimeout(function() { press("g2")}, 500);}
4953 {setTimeout(function() { press("a2")}, 750);}
4954 {setTimeout(function() { press("b2")}, 1000);}
4955 {setTimeout(function() { press("c3")}, 1250);}
4956 {setTimeout(function() { press("ds3")}, 1500);}
4957 {setTimeout(function() { press("e3")}, 1750);}
4958 {setTimeout(function() { press("ds3")}, 2000);}
4959 {setTimeout(function() { press("c3")}, 2250);}
4960 {setTimeout(function() { press("b2")}, 2500);}
4961 {setTimeout(function() { press("a2")}, 2750);}
4962 {setTimeout(function() { press("g2")}, 3000);}
4963 {setTimeout(function() { press("fs2")}, 3250);}
4964 {setTimeout(function() { press("e2")}, 3500);}
4965 {setTimeout(function() { press("e2"); press("g2"); press("b2"); press("e3")}, 4000);}
4966
4967 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale emelminor") { //E melodic minor scale
4968 sendChat("The E melodic minor scale - it has 3 sharps ascending and 1 sharp descending - it has two patterns ascending and descending.");
4969 {setTimeout(function() { press("e2")}, 0);}
4970 {setTimeout(function() { press("fs2")}, 250);}
4971 {setTimeout(function() { press("g2")}, 500);}
4972 {setTimeout(function() { press("a2")}, 750);}
4973 {setTimeout(function() { press("b2")}, 1000);}
4974 {setTimeout(function() { press("cs3")}, 1250);}
4975 {setTimeout(function() { press("ds3")}, 1500);}
4976 {setTimeout(function() { press("e3")}, 1750);}
4977 {setTimeout(function() { press("d3")}, 2000);}
4978 {setTimeout(function() { press("c3")}, 2250);}
4979 {setTimeout(function() { press("b2")}, 2500);}
4980 {setTimeout(function() { press("a2")}, 2750);}
4981 {setTimeout(function() { press("g2")}, 3000);}
4982 {setTimeout(function() { press("fs2")}, 3250);}
4983 {setTimeout(function() { press("e2")}, 3500);}
4984 {setTimeout(function() { press("e2"); press("g2"); press("b2"); press("e3")}, 4000);}
4985 //E scales
4986
4987 //F scales
4988 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"scale fmajor") { //F major scale
4989 sendChat("The F major scale - it has 1 flat - its relative minor is D");
4990 {setTimeout(function() { press("f2")}, 0);}
4991 {setTimeout(function() { press("g2")}, 250);}
4992 {setTimeout(function() { press("a2")}, 500);}
4993 {setTimeout(function() { press("as2")}, 750);}
4994 {setTimeout(function() { press("c3")}, 1000);}
4995 {setTimeout(function() { press("d3")}, 1250);}
4996 {setTimeout(function() { press("e3")}, 1500);}
4997 {setTimeout(function() { press("f3")}, 1750);}
4998 {setTimeout(function() { press("e3")}, 2000);}
4999 {setTimeout(function() { press("d3")}, 2250);}
5000 {setTimeout(function() { press("c3")}, 2500);}
5001 {setTimeout(function() { press("as2")}, 2750);}
5002 {setTimeout(function() { press("a2")}, 3000);}
5003 {setTimeout(function() { press("g2")}, 3250);}
5004 {setTimeout(function() { press("f2")}, 3500);}
5005 {setTimeout(function() { press("f2"); press("a2"); press("c3"); press("f3")}, 4000);}
5006
5007 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"scale fminor") { //F minor scale
5008 sendChat("The F minor scale - it has 4 flats - its relative major is Ab");
5009 {setTimeout(function() { press("f2")}, 0);}
5010 {setTimeout(function() { press("g2")}, 250);}
5011 {setTimeout(function() { press("gs2")}, 500);}
5012 {setTimeout(function() { press("as2")}, 750);}
5013 {setTimeout(function() { press("c3")}, 1000);}
5014 {setTimeout(function() { press("cs3")}, 1250);}
5015 {setTimeout(function() { press("ds3")}, 1500);}
5016 {setTimeout(function() { press("f3")}, 1750);}
5017 {setTimeout(function() { press("ds3")}, 2000);}
5018 {setTimeout(function() { press("cs3")}, 2250);}
5019 {setTimeout(function() { press("c3")}, 2500);}
5020 {setTimeout(function() { press("as2")}, 2750);}
5021 {setTimeout(function() { press("gs2")}, 3000);}
5022 {setTimeout(function() { press("g2")}, 3250);}
5023 {setTimeout(function() { press("f2")}, 3500);}
5024 {setTimeout(function() { press("f2"); press("gs2"); press("c3"); press("f3")}, 4000);}
5025
5026 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale fharminor") { //F harmonic minor scale
5027 sendChat("The F harmonic minor scale - it has 3 flats - it has a major 7th (E)");
5028 {setTimeout(function() { press("f2")}, 0);}
5029 {setTimeout(function() { press("g2")}, 250);}
5030 {setTimeout(function() { press("gs2")}, 500);}
5031 {setTimeout(function() { press("as2")}, 750);}
5032 {setTimeout(function() { press("c3")}, 1000);}
5033 {setTimeout(function() { press("cs3")}, 1250);}
5034 {setTimeout(function() { press("e3")}, 1500);}
5035 {setTimeout(function() { press("f3")}, 1750);}
5036 {setTimeout(function() { press("e3")}, 2000);}
5037 {setTimeout(function() { press("cs3")}, 2250);}
5038 {setTimeout(function() { press("c3")}, 2500);}
5039 {setTimeout(function() { press("as2")}, 2750);}
5040 {setTimeout(function() { press("gs2")}, 3000);}
5041 {setTimeout(function() { press("g2")}, 3250);}
5042 {setTimeout(function() { press("f2")}, 3500);}
5043 {setTimeout(function() { press("f2"); press("gs2"); press("c3"); press("f3")}, 4000);}
5044
5045 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale fmelminor") { //F melodic minor scale
5046 sendChat("The F melodic minor scale - it has 2 flats ascending and 4 flats descending - it has two patterns ascending and descending.");
5047 {setTimeout(function() { press("f2")}, 0);}
5048 {setTimeout(function() { press("g2")}, 250);}
5049 {setTimeout(function() { press("gs2")}, 500);}
5050 {setTimeout(function() { press("as2")}, 750);}
5051 {setTimeout(function() { press("c3")}, 1000);}
5052 {setTimeout(function() { press("d3")}, 1250);}
5053 {setTimeout(function() { press("e3")}, 1500);}
5054 {setTimeout(function() { press("f3")}, 1750);}
5055 {setTimeout(function() { press("ds3")}, 2000);}
5056 {setTimeout(function() { press("cs3")}, 2250);}
5057 {setTimeout(function() { press("c3")}, 2500);}
5058 {setTimeout(function() { press("as2")}, 2750);}
5059 {setTimeout(function() { press("gs2")}, 3000);}
5060 {setTimeout(function() { press("g2")}, 3250);}
5061 {setTimeout(function() { press("f2")}, 3500);}
5062 {setTimeout(function() { press("f2"); press("gs2"); press("c3"); press("f3")}, 4000);}
5063 //F scales
5064
5065 //F# scales
5066 } else if (message.substring(0, 14).toLowerCase() == cmdChar+"scale fsmajor") { //F# major scale
5067 sendChat("The F# (sharp) major scale - it has 6 sharps - its relative minor is D#");
5068 {setTimeout(function() { press("fs2")}, 0);}
5069 {setTimeout(function() { press("gs2")}, 250);}
5070 {setTimeout(function() { press("as2")}, 500);}
5071 {setTimeout(function() { press("b2")}, 750);}
5072 {setTimeout(function() { press("cs3")}, 1000);}
5073 {setTimeout(function() { press("ds3")}, 1250);}
5074 {setTimeout(function() { press("f3")}, 1500);}
5075 {setTimeout(function() { press("fs3")}, 1750);}
5076 {setTimeout(function() { press("f3")}, 2000);}
5077 {setTimeout(function() { press("ds3")}, 2250);}
5078 {setTimeout(function() { press("cs3")}, 2500);}
5079 {setTimeout(function() { press("b2")}, 2750);}
5080 {setTimeout(function() { press("as2")}, 3000);}
5081 {setTimeout(function() { press("gs2")}, 3250);}
5082 {setTimeout(function() { press("fs2")}, 3500);}
5083 {setTimeout(function() { press("fs2"); press("as2"); press("cs3"); press("fs3")}, 4000);}
5084
5085 } else if (message.substring(0, 14).toLowerCase() == cmdChar+"scale fsminor") { //F# minor scale
5086 sendChat("The F# (sharp) minor scale - it has 3 sharps - its relative major is A");
5087 {setTimeout(function() { press("fs2")}, 0);}
5088 {setTimeout(function() { press("gs2")}, 250);}
5089 {setTimeout(function() { press("a2")}, 500);}
5090 {setTimeout(function() { press("b2")}, 750);}
5091 {setTimeout(function() { press("cs3")}, 1000);}
5092 {setTimeout(function() { press("d3")}, 1250);}
5093 {setTimeout(function() { press("e3")}, 1500);}
5094 {setTimeout(function() { press("fs3")}, 1750);}
5095 {setTimeout(function() { press("e3")}, 2000);}
5096 {setTimeout(function() { press("d3")}, 2250);}
5097 {setTimeout(function() { press("cs3")}, 2500);}
5098 {setTimeout(function() { press("b2")}, 2750);}
5099 {setTimeout(function() { press("a2")}, 3000);}
5100 {setTimeout(function() { press("gs2")}, 3250);}
5101 {setTimeout(function() { press("fs2")}, 3500);}
5102 {setTimeout(function() { press("fs2"); press("a2"); press("cs3"); press("fs3")}, 4000);}
5103
5104 } else if (message.substring(0, 17).toLowerCase() == cmdChar+"scale fsharminor") { //F# harmonic minor scale
5105 sendChat("The F# (sharp) harmonic minor scale - it has 4 sharps - it has a major 7th (E#)");
5106 {setTimeout(function() { press("fs2")}, 0);}
5107 {setTimeout(function() { press("gs2")}, 250);}
5108 {setTimeout(function() { press("a2")}, 500);}
5109 {setTimeout(function() { press("b2")}, 750);}
5110 {setTimeout(function() { press("cs3")}, 1000);}
5111 {setTimeout(function() { press("d3")}, 1250);}
5112 {setTimeout(function() { press("f3")}, 1500);}
5113 {setTimeout(function() { press("fs3")}, 1750);}
5114 {setTimeout(function() { press("f3")}, 2000);}
5115 {setTimeout(function() { press("d3")}, 2250);}
5116 {setTimeout(function() { press("cs3")}, 2500);}
5117 {setTimeout(function() { press("b2")}, 2750);}
5118 {setTimeout(function() { press("a2")}, 3000);}
5119 {setTimeout(function() { press("gs2")}, 3250);}
5120 {setTimeout(function() { press("fs2")}, 3500);}
5121 {setTimeout(function() { press("fs2"); press("a2"); press("cs3"); press("fs3")}, 4000);}
5122
5123 } else if (message.substring(0, 17).toLowerCase() == cmdChar+"scale fsmelminor") { //F# melodic minor scale
5124 sendChat("The F# (sharp) melodic minor scale - it has 5 sharps ascending and 3 sharps descending - it has two patterns ascending and descending.");
5125 {setTimeout(function() { press("fs2")}, 0);}
5126 {setTimeout(function() { press("gs2")}, 250);}
5127 {setTimeout(function() { press("a2")}, 500);}
5128 {setTimeout(function() { press("b2")}, 750);}
5129 {setTimeout(function() { press("cs3")}, 1000);}
5130 {setTimeout(function() { press("ds3")}, 1250);}
5131 {setTimeout(function() { press("f3")}, 1500);}
5132 {setTimeout(function() { press("fs3")}, 1750);}
5133 {setTimeout(function() { press("e3")}, 2000);}
5134 {setTimeout(function() { press("d3")}, 2250);}
5135 {setTimeout(function() { press("cs3")}, 2500);}
5136 {setTimeout(function() { press("b2")}, 2750);}
5137 {setTimeout(function() { press("a2")}, 3000);}
5138 {setTimeout(function() { press("gs2")}, 3250);}
5139 {setTimeout(function() { press("fs2")}, 3500);}
5140 {setTimeout(function() { press("fs2"); press("a2"); press("cs3"); press("fs3")}, 4000);}
5141 //F# scales
5142
5143 //G scales
5144 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"scale gmajor") { //G major scale
5145 sendChat("The G major scale - it has 1 sharp - its relative minor is E");
5146 {setTimeout(function() { press("g2")}, 0);}
5147 {setTimeout(function() { press("a2")}, 250);}
5148 {setTimeout(function() { press("b2")}, 500);}
5149 {setTimeout(function() { press("c3")}, 750);}
5150 {setTimeout(function() { press("d3")}, 1000);}
5151 {setTimeout(function() { press("e3")}, 1250);}
5152 {setTimeout(function() { press("fs3")}, 1500);}
5153 {setTimeout(function() { press("g3")}, 1750);}
5154 {setTimeout(function() { press("fs3")}, 2000);}
5155 {setTimeout(function() { press("e3")}, 2250);}
5156 {setTimeout(function() { press("d3")}, 2500);}
5157 {setTimeout(function() { press("c3")}, 2750);}
5158 {setTimeout(function() { press("b2")}, 3000);}
5159 {setTimeout(function() { press("a2")}, 3250);}
5160 {setTimeout(function() { press("g2")}, 3500);}
5161 {setTimeout(function() { press("g2"); press("b2"); press("d3"); press("g3")}, 4000);}
5162
5163 } else if (message.substring(0, 14).toLowerCase() == cmdChar+"scale gminor") { //G minor scale
5164 sendChat("The G minor scale - it has 1 sharps - its relative major is Bb");
5165 {setTimeout(function() { press("g2")}, 0);}
5166 {setTimeout(function() { press("a2")}, 250);}
5167 {setTimeout(function() { press("as2")}, 500);}
5168 {setTimeout(function() { press("c3")}, 750);}
5169 {setTimeout(function() { press("d3")}, 1000);}
5170 {setTimeout(function() { press("ds3")}, 1250);}
5171 {setTimeout(function() { press("f3")}, 1500);}
5172 {setTimeout(function() { press("g3")}, 1750);}
5173 {setTimeout(function() { press("f3")}, 2000);}
5174 {setTimeout(function() { press("ds3")}, 2250);}
5175 {setTimeout(function() { press("d3")}, 2500);}
5176 {setTimeout(function() { press("c3")}, 2750);}
5177 {setTimeout(function() { press("as2")}, 3000);}
5178 {setTimeout(function() { press("a2")}, 3250);}
5179 {setTimeout(function() { press("g2")}, 3500);}
5180 {setTimeout(function() { press("g2"); press("as2"); press("d3"); press("g3")}, 4000);}
5181
5182 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale gharminor") { //G harmonic minor scale
5183 sendChat("The G harmonic minor scale - it has 3 sharps - it has a major 7th (F#)");
5184 {setTimeout(function() { press("g2")}, 0);}
5185 {setTimeout(function() { press("a2")}, 250);}
5186 {setTimeout(function() { press("as2")}, 500);}
5187 {setTimeout(function() { press("c3")}, 750);}
5188 {setTimeout(function() { press("d3")}, 1000);}
5189 {setTimeout(function() { press("ds3")}, 1250);}
5190 {setTimeout(function() { press("fs3")}, 1500);}
5191 {setTimeout(function() { press("g3")}, 1750);}
5192 {setTimeout(function() { press("fs3")}, 2000);}
5193 {setTimeout(function() { press("ds3")}, 2250);}
5194 {setTimeout(function() { press("d3")}, 2500);}
5195 {setTimeout(function() { press("c3")}, 2750);}
5196 {setTimeout(function() { press("as2")}, 3000);}
5197 {setTimeout(function() { press("a2")}, 3250);}
5198 {setTimeout(function() { press("g2")}, 3500);}
5199 {setTimeout(function() { press("g2"); press("as2"); press("d3"); press("g3")}, 4000);}
5200
5201 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale gmelminor") { //G melodic minor scale
5202 sendChat("The G melodic minor scale - it has 1 sharp ascending and 2 sharps descending - it has two patterns ascending and descending.");
5203 {setTimeout(function() { press("g2")}, 0);}
5204 {setTimeout(function() { press("a2")}, 250);}
5205 {setTimeout(function() { press("as2")}, 500);}
5206 {setTimeout(function() { press("c3")}, 750);}
5207 {setTimeout(function() { press("d3")}, 1000);}
5208 {setTimeout(function() { press("e3")}, 1250);}
5209 {setTimeout(function() { press("fs3")}, 1500);}
5210 {setTimeout(function() { press("g3")}, 1750);}
5211 {setTimeout(function() { press("f3")}, 2000);}
5212 {setTimeout(function() { press("ds3")}, 2250);}
5213 {setTimeout(function() { press("d3")}, 2500);}
5214 {setTimeout(function() { press("c3")}, 2750);}
5215 {setTimeout(function() { press("as2")}, 3000);}
5216 {setTimeout(function() { press("a2")}, 3250);}
5217 {setTimeout(function() { press("g2")}, 3500);}
5218 {setTimeout(function() { press("g2"); press("as2"); press("d3"); press("g3")}, 4000);}
5219 //G scales
5220
5221 //Ab Scales
5222 } else if (message.substring(0, 14).toLowerCase() == cmdChar+"scale abmajor") { //Ab major scale
5223 sendChat("The Ab (flat) major scale - it has 4 flats - its relative minor is F");
5224 {setTimeout(function() { press("gs2")}, 0);}
5225 {setTimeout(function() { press("as2")}, 250);}
5226 {setTimeout(function() { press("c3")}, 500);}
5227 {setTimeout(function() { press("cs3")}, 750);}
5228 {setTimeout(function() { press("ds3")}, 1000);}
5229 {setTimeout(function() { press("f3")}, 1250);}
5230 {setTimeout(function() { press("g3")}, 1500);}
5231 {setTimeout(function() { press("gs3")}, 1750);}
5232 {setTimeout(function() { press("g3")}, 2000);}
5233 {setTimeout(function() { press("f3")}, 2250);}
5234 {setTimeout(function() { press("ds3")}, 2500);}
5235 {setTimeout(function() { press("cs3")}, 2750);}
5236 {setTimeout(function() { press("c3")}, 3000);}
5237 {setTimeout(function() { press("as2")}, 3250);}
5238 {setTimeout(function() { press("gs2")}, 3500);}
5239 {setTimeout(function() { press("gs2"); press("c3"); press("ds3"); press("gs3")}, 4000);}
5240
5241 } else if (message.substring(0, 15).toLowerCase() == cmdChar+"scale abminor") { //Ab minor scale
5242 sendChat("The Ab (flat) minor scale - it has 7 flats - its relative major is Cb major or enharmonically, B major");
5243 {setTimeout(function() { press("gs2")}, 0);}
5244 {setTimeout(function() { press("as2")}, 250);}
5245 {setTimeout(function() { press("b2")}, 500);}
5246 {setTimeout(function() { press("cs3")}, 750);}
5247 {setTimeout(function() { press("ds3")}, 1000);}
5248 {setTimeout(function() { press("e3")}, 1250);}
5249 {setTimeout(function() { press("fs3")}, 1500);}
5250 {setTimeout(function() { press("gs3")}, 1750);}
5251 {setTimeout(function() { press("fs3")}, 2000);}
5252 {setTimeout(function() { press("e3")}, 2250);}
5253 {setTimeout(function() { press("ds3")}, 2500);}
5254 {setTimeout(function() { press("cs3")}, 2750);}
5255 {setTimeout(function() { press("b2")}, 3000);}
5256 {setTimeout(function() { press("as2")}, 3250);}
5257 {setTimeout(function() { press("gs2")}, 3500);}
5258 {setTimeout(function() { press("gs2"); press("b2"); press("ds3"); press("gs3")}, 4000);}
5259
5260 } else if (message.substring(0, 17).toLowerCase() == cmdChar+"scale abharminor") { //Ab harmonic minor scale
5261 sendChat("The Ab (flat) harmonic minor scale - it has 4 flats - it has a major 7th (G)");
5262 {setTimeout(function() { press("gs2")}, 0);}
5263 {setTimeout(function() { press("as2")}, 250);}
5264 {setTimeout(function() { press("b2")}, 500);}
5265 {setTimeout(function() { press("cs3")}, 750);}
5266 {setTimeout(function() { press("ds3")}, 1000);}
5267 {setTimeout(function() { press("e3")}, 1250);}
5268 {setTimeout(function() { press("g3")}, 1500);}
5269 {setTimeout(function() { press("gs3")}, 1750);}
5270 {setTimeout(function() { press("g3")}, 2000);}
5271 {setTimeout(function() { press("e3")}, 2250);}
5272 {setTimeout(function() { press("ds3")}, 2500);}
5273 {setTimeout(function() { press("cs3")}, 2750);}
5274 {setTimeout(function() { press("b2")}, 3000);}
5275 {setTimeout(function() { press("as2")}, 3250);}
5276 {setTimeout(function() { press("gs2")}, 3500);}
5277 {setTimeout(function() { press("gs2"); press("b2"); press("ds3"); press("gs3")}, 4000);}
5278
5279 } else if (message.substring(0, 17).toLowerCase() == cmdChar+"scale abmelminor") { //Ab melodic minor scale
5280 sendChat("The Ab (flat) melodic minor scale - it has 3 flats ascending and 4 flats descending - it has two patterns ascending and descending.");
5281 {setTimeout(function() { press("gs2")}, 0);}
5282 {setTimeout(function() { press("as2")}, 250);}
5283 {setTimeout(function() { press("b2")}, 500);}
5284 {setTimeout(function() { press("cs3")}, 750);}
5285 {setTimeout(function() { press("ds3")}, 1000);}
5286 {setTimeout(function() { press("f3")}, 1250);}
5287 {setTimeout(function() { press("g3")}, 1500);}
5288 {setTimeout(function() { press("gs3")}, 1750);}
5289 {setTimeout(function() { press("fs3")}, 2000);}
5290 {setTimeout(function() { press("e3")}, 2250);}
5291 {setTimeout(function() { press("ds3")}, 2500);}
5292 {setTimeout(function() { press("cs3")}, 2750);}
5293 {setTimeout(function() { press("b2")}, 3000);}
5294 {setTimeout(function() { press("as2")}, 3250);}
5295 {setTimeout(function() { press("gs2")}, 3500);}
5296 {setTimeout(function() { press("gs2"); press("b2"); press("ds3"); press("gs3")}, 4000);}
5297 //Ab Scales
5298
5299 //A Scales
5300 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"scale amajor") { //A major scale
5301 sendChat("The A major scale - it has 3 sharps - its relative minor is F#");
5302 {setTimeout(function() { press("a2")}, 0);}
5303 {setTimeout(function() { press("b2")}, 250);}
5304 {setTimeout(function() { press("cs3")}, 500);}
5305 {setTimeout(function() { press("d3")}, 750);}
5306 {setTimeout(function() { press("e3")}, 1000);}
5307 {setTimeout(function() { press("fs3")}, 1250);}
5308 {setTimeout(function() { press("gs3")}, 1500);}
5309 {setTimeout(function() { press("a3")}, 1750);}
5310 {setTimeout(function() { press("gs3")}, 2000);}
5311 {setTimeout(function() { press("fs3")}, 2250);}
5312 {setTimeout(function() { press("e3")}, 2500);}
5313 {setTimeout(function() { press("d3")}, 2750);}
5314 {setTimeout(function() { press("cs3")}, 3000);}
5315 {setTimeout(function() { press("b2")}, 3250);}
5316 {setTimeout(function() { press("a2")}, 3500);}
5317 {setTimeout(function() { press("a2"); press("cs3"); press("e3"); press("a3")}, 4000);}
5318
5319 } else if (message.substring(0, 14).toLowerCase() == cmdChar+"scale aminor") { //A minor scale
5320 sendChat("The A minor scale - it has no sharps or flats - its relative major is C major");
5321 {setTimeout(function() { press("a2")}, 0);}
5322 {setTimeout(function() { press("b2")}, 250);}
5323 {setTimeout(function() { press("c3")}, 500);}
5324 {setTimeout(function() { press("d3")}, 750);}
5325 {setTimeout(function() { press("e3")}, 1000);}
5326 {setTimeout(function() { press("f3")}, 1250);}
5327 {setTimeout(function() { press("g3")}, 1500);}
5328 {setTimeout(function() { press("a3")}, 1750);}
5329 {setTimeout(function() { press("g3")}, 2000);}
5330 {setTimeout(function() { press("f3")}, 2250);}
5331 {setTimeout(function() { press("e3")}, 2500);}
5332 {setTimeout(function() { press("d3")}, 2750);}
5333 {setTimeout(function() { press("c3")}, 3000);}
5334 {setTimeout(function() { press("b2")}, 3250);}
5335 {setTimeout(function() { press("a2")}, 3500);}
5336 {setTimeout(function() { press("a2"); press("c3"); press("e3"); press("a3")}, 4000);}
5337
5338 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale aharminor") { //A harmonic minor scale
5339 sendChat("The A harmonic minor scale - it has 1 flat - it has a major 7th (G#)");
5340 {setTimeout(function() { press("a2")}, 0);}
5341 {setTimeout(function() { press("b2")}, 250);}
5342 {setTimeout(function() { press("cs3")}, 500);}
5343 {setTimeout(function() { press("d3")}, 750);}
5344 {setTimeout(function() { press("e3")}, 1000);}
5345 {setTimeout(function() { press("fs3")}, 1250);}
5346 {setTimeout(function() { press("gs3")}, 1500);}
5347 {setTimeout(function() { press("a3")}, 1750);}
5348 {setTimeout(function() { press("gs3")}, 2000);}
5349 {setTimeout(function() { press("fs3")}, 2250);}
5350 {setTimeout(function() { press("e3")}, 2500);}
5351 {setTimeout(function() { press("d3")}, 2750);}
5352 {setTimeout(function() { press("cs3")}, 3000);}
5353 {setTimeout(function() { press("b2")}, 3250);}
5354 {setTimeout(function() { press("a2")}, 3500);}
5355 {setTimeout(function() { press("a2"); press("cs3"); press("e3"); press("a3")}, 4000);}
5356
5357 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale amelminor") { //A melodic minor scale
5358 sendChat("The A melodic minor scale - it has 2 sharps ascending and 0 sharps descending - it has two patterns ascending and descending.");
5359 {setTimeout(function() { press("a2")}, 0);}
5360 {setTimeout(function() { press("b2")}, 250);}
5361 {setTimeout(function() { press("c3")}, 500);}
5362 {setTimeout(function() { press("d3")}, 750);}
5363 {setTimeout(function() { press("e3")}, 1000);}
5364 {setTimeout(function() { press("fs3")}, 1250);}
5365 {setTimeout(function() { press("gs3")}, 1500);}
5366 {setTimeout(function() { press("a3")}, 1750);}
5367 {setTimeout(function() { press("g3")}, 2000);}
5368 {setTimeout(function() { press("f3")}, 2250);}
5369 {setTimeout(function() { press("e3")}, 2500);}
5370 {setTimeout(function() { press("d3")}, 2750);}
5371 {setTimeout(function() { press("c3")}, 3000);}
5372 {setTimeout(function() { press("b2")}, 3250);}
5373 {setTimeout(function() { press("a2")}, 3500);}
5374 {setTimeout(function() { press("a2"); press("c3"); press("e3"); press("a3")}, 4000);}
5375 //A Scales
5376
5377 //Bb Scales
5378 } else if (message.substring(0, 14).toLowerCase() == cmdChar+"scale bbmajor") { //Bb major scale
5379 sendChat("The Bb (flat) major scale - it has 2 flats - its relative minor is G");
5380 {setTimeout(function() { press("as2")}, 0);}
5381 {setTimeout(function() { press("c3")}, 250);}
5382 {setTimeout(function() { press("d3")}, 500);}
5383 {setTimeout(function() { press("ds3")}, 750);}
5384 {setTimeout(function() { press("f3")}, 1000);}
5385 {setTimeout(function() { press("g3")}, 1250);}
5386 {setTimeout(function() { press("a3")}, 1500);}
5387 {setTimeout(function() { press("as3")}, 1750);}
5388 {setTimeout(function() { press("a3")}, 2000);}
5389 {setTimeout(function() { press("g3")}, 2250);}
5390 {setTimeout(function() { press("f3")}, 2500);}
5391 {setTimeout(function() { press("ds3")}, 2750);}
5392 {setTimeout(function() { press("d3")}, 3000);}
5393 {setTimeout(function() { press("c3")}, 3250);}
5394 {setTimeout(function() { press("as2")}, 3500);}
5395 {setTimeout(function() { press("as2"); press("d3"); press("f3"); press("as3")}, 4000);}
5396
5397 } else if (message.substring(0, 15).toLowerCase() == cmdChar+"scale bbminor") { //Bb minor scale
5398 sendChat("The Bb (flat) minor scale - it 6 flats - its relative major is Db major");
5399 {setTimeout(function() { press("as2")}, 0);}
5400 {setTimeout(function() { press("c3")}, 250);}
5401 {setTimeout(function() { press("cs3")}, 500);}
5402 {setTimeout(function() { press("ds3")}, 750);}
5403 {setTimeout(function() { press("f3")}, 1000);}
5404 {setTimeout(function() { press("fs3")}, 1250);}
5405 {setTimeout(function() { press("gs3")}, 1500);}
5406 {setTimeout(function() { press("as3")}, 1750);}
5407 {setTimeout(function() { press("gs3")}, 2000);}
5408 {setTimeout(function() { press("fs3")}, 2250);}
5409 {setTimeout(function() { press("f3")}, 2500);}
5410 {setTimeout(function() { press("ds3")}, 2750);}
5411 {setTimeout(function() { press("cs3")}, 3000);}
5412 {setTimeout(function() { press("c3")}, 3250);}
5413 {setTimeout(function() { press("as2")}, 3500);}
5414 {setTimeout(function() { press("as2"); press("cs3"); press("f3"); press("as3")}, 4000);}
5415
5416 } else if (message.substring(0, 17).toLowerCase() == cmdChar+"scale bbharminor") { //Bb harmonic minor scale
5417 sendChat("The Bb (flat) harmonic minor scale - it has 5 flats - it has a major 7th (A)");
5418 {setTimeout(function() { press("as2")}, 0);}
5419 {setTimeout(function() { press("c3")}, 250);}
5420 {setTimeout(function() { press("cs3")}, 500);}
5421 {setTimeout(function() { press("ds3")}, 750);}
5422 {setTimeout(function() { press("f3")}, 1000);}
5423 {setTimeout(function() { press("fs3")}, 1250);}
5424 {setTimeout(function() { press("a3")}, 1500);}
5425 {setTimeout(function() { press("as3")}, 1750);}
5426 {setTimeout(function() { press("a3")}, 2000);}
5427 {setTimeout(function() { press("fs3")}, 2250);}
5428 {setTimeout(function() { press("f3")}, 2500);}
5429 {setTimeout(function() { press("ds3")}, 2750);}
5430 {setTimeout(function() { press("cs3")}, 3000);}
5431 {setTimeout(function() { press("c3")}, 3250);}
5432 {setTimeout(function() { press("as2")}, 3500);}
5433 {setTimeout(function() { press("as2"); press("cs3"); press("f3"); press("as3")}, 4000);}
5434
5435 } else if (message.substring(0, 17).toLowerCase() == cmdChar+"scale bbmelminor") { //Bb melodic minor scale
5436 sendChat("The Bb (flat) melodic minor scale - it has 4 flat ascending and 6 sharps descending - it has two patterns ascending and descending.");
5437 {setTimeout(function() { press("as2")}, 0);}
5438 {setTimeout(function() { press("c3")}, 250);}
5439 {setTimeout(function() { press("cs3")}, 500);}
5440 {setTimeout(function() { press("ds3")}, 750);}
5441 {setTimeout(function() { press("f3")}, 1000);}
5442 {setTimeout(function() { press("g3")}, 1250);}
5443 {setTimeout(function() { press("a3")}, 1500);}
5444 {setTimeout(function() { press("as3")}, 1750);}
5445 {setTimeout(function() { press("gs3")}, 2000);}
5446 {setTimeout(function() { press("fs3")}, 2250);}
5447 {setTimeout(function() { press("f3")}, 2500);}
5448 {setTimeout(function() { press("ds3")}, 2750);}
5449 {setTimeout(function() { press("cs3")}, 3000);}
5450 {setTimeout(function() { press("c3")}, 3250);}
5451 {setTimeout(function() { press("as2")}, 3500);}
5452 {setTimeout(function() { press("as2"); press("cs3"); press("f3"); press("as3")}, 4000);}
5453 //Bb Scales
5454
5455 //B Scales
5456 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"scale bmajor") { //B major scale
5457 sendChat("The B major scale - it has 5 sharps - its relative minor is G#");
5458 {setTimeout(function() { press("b2")}, 0);}
5459 {setTimeout(function() { press("cs3")}, 250);}
5460 {setTimeout(function() { press("ds3")}, 500);}
5461 {setTimeout(function() { press("e3")}, 750);}
5462 {setTimeout(function() { press("fs3")}, 1000);}
5463 {setTimeout(function() { press("gs3")}, 1250);}
5464 {setTimeout(function() { press("as3")}, 1500);}
5465 {setTimeout(function() { press("b3")}, 1750);}
5466 {setTimeout(function() { press("as3")}, 2000);}
5467 {setTimeout(function() { press("gs3")}, 2250);}
5468 {setTimeout(function() { press("fs3")}, 2500);}
5469 {setTimeout(function() { press("e3")}, 2750);}
5470 {setTimeout(function() { press("ds3")}, 3000);}
5471 {setTimeout(function() { press("cs3")}, 3250);}
5472 {setTimeout(function() { press("b2")}, 3500);}
5473 {setTimeout(function() { press("b2"); press("ds3"); press("fs3"); press("b3")}, 4000);}
5474
5475 } else if (message.substring(0, 14).toLowerCase() == cmdChar+"scale bminor") { //B minor scale
5476 sendChat("The B minor scale - it 2 sharps - its relative major is D major");
5477 {setTimeout(function() { press("b2")}, 0);}
5478 {setTimeout(function() { press("cs3")}, 250);}
5479 {setTimeout(function() { press("d3")}, 500);}
5480 {setTimeout(function() { press("e3")}, 750);}
5481 {setTimeout(function() { press("fs3")}, 1000);}
5482 {setTimeout(function() { press("g3")}, 1250);}
5483 {setTimeout(function() { press("a3")}, 1500);}
5484 {setTimeout(function() { press("b3")}, 1750);}
5485 {setTimeout(function() { press("a3")}, 2000);}
5486 {setTimeout(function() { press("g3")}, 2250);}
5487 {setTimeout(function() { press("fs3")}, 2500);}
5488 {setTimeout(function() { press("e3")}, 2750);}
5489 {setTimeout(function() { press("d3")}, 3000);}
5490 {setTimeout(function() { press("cs3")}, 3250);}
5491 {setTimeout(function() { press("b2")}, 3500);}
5492 {setTimeout(function() { press("b2"); press("d3"); press("fs3"); press("b3")}, 4000);}
5493
5494 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale bharminor") { //B harmonic minor scale
5495 sendChat("The B harmonic minor scale - it has 3 sharps - it has a major 7th (A#)");
5496 {setTimeout(function() { press("b2")}, 0);}
5497 {setTimeout(function() { press("cs3")}, 250);}
5498 {setTimeout(function() { press("d3")}, 500);}
5499 {setTimeout(function() { press("e3")}, 750);}
5500 {setTimeout(function() { press("fs3")}, 1000);}
5501 {setTimeout(function() { press("g3")}, 1250);}
5502 {setTimeout(function() { press("as3")}, 1500);}
5503 {setTimeout(function() { press("b3")}, 1750);}
5504 {setTimeout(function() { press("as3")}, 2000);}
5505 {setTimeout(function() { press("g3")}, 2250);}
5506 {setTimeout(function() { press("fs3")}, 2500);}
5507 {setTimeout(function() { press("e3")}, 2750);}
5508 {setTimeout(function() { press("d3")}, 3000);}
5509 {setTimeout(function() { press("cs3")}, 3250);}
5510 {setTimeout(function() { press("b2")}, 3500);}
5511 {setTimeout(function() { press("b2"); press("d3"); press("fs3"); press("b3")}, 4000);}
5512
5513 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale bmelminor") { //B melodic minor scale
5514 sendChat("The B melodic minor scale - it has 4 sharps ascending and 2 sharps descending - it has two patterns ascending and descending.");
5515 {setTimeout(function() { press("b2")}, 0);}
5516 {setTimeout(function() { press("cs3")}, 250);}
5517 {setTimeout(function() { press("d3")}, 500);}
5518 {setTimeout(function() { press("e3")}, 750);}
5519 {setTimeout(function() { press("fs3")}, 1000);}
5520 {setTimeout(function() { press("gs3")}, 1250);}
5521 {setTimeout(function() { press("as3")}, 1500);}
5522 {setTimeout(function() { press("b3")}, 1750);}
5523 {setTimeout(function() { press("a3")}, 2000);}
5524 {setTimeout(function() { press("g3")}, 2250);}
5525 {setTimeout(function() { press("fs3")}, 2500);}
5526 {setTimeout(function() { press("e3")}, 2750);}
5527 {setTimeout(function() { press("d3")}, 3000);}
5528 {setTimeout(function() { press("cs3")}, 3250);}
5529 {setTimeout(function() { press("b2")}, 3500);}
5530 {setTimeout(function() { press("b2"); press("d3"); press("fs3"); press("b3")}, 4000);}
5531 //B Scales
5532 //scales
5533
5534 //glossary
5535 } else if (cmd == cmdChar+"glossary") { //Glossary
5536 sendChat("Music theory glossary: "+cmdChar+"arpeggio, "+cmdChar+"glissando [Unfinished!!]");
5537
5538 //Arpeggio
5539 } else if (cmd == cmdChar+"arpeggio") { //Arpeggio
5540 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\".");
5541 {setTimeout(function() { press("c0")}, 0);} //octave
5542 {setTimeout(function() { press("ds0")}, 200);}
5543 {setTimeout(function() { press("g0")}, 400);}
5544 {setTimeout(function() { press("c1")}, 600);} //octave
5545 {setTimeout(function() { press("ds1")}, 800);}
5546 {setTimeout(function() { press("g1")}, 1000);}
5547 {setTimeout(function() { press("c2")}, 1200);} //octave
5548 {setTimeout(function() { press("ds2")}, 1400);}
5549 {setTimeout(function() { press("g2")}, 1600);}
5550 {setTimeout(function() { press("c3")}, 1800);} //octave
5551 {setTimeout(function() { press("ds3")}, 2000);}
5552 {setTimeout(function() { press("g3")}, 2200);}
5553 {setTimeout(function() { press("c4")}, 2400);} //octave
5554 {setTimeout(function() { press("ds4")}, 2600);}
5555 {setTimeout(function() { press("g4")}, 2800);}
5556 {setTimeout(function() { press("c5")}, 3000);} //octave
5557 {setTimeout(function() { press("ds5")}, 3200);}
5558 {setTimeout(function() { press("g5")}, 3400);}
5559 {setTimeout(function() { press("c6")}, 3600);} //octave
5560 {setTimeout(function() { press("ds6")}, 3800);}
5561 {setTimeout(function() { press("g6")}, 4000);}
5562 {setTimeout(function() { press("c7")}, 4200);} //octave
5563 //Arpeggio
5564
5565 //Glissando
5566 } else if (cmd == cmdChar+"glissando") { //Glissando
5567 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.");
5568 {setTimeout(function() { press("a-1")}, 100);}
5569 {setTimeout(function() { press("b-1")}, 200);}
5570 {setTimeout(function() { press("c0")}, 300);}
5571 {setTimeout(function() { press("d0")}, 400);}
5572 {setTimeout(function() { press("e0")}, 500);}
5573 {setTimeout(function() { press("f0")}, 600);}
5574 {setTimeout(function() { press("g0")}, 700);}
5575 {setTimeout(function() { press("a0")}, 800);}
5576 {setTimeout(function() { press("b0")}, 900);}
5577 {setTimeout(function() { press("c1")}, 1000);}
5578 {setTimeout(function() { press("d1")}, 1100);}
5579 {setTimeout(function() { press("e1")}, 1200);}
5580 {setTimeout(function() { press("f1")}, 1300);}
5581 {setTimeout(function() { press("g1")}, 1400);}
5582 {setTimeout(function() { press("a1")}, 1500);}
5583 {setTimeout(function() { press("b1")}, 1600);}
5584 {setTimeout(function() { press("c2")}, 1700);}
5585 {setTimeout(function() { press("d2")}, 1800);}
5586 {setTimeout(function() { press("e2")}, 1900);}
5587 {setTimeout(function() { press("f2")}, 2000);}
5588 {setTimeout(function() { press("g2")}, 2100);}
5589 {setTimeout(function() { press("a2")}, 2200);}
5590 {setTimeout(function() { press("b2")}, 2300);}
5591 {setTimeout(function() { press("c3")}, 2400);}
5592 {setTimeout(function() { press("d3")}, 2500);}
5593 {setTimeout(function() { press("e3")}, 2600);}
5594 {setTimeout(function() { press("f3")}, 2700);}
5595 {setTimeout(function() { press("g3")}, 2800);}
5596 {setTimeout(function() { press("a3")}, 2900);}
5597 {setTimeout(function() { press("b3")}, 3000);}
5598 {setTimeout(function() { press("c4")}, 3100);}
5599 {setTimeout(function() { press("d4")}, 3200);}
5600 {setTimeout(function() { press("e4")}, 3300);}
5601 {setTimeout(function() { press("f4")}, 3400);}
5602 {setTimeout(function() { press("g4")}, 3500);}
5603 {setTimeout(function() { press("a4")}, 3600);}
5604 {setTimeout(function() { press("b4")}, 3700);}
5605 {setTimeout(function() { press("c5")}, 3800);}
5606 {setTimeout(function() { press("d5")}, 3900);}
5607 {setTimeout(function() { press("e5")}, 4000);}
5608 {setTimeout(function() { press("f5")}, 4100);}
5609 {setTimeout(function() { press("g5")}, 4200);}
5610 {setTimeout(function() { press("a5")}, 4300);}
5611 {setTimeout(function() { press("b5")}, 4400);}
5612 {setTimeout(function() { press("c6")}, 4500);}
5613 {setTimeout(function() { press("d6")}, 4600);}
5614 {setTimeout(function() { press("e6")}, 4700);}
5615 {setTimeout(function() { press("f6")}, 4800);}
5616 {setTimeout(function() { press("g6")}, 4900);}
5617 {setTimeout(function() { press("a6")}, 5000);}
5618 {setTimeout(function() { press("b6")}, 5100);}
5619 {setTimeout(function() { press("c7")}, 5200);}
5620 //Glissando
5621
5622 //Glossary
5623
5624 //Music theory
5625
5626 //Meow game
5627 } else if (cmd == cmdChar+"mp") {
5628 if (message.length == cmd.length) {
5629 // Check if user is in Database
5630 mUser = MDB[ids];
5631
5632 // If user isn't create a new entry
5633 if (!mUser) {
5634 mUser = MDB[ids] = {
5635 name: name,
5636 meowP: 0,
5637 meowRate: 1,
5638 meowTime: 0,
5639 meowing: false,
5640 cheeseMaster: false,
5641 inventory: {
5642 string: 1,
5643 yarn: 0,
5644 wool: 0,
5645 water: 0,
5646 milk: 0,
5647 bananaMilk: 0,
5648 cheese: 0
5649 },
5650 prices: {
5651 string: 50,
5652 yarn: 500,
5653 wool: 2000,
5654 water: 15000,
5655 milk: 50000,
5656 bananaMilk: 100000,
5657 cheese: 25000000000
5658 }
5659 };
5660
5661 // Start their timer (no clue if this is correct or what)
5662 setInterval(function() {
5663 MDB[ids].meowP += MDB[ids].meowRate;
5664 ++MDB[ids].meowTime;
5665 }, 1000);
5666
5667 MDB[ids].meowing = true;
5668 sendChat('✯ Meow! Welcome to Meowpuff, ' + name + '! (type '+cmdChar+'meow for help, if you\'re still confused ask Logan x3)✯');
5669 sendChat('MP [' + mUser.meowP + '] MP rate [' + mUser.meowRate + '] Time [' + mUser.meowTime + ' secs | ' + (mUser.meowTime / 86400).toPrecision(4) + ' days]');
5670
5671 } else {
5672 if (!MDB[ids].meowing) {
5673 setInterval(function() {
5674 MDB[ids].meowP += MDB[ids].meowRate;
5675 ++MDB[ids].meowTime;
5676 }, 1000);
5677 if (MDB[ids].cheeseMaster) {
5678 sendChat('Welcome back, [Cheese Master] ' + name + '! Stats successfully loaded.');
5679 } else {
5680 sendChat('Welcome back, ' + name + '. Stats successfully loaded.');
5681 }
5682 MDB[ids].meowing = true;
5683 }
5684
5685 // working ✓
5686 sendChat('MP [' + mUser.meowP + '] MP rate [' + mUser.meowRate + '] Time [' + mUser.meowTime + ' secs | ' + (mUser.meowTime / 86400).toPrecision(4) + ' days]');
5687 }
5688 //else they entered more information
5689 } else {
5690 var target = msg.a.substring(cmd.length).trim();
5691 var part = getUser(target.toLowerCase());
5692 if (part) {
5693 if (!MDB[part._id] || !MDB[part._id].meowing) {
5694 sendChat(part.name+ ' isn\'t playing Meowpuff. They need to type '+cmdChar+'mp to create or load a save');
5695 return;
5696 }
5697
5698 if (part.name == name) {
5699 sendChat('Your MP [' + MDB[ids].meowP + '] MP rate [' + MDB[ids].meowRate + '] Time [' + MDB[ids].meowTime + ' secs | ' + (MDB[ids].meowTime / 86400).toPrecision(4) + ' days]');
5700 return;
5701 }
5702 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]');
5703 } else {
5704 sendChat(userNotFound);
5705 }
5706 }
5707
5708 //Meow help
5709 } else if (cmd == cmdChar+"meow") {
5710 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 ✯');
5711 sendChat(''+cmdChar+'meow (shows help) '+cmdChar+'mp (starts game / shows stats after you have started and '+cmdChar+'mp name_here), \
5712 '+cmdChar+'meowshop ('+cmdChar+'mshop item_name_here visit The Cuddle Kitty shop to buy items to increase your MPS), \
5713 '+cmdChar+'meowinventory ('+cmdChar+'minv shows your Meow Points and purchased items and '+cmdChar+'minv name_here), \
5714 '+cmdChar+'meowsave ('+cmdChar+'msave saves game), \
5715 '+cmdChar+'meowtype ('+cmdChar+'mtype gives you a word challenge), \
5716 '+cmdChar+'meowstats ('+cmdChar+'mstats shows total stats for all players)');
5717 //Meow help
5718
5719 //Meow shop
5720 } else if (cmd == cmdChar+"meowshop" || cmd == cmdChar+"mshop") {
5721 if (!MDB[ids].meowing) {
5722 sendChat('You must start the game again with '+cmdChar+'mp before The Cuddle Kitty shop will let you in!');
5723 return;
5724 }
5725 if (message.substring(cmd.length).trim() == '') {
5726 //optimise
5727 if (gClient.isOwner()) sendChat('✯ Meow ' + name + '! Welcome to The Cuddle Kitty shop! If you need help type '+cmdChar+'meow :3 | MP [' + MDB[ids].meowP + '] ✯');
5728 sendChat(name +'\'s shop (string [' + MDB[ids].prices.string + ' MP] +1 MPS for each piece of string owned) \
5729 (yarn [' + MDB[ids].prices.yarn + ' MP] +10 MPS for each piece of yarn owned) \
5730 (wool [' + MDB[ids].prices.wool + ' MP] +40 MPS for each ball of wool owned) \
5731 (water [' + MDB[ids].prices.water + ' MP] +300 MPS for every bowl of water owned) \
5732 (milk [' + MDB[ids].prices.milk + ' MP] +1000 MPS for every tanker of milk owned) \
5733 (banana milk [' + MDB[ids].prices.bananaMilk + ' MP] +2000 MPS for every tanker of banana milk owned) \
5734 (cheese [' + MDB[ids].prices.cheese + ' MP] +2500000000 MPS for each piece of cheese owned)');
5735 return;
5736
5737 // string
5738 } else if (message.substring(cmd.length).trim() == 'string') {
5739 if (MDB[ids].meowP >= MDB[ids].prices.string) { //Do they have enough meow points?
5740 MDB[ids].meowP -= MDB[ids].prices.string; //Take correct price away
5741 MDB[ids].prices.string += 5 * (MDB[ids].inventory.string) + 50; //Up price next time, might make more cruel
5742 MDB[ids].meowRate += 1; //Add the MPS
5743 MDB[ids].inventory.string += 1; //Add the string to inv
5744 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 + ']');
5745 } else { //They don't have enough meow points
5746 //return a positive number
5747 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 + ']');
5748 }
5749
5750 // yarn
5751 } else if (message.substring(cmd.length).trim() == 'yarn') {
5752 if (MDB[ids].meowP >= MDB[ids].prices.yarn) {
5753 MDB[ids].meowP -= MDB[ids].prices.yarn;
5754 MDB[ids].prices.yarn += 50 * (MDB[ids].inventory.yarn) + 500;
5755 MDB[ids].meowRate += 10;
5756 MDB[ids].inventory.yarn += 1;
5757 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 + ']');
5758 } else {
5759 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 + ']');
5760 }
5761
5762 // wool
5763 } else if (message.substring(cmd.length).trim() == 'wool') {
5764 if (MDB[ids].meowP >= MDB[ids].prices.wool) {
5765 MDB[ids].meowP -= MDB[ids].prices.wool;
5766 MDB[ids].prices.wool += 200 * (MDB[ids].inventory.wool) + 2000;
5767 MDB[ids].meowRate += 40;
5768 MDB[ids].inventory.wool += 1;
5769 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 + ']');
5770 } else {
5771 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 + ']');
5772 }
5773
5774 // water
5775 } else if (message.substring(cmd.length).trim() == 'water') {
5776 if (MDB[ids].meowP >= MDB[ids].prices.water) {
5777 MDB[ids].meowP -= MDB[ids].prices.water;
5778 MDB[ids].prices.water += 1500 * (MDB[ids].inventory.water) + 15000;
5779 MDB[ids].meowRate += 300;
5780 MDB[ids].inventory.water += 1;
5781 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 + ']');
5782 } else {
5783 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 + ']');
5784 }
5785
5786 // milk
5787 } else if (message.substring(cmd.length).trim() == 'milk') {
5788 if (MDB[ids].meowP >= MDB[ids].prices.milk) {
5789 MDB[ids].meowP -= MDB[ids].prices.milk;
5790 MDB[ids].prices.milk += 5000 * (MDB[ids].inventory.milk) + 50000;
5791 MDB[ids].meowRate += 1000;
5792 MDB[ids].inventory.milk += 1;
5793 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 + ']');
5794 } else {
5795 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 + ']');
5796 }
5797
5798 // banana milk
5799 } else if (message.substring(cmd.length).trim() == 'banana milk') {
5800 if (MDB[ids].meowP >= MDB[ids].prices.bananaMilk) {
5801 MDB[ids].meowP -= MDB[ids].prices.bananaMilk;
5802 MDB[ids].prices.bananaMilk += 10000 * (MDB[ids].inventory.bananaMilk) + 100000;
5803 MDB[ids].meowRate += 2000;
5804 MDB[ids].inventory.bananaMilk += 1;
5805 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 + ']');
5806 } else {
5807 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 + ']');
5808 }
5809
5810 // cheese
5811 } else if (message.substring(cmd.length).trim() == 'cheese') {
5812 if (MDB[ids].meowP >= MDB[ids].prices.cheese) {
5813 MDB[ids].meowP -= MDB[ids].prices.cheese;
5814 MDB[ids].prices.cheese += 2500000000 * (MDB[ids].inventory.cheese) + 25000000000;
5815 MDB[ids].meowRate += 500000000;
5816 MDB[ids].inventory.cheese += 1;
5817 MDB[ids].cheeseMaster = true;
5818 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 + '] ✯');
5819 } else {
5820 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 + ']');
5821 }
5822 }
5823
5824 //item prices: 250000
5825
5826 // kitty storage
5827 } else if (cmd == cmdChar+"meowinventory" || cmd == cmdChar+"minv") {
5828 if (message.length == cmd.length) {
5829 if (!MDB[ids].meowing) {
5830 sendChat('You must start the game again with '+cmdChar+'mp before kitty storage is setup!');
5831 return;
5832 }
5833 if(gClient.isOwner()) sendChat('✯ Meow! Welcome to Kitty Storage! This is where we keep all your purchased items :3 MP [' + MDB[ids].meowP + '] ✯');
5834 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 + ')');
5835
5836 } else {
5837 var target = msg.a.substring(cmd.length).trim();
5838 var part = getUser(target.toLowerCase());
5839
5840 if (part) {
5841 if (!MDB[part._id] || !MDB[part._id].meowing) {
5842 sendChat(part.name+ ' isn\'t playing Meowpuff. They need to type '+cmdChar+'mp to create or load a save');
5843 return;
5844 }
5845
5846 if (part.name == name) {
5847 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 + ')');
5848 return;
5849 }
5850 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 + ')');
5851
5852 } else {
5853 sendChat(userNotFound);
5854 }
5855 }
5856 //Meow save
5857 } 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!
5858 try {
5859 L.MDB = MDB.toString(); //saves everyone for simplicity
5860 // get the number of people playing
5861 var played = 0;
5862 var playing = 0;
5863 var totalDays = 0;
5864 for (var id in MDB) {
5865 if (MDB[id].meowing) ++playing;
5866 if (!MDB[id].meowing) ++played;
5867 totalDays += MDB[id].meowTime;
5868 }
5869
5870 sendChat('Everyones stats have been saved! [playing: ' + playing + ', total players: ' + played + ' | ' + (totalDays / 86400).toPrecision(4) + ' total days]');
5871
5872 } catch (e) {
5873 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
5874 }
5875 //Meow save
5876
5877 //Meow copy sentence mini-game
5878 } else if (cmd == cmdChar+"meowtype" || cmd == cmdChar+"mtype") {
5879 if (!askedEnglish) {
5880 Array.prototype.random = function(a){ //thanks SomeGuy for prototype
5881 if(this){
5882 var b = Math.floor(Math.random() * this.length);
5883 return this[b];
5884 }
5885 }
5886
5887 // arrays
5888 var colours = ["red", "orange", "yellow", "green", "blue", "purple", "gray", "black", "white"];
5889 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"];
5890 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"];
5891 var determiners = ["the", "a", "another", "some", "any", "my", "our", "their", "her", "his", "its", "each", "every", "certain", "this", "that"];
5892 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"];
5893 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"];
5894
5895 //consider cleaning up this code when you have free time
5896
5897 try {
5898 if (!hardEnglish) {
5899 //easy (normal)
5900 var str = determiners.random() + " " + adjectives.random() + " " + verbs.random() + " " + nouns.random() + " " + conjunctions.random() + " " + verbs.random() + " " + nouns.random() + " " + verbs.random() + ".";
5901 sentence = capitalizeFirstLetter(str);
5902 var antiCopy = sentence.split(" ").join(" \u034f\uFFFC");
5903 sentenceAntiCopy = capitalizeFirstLetter(antiCopy);
5904 }
5905 if (hardEnglish) {
5906 //hard (test)
5907 var str = randStr(hardLength);
5908 sentence = str;
5909 var antiCopy = sentence.split("").join("\u034f\uFFFC");
5910 sentenceAntiCopy = antiCopy;
5911 }
5912 sendChat("First person to type this wins: " + sentenceAntiCopy);
5913
5914 } catch(e) {
5915 sendChat('Error in my code: ' + e);
5916 }
5917 askedEnglish = true;
5918
5919 } else {
5920 sendChat("To answer, type the following in chat: " + sentenceAntiCopy);
5921 }
5922
5923 } else if (cmd == cmdChar+"mstats") {
5924 var mp = 0;
5925 var mr = 0;
5926
5927 var string = 0;
5928 var yarn = 0;
5929 var wool = 0;
5930 var water = 0;
5931 var milk = 0;
5932 var bananaMilk = 0;
5933 var cheese = 0;
5934
5935 for (var id in MDB) {
5936 mp += parseInt(MDB[id].meowP);
5937 mr += MDB[id].meowRate;
5938
5939 string += MDB[id].inventory.string;
5940 yarn += MDB[id].inventory.yarn;
5941 wool += MDB[id].inventory.wool;
5942 water += MDB[id].inventory.water;
5943 milk += MDB[id].inventory.milk;
5944 bananaMilk += MDB[id].inventory.bananaMilk;
5945 cheese += MDB[id].inventory.cheese;
5946 }
5947
5948 sendChat("Meowpuff total stats: MP ["+mp+"], MPS ["+mr+"], string ["+string+"], \
5949 yarn ["+yarn+"], wool ["+wool+"], water ["+water+"], milk ["+milk+"], \
5950 banana milk ["+bananaMilk+"], cheese ["+cheese+"].");
5951
5952 //Meow game
5953
5954 // Math *warning* messy code below, brace yourself.
5955 } else if (cmd == cmdChar+"mathhelp") {
5956 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)");
5957
5958 } else if (cmd == cmdChar+"mathdiff") {
5959 if (message.substring(9).trim() == "" || isNaN(message.substring(9).trim()) || message.substring(9).trim() < -1 || message.substring(9).trim() > 5) {
5960 sendChat("Usage: "+cmdChar+"mathdiff 1 (0 = very easy, 1 = easy, 2 = medium, 3 = hard, 4 = insane)");
5961 } else {
5962 mathDiff = message.substring(9).trim();
5963 if (mathDiff == 0) {
5964 mathDiffTxt = "Very Easy \"Piki-Mode\"";
5965 }
5966 if (mathDiff == 1) {
5967 mathDiffTxt = "Easy";
5968 }
5969 if (mathDiff == 2) {
5970 mathDiffTxt = "Medium";
5971 }
5972 if (mathDiff == 3) {
5973 mathDiffTxt = "Hard";
5974 }
5975 if (mathDiff == 4) {
5976 mathDiffTxt = "Insane";
5977 }
5978 if (mathDiff == 5) {
5979 mathDiffTxt = "Asian";
5980 }
5981 if (mathDiff == -1) {
5982 mathDiffTxt = "The Answer to Life, the Universe, and Everything *cough cough*";
5983 }
5984
5985 sendChat(name + " set the difficulty to " + mathDiffTxt);
5986 asked = false;
5987 }
5988
5989 } else if (cmd == cmdChar+"math") {
5990 if (message.length > 5 && !asked) {
5991 return; //might remove if typing !math 69 bringing up a questions seems easier
5992 }
5993 // difficulty settings
5994 if (mathDiff == 0) {
5995 questions = [randNum(1,10) + " + " + randNum(1,10),
5996 randNum(1,10) + " - " + randNum(1,10),
5997 randNum(1,10) + " - " + randNum(1,10)];
5998 pickQuestion = Math.floor( Math.random() * questions.length );
5999 }
6000
6001 if (mathDiff == 1) {
6002 questions = [randNum(1,50) + " + " + randNum(1,20),
6003 randNum(1,50) + " - " + randNum(1,10),
6004 randNum(1,20) + " * " + randNum(1,2),
6005 randNum(1,20) + " % " + randNum(1,2)];
6006 pickQuestion = Math.floor( Math.random() * questions.length );
6007 }
6008
6009 if (mathDiff == 2) {
6010 questions = [randNum(1,100) + " + " + randNum(1,20),
6011 randNum(1,100) + " - " + randNum(1,20),
6012 randNum(1,20) + " * " + randNum(1,10),
6013 randNum(1,50) + " % " + randNum(1,10)];
6014 pickQuestion = Math.floor( Math.random() * questions.length );
6015 }
6016
6017 if (mathDiff == 3) {
6018 questions = [randNum(1,400) + " + " + randNum(1,20),
6019 randNum(1,400) + " - " + randNum(1,300),
6020 randNum(1,100) + " * " + randNum(1,50),
6021 randNum(1,100) + " % " + randNum(1,50)];
6022 pickQuestion = Math.floor( Math.random() * questions.length );
6023 }
6024
6025 if (mathDiff == 4) {
6026 questions = [randNum(1,1000) + " + " + randNum(1,100),
6027 randNum(1,1000) + " - " + randNum(1,100),
6028 randNum(1,1000) + " * " + randNum(1,100)];
6029 pickQuestion = Math.floor( Math.random() * questions.length );
6030 }
6031
6032 if (mathDiff == 5) {
6033 questions = [randNum(-10000000,10000000) + " + " + randNum(-10000000,10000000),
6034 randNum(-10000000,10000000) + " - " + randNum(-10000000,10000000),
6035 randNum(-10000000,10000000) + " * " + randNum(-10000000,10000000),
6036 randNum(-10000000,10000000) + " / " + randNum(-10000000,10000000),
6037 randNum(-10000000,10000000) + " % " + randNum(-10000000,10000000)];
6038 pickQuestion = Math.floor( Math.random() * questions.length );
6039 }
6040
6041 if (mathDiff == -1) {
6042 questions = [randNum(1,400) + " + " + randNum(1,20),
6043 randNum(1,400) + " - " + randNum(1,300),
6044 randNum(1,400) + " * " + randNum(1,50)];
6045 pickQuestion = Math.floor( Math.random() * questions.length );
6046 }
6047
6048 // difficulty settings
6049 if (!asked) {
6050 // life easter egg
6051 if (mathDiff == -1) {
6052 question = questions[pickQuestion];
6053 while (eval(question) != 42) {
6054 questions = [randNum(1,400) + " + " + randNum(1,400),
6055 randNum(1,400) + " - " + randNum(1,400),
6056 randNum(1,400) + " * " + randNum(1,400)];
6057
6058 pickQuestion = Math.floor( Math.random() * questions.length );
6059 question = questions[pickQuestion];
6060 }
6061
6062 sendChat("What\u034f i\u034fs " + question + "\u034f? (to answer type "+cmdChar+"math <answer>). Difficulty - " + mathDiffTxt);
6063 asked = true;
6064
6065 // cheater >:3
6066 if (mathCheat) setTimeout( function() { MPP.chat.send(""+cmdChar+"math " + eval(question)) }, randNum(1000, 2500));
6067
6068 } else {
6069 question = questions[pickQuestion]; //fix impossible answers
6070 //sendChat("What is " + question + "? (to answer type !math <answer>). Difficulty - " + mathDiffTxt);
6071 sendChat("What\u034f i\u034fs " + question + "\u034f? (to answer type "+cmdChar+"math <answer>). Difficulty - " + mathDiffTxt);
6072 asked = true;
6073
6074 // cheater >:3
6075 if (mathCheat) setTimeout( function() { MPP.chat.send(""+cmdChar+"math " + eval(question)) }, randNum(1000, 2500));
6076 }
6077
6078 } else {
6079 if (message.substring(5).trim() == eval(question)) {
6080 sendChat(name + " answered correctly with " + message.substring(5).trim() + " on " + mathDiffTxt + " difficulty (questions answered " + ++mathAnswered +")");
6081 asked = false;
6082 } else {
6083 sendChat("Try again, " + name + ". The question was " + question + ". Too hard? Type "+cmdChar+"mathhelp");
6084 // cheater >:3
6085 if (mathCheat) setTimeout( function() { MPP.chat.send(cmdChar+"math " + eval(question)) }, randNum(1000, 2500));
6086 }
6087 }
6088
6089 } else if (cmd == cmdChar+"mathskip") {
6090 asked = false;
6091 sendChat("Skipping question. (questions skipped " + ++mathSkipped + ")");
6092
6093 } else if (cmd == cmdChar+"meth") {
6094 sendChat('Did you mean '+cmdChar+'"math"?');
6095
6096 // unit conversions start
6097
6098 } else if (cmd == cmdChar+"unitc") {
6099 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)");
6100
6101 // Celsius to Fahrenheit
6102 } else if (cmd == cmdChar+"ctof") {
6103 var fTemp = message.substring(6).trim() * (9 / 5) + 32;
6104 var outcome = fTemp.toString();
6105 if (message.substring(6).trim() == "" || isNaN(fTemp)) {
6106 sendChat("Usage: "+cmdChar+"ctof <unit> eg: 32.");
6107 } else {
6108 sendChat(message.substring(6).trim() + " Celsius equals: " + outcome.substring(0, 6) + " in Fahrenheit.");
6109 }
6110
6111 // Fahrenheit to Celsius
6112 } else if (cmd == cmdChar+"ftoc") {
6113 var cTemp = (message.substring(6).trim() - 32) * (5 / 9);
6114 var outcome = cTemp.toString();
6115 if (message.substring(6).trim() == "" || isNaN(cTemp)) {
6116 sendChat("Usage: "+cmdChar+"ftoc <unit> eg: 74.");
6117 } else {
6118 sendChat(message.substring(6).trim() + " Fahrenheit equals: " + outcome.substring(0, 6) + " in Celsius.");
6119 }
6120
6121 // Centimetres to Inches
6122 } else if (cmd == cmdChar+"cmtoinch") {
6123 var cmTemp = message.substring(10).trim() * 0.39370;
6124 var outcome = cmTemp.toString();
6125 if (message.substring(10).trim() == "" || isNaN(cmTemp)) {
6126 sendChat("Usage: "+cmdChar+"cmtoinch <unit> eg: 30.");
6127 } else {
6128 sendChat(message.substring(10).trim() + " Centimetres equals: " + outcome.substring(0, 6) + " inches.");
6129 }
6130
6131 // Inches to Centimetres
6132 } else if (cmd == cmdChar+"inchtocm") {
6133 var cmTemp = message.substring(10).trim() / 0.39370;
6134 var outcome = cmTemp.toString();
6135 if (message.substring(10).trim() == "" || isNaN(cmTemp)) {
6136 sendChat("Usage: "+cmdChar+"inches <unit> eg: 6.");
6137 } else {
6138 sendChat(message.substring(10).trim() + " Inches equals: " + outcome.substring(0, 6) + " Centimetres.");
6139 }
6140
6141 // Centimetres to Feet
6142 } else if (cmd == cmdChar+"cmtofeet") {
6143 var cmTemp = message.substring(10).trim() * 0.032808;
6144 var outcome = cmTemp.toString();
6145 if (message.substring(10).trim() == "" || isNaN(cmTemp)) {
6146 sendChat("Usage: "+cmdChar+"cmtofeet <unit> eg: 5.");
6147 } else {
6148 sendChat(message.substring(10).trim() + " Centimetres equals: " + outcome.substring(0, 6) + " feet.");
6149 }
6150
6151 // Feet to Centimetres
6152 } else if (cmd == cmdChar+"feettocm") {
6153 var cmTemp = message.substring(10).trim() / 0.032808;
6154 var outcome = cmTemp.toString();
6155 if (message.substring(10).trim() == "" || isNaN(cmTemp)) {
6156 sendChat("Usage: "+cmdChar+"feettocm <unit> eg: 5.");
6157 } else {
6158 sendChat(message.substring(10).trim() + " Feet equals: " + outcome.substring(0, 6) + " Centimetres.");
6159 }
6160
6161 // Kilometres to Miles
6162 } else if (cmd == cmdChar+"kmtomile") {
6163 var cmTemp = message.substring(10).trim() / 0.62137;
6164 var outcome = cmTemp.toString();
6165 if (message.substring(10).trim() == "" || isNaN(cmTemp)) {
6166 sendChat("Usage: "+cmdChar+"kmtomile <unit> eg: 50.");
6167 } else {
6168 sendChat(message.substring(10).trim() + " Kilometres equals: " + outcome.substring(0, 5) + " Miles.");
6169 }
6170
6171 // Miles to Kilometres
6172 } else if (cmd == cmdChar+"miletokm") {
6173 var cmTemp = message.substring(10).trim() * 0.62137;
6174 var outcome = cmTemp.toString();
6175 if (message.substring(10).trim() == "" || isNaN(cmTemp)) {
6176 sendChat("Usage: "+cmdChar+"miletokm <unit> eg: 80");
6177 } else {
6178 sendChat(message.substring(10).trim() + " Miles equals: " + outcome.substring(0, 5) + " Kilometres.");
6179 }
6180 // unit conversions end
6181
6182 // stab command
6183 } else if (cmd == cmdChar+"stab") {
6184 var target = msg.a.substring(cmd.length).trim();
6185 var part = getUser(target.toLowerCase());
6186 if (target == "") {
6187 sendChat("Usage "+cmdChar+"stab name_here.");
6188 return;
6189 }
6190 if (part) {
6191 if (part.name == name) {
6192 sendChat("\"Ouch!\" says " + part.name);
6193 return;
6194 }
6195 sendChat(name + " stabbed " + part.name +".");
6196 } else {
6197 sendChat(userNotFound);
6198 }
6199
6200 } else if (cmd == cmdChar+"highfive") { //highfive command
6201 var target = msg.a.substring(cmd.length).trim();
6202 var part = getUser(target.toLowerCase());
6203 if (target == "") {
6204 sendChat("Usage "+cmdChar+"highfive name_here.");
6205 return;
6206 }
6207 if (part) {
6208 if (part.name == name) {
6209 sendChat(part.name + " claps in the corner.. by themself.");
6210 return;
6211 }
6212 sendChat(name + " highfived " + part.name + ".");
6213 } else {
6214 sendChat(userNotFound);
6215 }
6216
6217 } else if (cmd == cmdChar+"kiss") { //kiss command
6218 var target = msg.a.substring(cmd.length).trim();
6219 var part = getUser(target.toLowerCase());
6220 if (target == "") {
6221 sendChat("Usage "+cmdChar+"kiss name_here.");
6222 return;
6223 }
6224
6225 if (usersDead.indexOf(ids) !== -1) {
6226 sendChat("Is too weak to kiss anyone... maybe a kiss would wake them up?");
6227 return;
6228 }
6229
6230 if (part) {
6231 if (part.name == name) {
6232 sendChat(name + " scrunches up their face, sucking their bottom lip inside their mouth.");
6233 return;
6234 }
6235
6236 if (usersDead.indexOf(part._id) !== -1) {
6237 sendChat(name + '\'s kiss brought ' + part.name + ' back to life.');
6238 usersDead.splice(usersDead.indexOf(ids), 1);
6239
6240 } else {
6241 var kissArray = ['bottom', 'top'];
6242 var lip = Math.floor(Math.random() * kissArray.length);
6243 var kissTypeArray = ['passionately', 'softly', 'shyly', 'nervously', 'cutely', 'holds and'];
6244 var kissType = Math.floor(Math.random() * kissTypeArray.length);
6245 sendChat(name + " " + kissTypeArray[kissType] + " kisses " + part.name + "'s " + kissArray[lip] + " lip. " + part.name + " blushes shyly.");
6246 }
6247 } else {
6248 sendChat(userNotFound);
6249 }
6250
6251 } else if (cmd == cmdChar+"slap") { //slap command
6252 var target = msg.a.substring(cmd.length).trim();
6253 var part = getUser(target.toLowerCase());
6254 if (target == "") {
6255 sendChat("Usage "+cmdChar+"slap name_here.");
6256 return;
6257 }
6258 if (part) {
6259 if (part.name == name) {
6260 sendChat("You cannot slap yourself, that would be awkward.");
6261 return;
6262 }
6263 sendChat(name + " slapped " + part.name);
6264 } else {
6265 sendChat(userNotFound);
6266 }
6267
6268 } else if (cmd == cmdChar+"cuddle") { //cuddle command
6269 var target = msg.a.substring(cmd.length).trim();
6270 var part = getUser(target.toLowerCase());
6271 if (target == "") {
6272 sendChat("Usage "+cmdChar+"cuddle name_here.");
6273 return;
6274 }
6275 if (part) {
6276 if (part.name == name) {
6277 sendChat("You cannot cuddle yourself, you lonely fuck!");
6278 return;
6279 }
6280 var cuddleArray = ['tightly cuddles', 'softly cuddles', 'shyly cuddles', 'tenderly cuddles', 'cuddles'];
6281 var cuddle = Math.floor(Math.random() * cuddleArray.length);
6282 sendChat(name + " " + cuddleArray[cuddle] + " " + part.name + ".");
6283 } else {
6284 sendChat(userNotFound);
6285 }
6286
6287 } else if (cmd == cmdChar+"hug") { //hug command
6288 var target = msg.a.substring(cmd.length).trim();
6289 var part = getUser(target.toLowerCase());
6290 if (target == "") {
6291 sendChat("Usage "+cmdChar+"hug name_here.");
6292 return;
6293 }
6294 if (part) {
6295 if (part.name == name) {
6296 sendChat("You cannot hug yourself, hug a cuddly anon.");
6297 return;
6298 }
6299 var hugArray = [' tightly squeezes ', ' sprints up and hugs ', ' shyly hugs ', ' gently caresses ', ' tounge hugs '];
6300 var hug = Math.floor(Math.random() * hugArray.length);
6301 sendChat(name + hugArray[hug] + part.name + ".");
6302 } else {
6303 sendChat(userNotFound);
6304 }
6305
6306 } else if (cmd == cmdChar+"rape") { //rape command
6307 var target = msg.a.substring(cmd.length).trim();
6308 var part = getUser(target.toLowerCase());
6309 if (target == "") {
6310 sendChat("Usage "+cmdChar+"rape name_here.");
6311 return;
6312 }
6313 if (part) {
6314 if (part.name == name) {
6315 sendChat("You cannot rape yourself, rape the Anonymous people.");
6316 return;
6317 }
6318 sendChat(name + " raped " + part.name + " ᶘᵒᴥᵒᶅ");
6319 } else {
6320 sendChat(userNotFound);
6321 }
6322
6323 } else if (cmd == cmdChar+"gift") { //gift command
6324 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
6325 var randomNumber = Math.floor(Math.random() * giftArray.length);
6326 var target = msg.a.substring(cmd.length).trim();
6327 var part = getUser(target.toLowerCase());
6328 if (target == "") {
6329 sendChat("Usage "+cmdChar+"gift name_here.");
6330 return;
6331 }
6332 if (part) {
6333 if (part.name == name) {
6334 sendChat("You cannot gift yourself, that would be greedy.");
6335 return;
6336 }
6337 sendChat(name + " gave " + part.name + " " + giftArray[randomNumber]);
6338 } else {
6339 sendChat(userNotFound);
6340 }
6341
6342 } else if (cmd == cmdChar+"attack") { //attack command
6343 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'];
6344 var randomNumber = Math.floor(Math.random() * attackArray.length);
6345 var target = msg.a.substring(cmd.length).trim();
6346 var part = getUser(target.toLowerCase());
6347 if (target == "") {
6348 sendChat("Usage "+cmdChar+"attack name_here.");
6349 return;
6350 }
6351 if (part) {
6352 if (part.name == name) {
6353 sendChat("You cannot attack yourself, attack the Anonymous people.");
6354 return;
6355 }
6356 sendChat(name + " attacked " + part.name + " with a " + attackArray[randomNumber] + ".");
6357 } else {
6358 sendChat(userNotFound);
6359 }
6360
6361 } else if (cmd == cmdChar+"colour" || cmd == cmdChar+"color") { //colour command
6362 //thanks electrashave!
6363 if (msg.a.substring(cmd.length).trim() == '') {
6364 sendChat("Your colour is " + new Color(msg.p.color).getName() + " (" + msg.p.color + ") (You can also type "+cmdChar+"colour name_here)");
6365 return;
6366 }
6367
6368 var target = msg.a.substring(cmd.length).trim();
6369 var part = getUser(target.toLowerCase());
6370
6371 if (part) {
6372 sendChat(part.name + "'s colour is " + new Color(part.color).getName() + " (" + part.color + ")");
6373 } else {
6374 sendChat(userNotFound);
6375 }
6376
6377 } else if (cmd == cmdChar+"unicode") { //unicode command
6378 sendChat("Put some of these in your name: ᴥ◕☀☁☂☃☄★☆☇☈☉☊☋☌☍ツ¢¢☍☎☏☐☑☒☓☔☕☖☗☘☙☚☛☜☝☞☟☠␀☡☢☣☤☥☦☧☨☩☪☫☬☭☮☯─━│┃┎┒┝┫┳┻╋╭╮╯╰╱╲╳╴╵╶╷╸╹╺╻╼╽╾╿☰☱☲☳☴☵☶☷░▒▓▔▁▂▃▄▅▆▇█▉▊▋▌▐ ▍▎▏◘☸☹☺☻☼☽☾☿ ♀♁♂♃♄♅♆♇♈♉♊♋♌♍♎♏♐♑♒♓♔♕♖♗♘♙♚♛♜♝♞♟♠♢♣♤♥♡♦♧♨♩♪♫♬♭♮♯ ๖ۣۜ ∥~∼˜≀π∏ℍℂℕℙℚℝℤℬℰℱℋℐℒℳ℘ℛℓℴℯɨℊℎ√∑∮‖⌊⌉⋕⊤✀✁✂✃✄✆✇✈✉✌✍✎✏✐✑✒✓✔✕✖✗✘✙✚✛✜✝✞✟✠✡✢✣✤✥✦✧✩✪✫✬✭✮✯✰✱✲✳✴✵✶✷✸✹✺✻✼✽✾✿❀❁❂❃❄❅❆❇❈❉❊❋❍❏❐❑❒❖❡❤❥❦❧❶❷❸❹❺❻❼❽❾❿➀➁➂➃➄➅➆➇➈➉➔➘➙➚➛➜➝➞➟➠➡➢➣➤➥➦➧➨➩➪➫➬➭➮➯➰➱➲➳➴➵➶➷➸➹➺➻➼➽➾∧⋉⋊⋈ℵ");
6379
6380 } else if (cmd == cmdChar+"clap" || cmd == cmdChar+"applaud") { //clap command
6381 sendChat(name + " applauds.");
6382
6383 } else if (cmd == cmdChar+"slowclap") { //slow clap command
6384 sendChat(name + " claps slowly in approval");
6385
6386 } else if (cmd == cmdChar+"list") { //list command
6387 var list = "Connected users: ";
6388 for (var id in gClient.ppl) {
6389 list += gClient.ppl[id].name + ", ";
6390 }
6391 sendChat(list);
6392 return;
6393
6394 } else if (cmd == cmdChar+"facepalm") { //facepalm command
6395 sendChat(name + " facepalmed.");
6396
6397 } else if (cmd == cmdChar+"musicsheets" || cmd == cmdChar+"ms") { //musicsheets command
6398 var songArray = [' ',
6399 ' ',
6400 ' ',
6401 ' ',
6402 ' ',
6403 ' ',
6404 ' ',
6405 ' ',
6406 ' ',
6407 ' ',
6408 ' ',
6409 ' ',
6410 ' ',
6411 ' ',
6412 ' ',
6413 ' ',
6414 ' ',
6415 ' ',
6416 ' ',
6417 ' ',
6418 ' '];
6419 var randomSong = Math.floor(Math.random() * songArray.length);
6420 sendChat("Songs for PC players: " + sheetURL + " more or less playable songs " + songArray[randomSong] + " (Notes updated 10th August 2016)"); //update when you update link, Logan
6421
6422 } else if (cmd == cmdChar+"suicide") { //suicide command
6423 if (usersDead.indexOf(ids) == -1) {
6424 sendChat(name + " kissed Logan and died x3");
6425 usersDead.push(ids);
6426
6427 } else {
6428 sendChat(name + " is too weak to kiss Logan... Maybe a kiss would wake them up?");
6429 }
6430
6431 } else if (cmd == cmdChar+"kill") { //kill command
6432 var target = msg.a.substring(cmd.length).trim();
6433 var part = getUser(target.toLowerCase());
6434 if (target == "") {
6435 sendChat("Usage "+cmdChar+"kill name_here.");
6436 return;
6437 }
6438 if (part) {
6439 if (part.name == name) {
6440 if (usersDead.indexOf(part._id) == -1) {
6441 sendChat(name + " commitsed suicide!");
6442 usersDead.push(part._id);
6443 } else {
6444 sendChat(name + "'s body twitches... Maybe a kiss would wake them up?");
6445 }
6446 return;
6447 }
6448 if (usersDead.indexOf(part._id) == -1) {
6449 sendChat(name + " killed " + part.name + "!");
6450 usersDead.push(part._id)
6451 } else {
6452 sendChat(part.name + " body twitches... Maybe a kiss would wake them up?");
6453 }
6454 } else {
6455 sendChat(userNotFound);
6456 }
6457
6458 //text art
6459 } else if (cmd == cmdChar+"art") { //art command
6460 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).");
6461
6462 } else if (cmd == cmdChar+"hamster2") { //hamster 2 art command
6463 setTimeout(function() { sendChat("( ) ( )" ); }, 0);
6464 setTimeout(function() { sendChat("(>•.•<)" ); }, 0);
6465 setTimeout(function() { sendChat('(") (")' ); }, 0);
6466
6467 } else if (cmd == cmdChar+"hamster") { //hamster art command
6468 setTimeout(function() { sendChat("( )_( )" ); }, 0);
6469 setTimeout(function() { sendChat("(='.'=)" ); }, 0);
6470 setTimeout(function() { sendChat('(")_(")' ); }, 0);
6471
6472 } else if (cmd == cmdChar+"bunny4") { //bunny 4 art command
6473 setTimeout(function() { sendChat("(\\(\\" ); }, 0);
6474 setTimeout(function() { sendChat("(=\".\")" ); }, 0);
6475 setTimeout(function() { sendChat('("")("")' ); }, 0);
6476
6477 } else if (cmd == cmdChar+"bunny3") { //bunny 3 art command
6478 setTimeout(function() { sendChat("(\\_(\\" ); }, 0);
6479 setTimeout(function() { sendChat("(˚_˚)" ); }, 0);
6480 setTimeout(function() { sendChat("('')('')" ); }, 0);
6481
6482 } else if (cmd == cmdChar+"bunny2") { //bunny 2 art command
6483 setTimeout(function() { sendChat("/)_/)" ); }, 0);
6484 setTimeout(function() { sendChat("(0.0)" ); }, 0);
6485 setTimeout(function() { sendChat("('')('')" ); }, 0);
6486
6487 } else if (cmd == cmdChar+"bunny") { //bunny art command
6488 setTimeout(function() { sendChat("(\\_/)" ); }, 0);
6489 setTimeout(function() { sendChat("(o.o)" ); }, 0);
6490 setTimeout(function() { sendChat("('')('')" ); }, 0);
6491
6492 } else if (cmd == cmdChar+"table") { //table art command
6493 setTimeout(function() { sendChat("(╮°-°)╮┳━━┳" ); }, 0);
6494 setTimeout(function() { sendChat("( ╯°□°)╯ ┻━━┻" ); }, 0);
6495 setTimeout(function() { sendChat("┬──┬ ノ( ゜-゜ノ)" ); }, 0);
6496 //text art
6497
6498 } else if (cmd == cmdChar+"foshist") { //fishies command
6499 if (gClient.isOwner()) {
6500 sendChat("............/´¯/)...............(\¯`\ " );
6501 sendChat(".........../...//....ЗДОХНИ..\\...\ " );
6502 sendChat("........../...//......ФАШИСТ.\\...\ " );
6503 sendChat("...../´¯/..../´¯\.ЕБАНЫй../¯` \....\¯`\ " );
6504 sendChat(".././.../..../..../.|_......._|.\....\....\...\.\ " );
6505 sendChat("(.(....(....(..../..)..)…...(..(.\....)....)....).) " );
6506 sendChat(".\................\/.../......\...\/................/ " );
6507 sendChat("..\.................. /.........\................../" );
6508 sendChat("umri suka" );
6509 } else {
6510 sendChat("I need the crown to show fishies in its entirety!");
6511 }
6512
6513 } else if (cmd == cmdChar+"face") { //face command
6514 var textArray = ['╥﹏╥', '(◕ᴥ◕し)', 'ʕ•ᴥ•ʔ', '(◡‿◡✿)', 'ヽ༼ ಠ益ಠ ༽ノ', '^‿^', 'ᶘ ᵒᴥᵒᶅ', '๏̯͡๏', '^ㅂ^', ' ಠ_ರೃ', '(ノ◕ヮ◕)ノ*:・゚✧', '◕◡◕', 'ಠ▃ಠ', 'ಠ╭╮ಠ', 'ಠ⌣ಠ', 'ಠ◡ಠ', 'ლ(ಠ益ಠლ)', 'ლ(◉◞౪◟◉‵ლ)', '⊙ω⊙', '⊙▂⊙', '╯‵Д′)╯彡┻━┻', '◕ω◕', '⌒▽⌒', '♥◡♥', '。◕‿‿◕。', '。◕ ‿ ◕。', '(´◉◞౪◟◉)', 'Ծ‸ Ծ', '(ᵔᴥᵔ)', '• ε •', '(⌐■_■)', '(┛◉Д◉)┛┻━┻', '(╯°□°)╯︵ ┻━┻ ', '◕ ^ ◕', '(☞゚ ∀゚ )☞', '(づ。◕‿‿◕。)づ', '(ノಠ益ಠ)ノ彡┻━┻', ';一_一', '\(◕ ◡ ◕\)', '°-°', '¶_¶', '( ͡° ͜ʖ ͡°)', '|)^_^(|'];
6515 var randomNumber = Math.floor(Math.random() * textArray.length);
6516 sendChat(textArray[randomNumber]);
6517
6518 } else if (cmd == cmdChar+"say") { //say command
6519 if (message.substring(4).trim() == "") {
6520 sendChat("Usage: "+cmdChar+"say text to say.");
6521 return;
6522 }
6523 sendChat(message.substring(5).trim());
6524
6525 } else if (cmd == cmdChar+"rename") { //rename command
6526 if (message.substring(cmd.length).trim() == 0) {
6527 sendChat('Usage: '+cmdChar+'rename new_name');
6528 return;
6529 }
6530 if (message.substring(7).trim() == 420) {
6531 sendChat('Too high!');
6532 return;
6533 }
6534 if (opped) {
6535 updateName(message.substring(7).trim());
6536 selfName = message.substring(7).trim();
6537
6538 } else {
6539 sendChat(noAccess);
6540 }
6541
6542 } else if (cmd == cmdChar+"welcome") { //welcome command
6543 if (opped) {
6544 if (welcTemp) {
6545 welcTemp = false;
6546 sendChat("Room welcoming disabled.");
6547 } else {
6548 welcTemp = true;
6549 sendChat("Room welcoming enabled.");
6550 }
6551 } else {
6552 sendChat(noAccess);
6553 }
6554 } else if (cmd == cmdChar+"tune") { //tune command
6555 if (opped) {
6556 if (tuneTemp) {
6557 tuneTemp = false;
6558 sendChat("Welcome tune disabled.");
6559 } else {
6560 tuneTemp = true;
6561 sendChat("Welcome tune enabled.");
6562 }
6563 } else {
6564 sendChat(noAccess);
6565 }
6566
6567 } else if (cmd == cmdChar+"ban") { //ban command
6568 var target = msg.a.substring(cmd.length).trim();
6569 var part = getUser(target.toLowerCase());
6570
6571 if (opped) {
6572 if (target == "") {
6573 sendChat("Usage "+cmdChar+"ban name_here.");
6574 return;
6575 }
6576 if (part) {
6577 if (banned.indexOf(part._id) !== -1) {
6578 sendChat(part.name + " is already banned!");
6579 return;
6580 }
6581
6582 if (part._id == selfId) { //Logan
6583 sendChat("Banning " + part.name.substring(0, 4).trim() + "... wait.");
6584 } else if (part._id == "4e28d8736f8a464ada652896") { //Yoshify.
6585 sendChat("You cannot ban " + selfName + "'s friend " + part.name + ".");
6586 } else if (part._id == "d9e6170fd899f2a94adea761") { //StarsPiano
6587 sendChat("You cannot ban " + selfName + "'s friend " + part.name + ".");
6588 } else {
6589 banned.push(part._id);
6590 sendChat(name + " banned " + part.name + ".");
6591 }
6592 } else {
6593 sendChat(userNotFound);
6594 }
6595 } else {
6596 sendChat(noAccess);
6597 }
6598
6599 } else if (cmd == cmdChar+"unban") { //unban command
6600 var target = msg.a.substring(cmd.length).trim();
6601 var part = getUser(target.toLowerCase());
6602
6603 if (opped) {
6604 if (target == "") {
6605 sendChat("Usage "+cmdChar+"unban name_here.");
6606 return;
6607 }
6608 if (part) {
6609 if (banned.indexOf(part._id) == -1) {
6610 sendChat(part.name + " isn't banned!");
6611 return;
6612 }
6613
6614 while (banned.indexOf(part._id) !== -1) {
6615 banned.splice(banned.indexOf(part._id), 1);
6616 sendChat(name + " unbanned " + part.name + ".");
6617 }
6618 while (banned.indexOf(part._id) !== -1) {
6619 delete banned[banned.indexOf(part._id)];
6620 }
6621 } else {
6622 sendChat(userNotFound);
6623 }
6624 } else {
6625 sendChat(noAccess);
6626 }
6627
6628 } else if (cmd == cmdChar+"pardon") { //pardon command
6629 if (mastered || opped) {
6630 banned = [];
6631 sendChat(name + " pardoned everyone from being banned.");
6632 } else {
6633 sendChat(noAccess);
6634 }
6635
6636 } else if (cmd == cmdChar+"op") { //op command
6637 var target = msg.a.substring(cmd.length).trim();
6638 var part = getUser(target.toLowerCase());
6639
6640 if (opped) {
6641 if (target == "") {
6642 sendChat("Usage "+cmdChar+"op name_here.");
6643 return;
6644 }
6645 if (part) {
6646 if (ops.indexOf(part._id) !== -1) {
6647 sendChat(part.name + " is already opped!");
6648 return;
6649 }
6650
6651 sendChat("Opped " + part.name + ".");
6652 ops.push(part._id);
6653
6654 } else {
6655 sendChat(userNotFound);
6656 }
6657 } else {
6658 sendChat(noAccess);
6659 }
6660
6661 } else if (cmd == cmdChar+"deop") { //deop command
6662 var target = msg.a.substring(cmd.length).trim();
6663 var part = getUser(target.toLowerCase());
6664
6665 if (opped) {
6666 if (target == "") {
6667 sendChat("Usage "+cmdChar+"deop name_here.");
6668 return;
6669 }
6670 if (part) {
6671 if (ops.indexOf(part._id) == -1) {
6672 sendChat(part.name + " isn't opped!");
6673 return;
6674 }
6675
6676 if (part._id == selfId) { //Logan
6677 sendChat("You cannot deop " + part.name + ".");
6678 } else if (part._id == "4e28d8736f8a464ada652896") { //Yoshify.
6679 sendChat("You cannot deop " + selfName + "'s friend " + part.name + ".");
6680 } else if (part._id == "d9e6170fd899f2a94adea761") { //StarsPiano
6681 sendChat("You cannot deop " + selfName + "'s friend " + part.name + ".");
6682 } else {
6683 while (ops.indexOf(part._id) !== -1) {
6684 ops.splice(banned.indexOf(part._id), 1); //is this meant to say banned?
6685 }
6686 while (ops.indexOf(part._id) !== -1) {
6687 delete ops[ops.indexOf(part._id)];
6688 }
6689 sendChat("Deopped " + part.name + ".");
6690 }
6691 } else {
6692 sendChat(userNotFound);
6693 }
6694 } else {
6695 sendChat(noAccess);
6696 }
6697 } else if (message.substring(0, 1) == cmdChar) { //alternative error messages
6698 if (message.substring(2).trim() == "") {
6699
6700 } else {
6701 //sendChat("Invalid command. Type !help for a list of commands you have access to."); //shhhhh
6702 }
6703 }
6704 }
6705 botLoaded = true;
6706 });
6707
6708 var Color = function () {
6709 var r, g, b;
6710 if (arguments.length === 1) {
6711 var hexa = arguments[0].toLowerCase();
6712 if (hexa.match(/^#[0-9a-f]{6}$/i)) {
6713 hexa = /^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(hexa);
6714 if (hexa && hexa.length === 4) {
6715 r = parseInt(hexa[1], 16);
6716 g = parseInt(hexa[2], 16);
6717 b = parseInt(hexa[3], 16);
6718 }
6719 }
6720 } else if (arguments.length === 3) {
6721 r = arguments[0];
6722 g = arguments[1];
6723 b = arguments[2];
6724 }
6725 this.r = ~~r || 0;
6726 this.g = ~~g || 0;
6727 this.b = ~~b || 0;
6728 };
6729
6730 Color.prototype.distance = function (color) {
6731 var d = 0;
6732 d += Math.pow(this.r - color.r, 2);
6733 d += Math.pow(this.g - color.g, 2);
6734 d += Math.pow(this.b - color.b, 2);
6735 return Math.abs(Math.sqrt(d));
6736 };
6737
6738 Color.prototype.toHexa = function () {
6739 var r = this.r.toString(16),
6740 g = this.g.toString(16),
6741 b = this.b.toString(16);
6742 if (r.length == 1) r = "0" + r;
6743 if (g.length == 1) g = "0" + g;
6744 if (b.length == 1) b = "0" + b;
6745 return "#" + r + g + b;
6746 };
6747
6748 Color.prototype.getName = function () {
6749 var hexa = this.toHexa();
6750 var low = 256;
6751 var name;
6752 for (var n in Color.map) {
6753 if (!Color.map.hasOwnProperty(n)) continue;
6754 var color = Color.map[n];
6755 if (color.r === this.r && color.g === this.g && color.b === this.b) {
6756 return n;
6757 }
6758 var dist = this.distance(color);
6759 if (dist < low) {
6760 low = dist;
6761 name = n;
6762 }
6763 }
6764 if (!name) name = this.toHexa();
6765 else name = "a shade of " + name;
6766 return name;
6767 };
6768
6769 Color.map = {};
6770
6771 Color.a = function (hexa, name) {
6772 Color.map[name] = new Color(hexa);
6773 };
6774
6775 Color.a("#7CB9E8", "Aero");
6776 Color.a("#C9FFE5", "Aero blue");
6777 Color.a("#B284BE", "African purple");
6778 Color.a("#5D8AA8", "Air Force blue (RAF)");
6779 Color.a("#00308F", "Air Force blue (USAF)");
6780 Color.a("#72A0C1", "Air superiority blue");
6781 Color.a("#AF002A", "Alabama Crimson");
6782 Color.a("#F0F8FF", "Alice blue");
6783 Color.a("#E32636", "Alizarin crimson");
6784 Color.a("#C46210", "Alloy orange");
6785 Color.a("#EFDECD", "Almond");
6786 Color.a("#E52B50", "Amaranth");
6787 Color.a("#F19CBB", "Amaranth pink");
6788 Color.a("#AB274F", "Dark amaranth");
6789 Color.a("#3B7A57", "Amazon");
6790 Color.a("#FF7E00", "Amber");
6791 Color.a("#FF033E", "American rose");
6792 Color.a("#9966CC", "Amethyst");
6793 Color.a("#A4C639", "Android green");
6794 Color.a("#F2F3F4", "Anti-flash white");
6795 Color.a("#CD9575", "Antique brass");
6796 Color.a("#665D1E", "Antique bronze");
6797 Color.a("#915C83", "Antique fuchsia");
6798 Color.a("#841B2D", "Antique ruby");
6799 Color.a("#FAEBD7", "Antique white");
6800 Color.a("#8DB600", "Apple green");
6801 Color.a("#FBCEB1", "Apricot");
6802 Color.a("#00FFFF", "Aqua");
6803 Color.a("#7FFFD4", "Aquamarine");
6804 Color.a("#4B5320", "Army green");
6805 Color.a("#3B444B", "Arsenic");
6806 Color.a("#8F9779", "Artichoke");
6807 Color.a("#B2BEB5", "Ash grey");
6808 Color.a("#87A96B", "Asparagus");
6809 Color.a("#FDEE00", "Aureolin");
6810 Color.a("#6E7F80", "AuroMetalSaurus");
6811 Color.a("#568203", "Avocado");
6812 Color.a("#007FFF", "Azure");
6813 Color.a("#F0FFFF", "Azure mist/web");
6814 Color.a("#89CFF0", "Baby blue");
6815 Color.a("#A1CAF1", "Baby blue eyes");
6816 Color.a("#FEFEFA", "Baby powder");
6817 Color.a("#FF91AF", "Baker-Miller pink");
6818 Color.a("#21ABCD", "Ball blue");
6819 Color.a("#FAE7B5", "Banana Mania");
6820 Color.a("#FFE135", "Banana yellow");
6821 Color.a("#E0218A", "Barbie pink");
6822 Color.a("#7C0A02", "Barn red");
6823 Color.a("#848482", "Battleship grey");
6824 Color.a("#98777B", "Bazaar");
6825 Color.a("#9F8170", "Beaver");
6826 Color.a("#F5F5DC", "Beige");
6827 Color.a("#2E5894", "B'dazzled blue");
6828 Color.a("#9C2542", "Big dip o’ruby");
6829 Color.a("#FFE4C4", "Bisque");
6830 Color.a("#3D2B1F", "Bistre");
6831 Color.a("#967117", "Bistre brown");
6832 Color.a("#CAE00D", "Bitter lemon");
6833 Color.a("#648C11", "Bitter lime");
6834 Color.a("#FE6F5E", "Bittersweet");
6835 Color.a("#BF4F51", "Bittersweet shimmer");
6836 Color.a("#000000", "Black with no soul!");
6837 Color.a("#3D0C02", "Black bean");
6838 Color.a("#253529", "Black leather jacket");
6839 Color.a("#3B3C36", "Black olive");
6840 Color.a("#FFEBCD", "Blanched almond");
6841 Color.a("#A57164", "Blast-off bronze");
6842 Color.a("#318CE7", "Bleu de France");
6843 Color.a("#ACE5EE", "Blizzard Blue");
6844 Color.a("#FAF0BE", "Blond");
6845 Color.a("#0000FF", "Blue");
6846 Color.a("#1F75FE", "Blue (Crayola)");
6847 Color.a("#0093AF", "Blue (Munsell)");
6848 Color.a("#0087BD", "Blue (NCS)");
6849 Color.a("#333399", "Blue (pigment)");
6850 Color.a("#0247FE", "Blue (RYB)");
6851 Color.a("#A2A2D0", "Blue Bell");
6852 Color.a("#6699CC", "Blue-gray");
6853 Color.a("#0D98BA", "Blue-green");
6854 Color.a("#126180", "Blue sapphire");
6855 Color.a("#8A2BE2", "Blue-violet");
6856 Color.a("#5072A7", "Blue yonder");
6857 Color.a("#4F86F7", "Blueberry");
6858 Color.a("#1C1CF0", "Bluebonnet");
6859 Color.a("#DE5D83", "Blush");
6860 Color.a("#79443B", "Bole Brown");
6861 Color.a("#0095B6", "Bondi blue");
6862 Color.a("#E3DAC9", "Bone");
6863 Color.a("#CC0000", "Boston University Red");
6864 Color.a("#006A4E", "Bottle green");
6865 Color.a("#873260", "Boysenberry");
6866 Color.a("#0070FF", "Brandeis blue");
6867 Color.a("#B5A642", "Brass");
6868 Color.a("#CB4154", "Brick red");
6869 Color.a("#1DACD6", "Bright cerulean");
6870 Color.a("#66FF00", "Bright green");
6871 Color.a("#BF94E4", "Bright lavender");
6872 Color.a("#D891EF", "Bright lilac");
6873 Color.a("#C32148", "Bright maroon");
6874 Color.a("#1974D2", "Bright navy blue");
6875 Color.a("#FF007F", "Bright pink");
6876 Color.a("#08E8DE", "Bright turquoise");
6877 Color.a("#D19FE8", "Bright ube");
6878 Color.a("#F4BBFF", "Brilliant lavender");
6879 Color.a("#FF55A3", "Brilliant rose");
6880 Color.a("#FB607F", "Brink pink");
6881 Color.a("#004225", "British racing green");
6882 Color.a("#CD7F32", "Bronze");
6883 Color.a("#737000", "Bronze Yellow");
6884 Color.a("#964B00", "Brown");
6885 Color.a("#6B4423", "Brown-nose");
6886 Color.a("#FFC1CC", "Bubble gum");
6887 Color.a("#E7FEFF", "Bubbles");
6888 Color.a("#F0DC82", "Buff");
6889 Color.a("#7BB661", "Bud green");
6890 Color.a("#480607", "Bulgarian rose");
6891 Color.a("#800020", "Burgundy");
6892 Color.a("#DEB887", "Burlywood");
6893 Color.a("#CC5500", "Burnt orange");
6894 Color.a("#8A3324", "Burnt umber");
6895 Color.a("#BD33A4", "Byzantine");
6896 Color.a("#702963", "Byzantium");
6897 Color.a("#536872", "Cadet");
6898 Color.a("#5F9EA0", "Cadet blue");
6899 Color.a("#91A3B0", "Cadet grey");
6900 Color.a("#006B3C", "Cadmium green");
6901 Color.a("#ED872D", "Cadmium orange");
6902 Color.a("#E30022", "Cadmium red");
6903 Color.a("#FFF600", "Cadmium yellow");
6904 Color.a("#A67B5B", "Cafe au lait");
6905 Color.a("#4B3621", "Cafe noir");
6906 Color.a("#1E4D2B", "Cal Poly green");
6907 Color.a("#A3C1AD", "Cambridge Blue");
6908 Color.a("#EFBBCC", "Cameo pink");
6909 Color.a("#78866B", "Camouflage green");
6910 Color.a("#FFEF00", "Canary yellow");
6911 Color.a("#FF0800", "Candy apple red");
6912 Color.a("#E4717A", "Candy pink");
6913 Color.a("#592720", "Caput mortuum");
6914 Color.a("#C41E3A", "Cardinal");
6915 Color.a("#00CC99", "Caribbean green");
6916 Color.a("#960018", "Carmine");
6917 Color.a("#EB4C42", "Carmine pink");
6918 Color.a("#FF0038", "Carmine red");
6919 Color.a("#FFA6C9", "Carnation pink");
6920 Color.a("#99BADD", "Carolina blue");
6921 Color.a("#ED9121", "Carrot orange");
6922 Color.a("#00563F", "Castleton green");
6923 Color.a("#062A78", "Catalina blue");
6924 Color.a("#703642", "Catawba");
6925 Color.a("#C95A49", "Cedar Chest");
6926 Color.a("#92A1CF", "Ceil");
6927 Color.a("#ACE1AF", "Celadon");
6928 Color.a("#007BA7", "Celadon blue");
6929 Color.a("#2F847C", "Celadon green");
6930 Color.a("#4997D0", "Celestial blue");
6931 Color.a("#EC3B83", "Cerise pink");
6932 Color.a("#2A52BE", "Cerulean blue");
6933 Color.a("#6D9BC3", "Cerulean frost");
6934 Color.a("#007AA5", "CG Blue");
6935 Color.a("#E03C31", "CG Red");
6936 Color.a("#A0785A", "Chamoisee");
6937 Color.a("#F7E7CE", "Champagne");
6938 Color.a("#36454F", "Charcoal");
6939 Color.a("#232B2B", "Charleston green");
6940 Color.a("#E68FAC", "Charm pink");
6941 Color.a("#DFFF00", "Chartreuse");
6942 Color.a("#7FFF00", "Chartreuse (web)");
6943 Color.a("#DE3163", "Cherry");
6944 Color.a("#FFB7C5", "Cherry blossom pink");
6945 Color.a("#954535", "Chestnut");
6946 Color.a("#A8516E", "China rose");
6947 Color.a("#AA381E", "Chinese red");
6948 Color.a("#856088", "Chinese violet");
6949 Color.a("#7B3F00", "Chocolate");
6950 Color.a("#FFA700", "Chrome yellow");
6951 Color.a("#98817B", "Cinereous");
6952 Color.a("#E4D00A", "Citrine");
6953 Color.a("#9FA91F", "Citron");
6954 Color.a("#7F1734", "Claret");
6955 Color.a("#FBCCE7", "Classic rose");
6956 Color.a("#0047AB", "Cobalt");
6957 Color.a("#D2691E", "Cocoa brown");
6958 Color.a("#965A3E", "Coconut");
6959 Color.a("#6F4E37", "Coffee Brown");
6960 Color.a("#9BDDFF", "Columbia blue");
6961 Color.a("#002E63", "Cool black");
6962 Color.a("#8C92AC", "Cool grey");
6963 Color.a("#B87333", "Copper");
6964 Color.a("#AD6F69", "Copper penny");
6965 Color.a("#CB6D51", "Copper red");
6966 Color.a("#996666", "Copper rose");
6967 Color.a("#FF3800", "Coquelicot");
6968 Color.a("#FF7F50", "Coral");
6969 Color.a("#F88379", "Coral pink");
6970 Color.a("#FF4040", "Coral red");
6971 Color.a("#893F45", "Cordovan");
6972 Color.a("#FBEC5D", "Corn Yellow");
6973 Color.a("#B31B1B", "Cornell Red");
6974 Color.a("#6495ED", "Cornflower blue");
6975 Color.a("#FFF8DC", "Cornsilk");
6976 Color.a("#FFF8E7", "Cosmic latte");
6977 Color.a("#FFBCD9", "Cotton candy");
6978 Color.a("#FFFDD0", "Cream");
6979 Color.a("#DC143C", "Crimson");
6980 Color.a("#BE0032", "Crimson glory");
6981 Color.a("#00B7EB", "Cyan");
6982 Color.a("#58427C", "Cyber grape");
6983 Color.a("#FFD300", "Cyber yellow");
6984 Color.a("#FFFF31", "Daffodil");
6985 Color.a("#F0E130", "Dandelion");
6986 Color.a("#00008B", "Dark blue");
6987 Color.a("#666699", "Dark blue-gray");
6988 Color.a("#654321", "Dark brown");
6989 Color.a("#5D3954", "Dark byzantium");
6990 Color.a("#A40000", "Dark candy apple red");
6991 Color.a("#08457E", "Dark cerulean");
6992 Color.a("#986960", "Dark chestnut");
6993 Color.a("#CD5B45", "Dark coral");
6994 Color.a("#008B8B", "Dark cyan");
6995 Color.a("#536878", "Dark electric blue");
6996 Color.a("#B8860B", "Dark goldenrod");
6997 Color.a("#A9A9A9", "Dark gray");
6998 Color.a("#013220", "Dark green");
6999 Color.a("#00416A", "Dark imperial blue");
7000 Color.a("#1A2421", "Dark jungle green");
7001 Color.a("#BDB76B", "Dark khaki");
7002 Color.a("#734F96", "Dark lavender");
7003 Color.a("#534B4F", "Dark liver");
7004 Color.a("#543D37", "Dark liver (horses)");
7005 Color.a("#8B008B", "Dark magenta");
7006 Color.a("#003366", "Dark midnight blue");
7007 Color.a("#4A5D23", "Dark moss green");
7008 Color.a("#556B2F", "Dark olive green");
7009 Color.a("#FF8C00", "Dark orange");
7010 Color.a("#9932CC", "Dark orchid");
7011 Color.a("#779ECB", "Dark pastel blue");
7012 Color.a("#03C03C", "Dark pastel green");
7013 Color.a("#966FD6", "Dark pastel purple");
7014 Color.a("#C23B22", "Dark pastel red");
7015 Color.a("#E75480", "Dark pink");
7016 Color.a("#003399", "Dark powder blue");
7017 Color.a("#4F3A3C", "Dark puce");
7018 Color.a("#872657", "Dark raspberry");
7019 Color.a("#8B0000", "Dark red");
7020 Color.a("#E9967A", "Dark salmon");
7021 Color.a("#560319", "Dark Scarlet");
7022 Color.a("#8FBC8F", "Dark sea green");
7023 Color.a("#3C1414", "Dark sienna");
7024 Color.a("#8CBED6", "Dark sky blue");
7025 Color.a("#483D8B", "Dark slate blue");
7026 Color.a("#2F4F4F", "Dark slate gray");
7027 Color.a("#177245", "Dark spring green");
7028 Color.a("#918151", "Dark tan");
7029 Color.a("#FFA812", "Dark tangerine");
7030 Color.a("#CC4E5C", "Dark terra cotta");
7031 Color.a("#00CED1", "Dark turquoise");
7032 Color.a("#D1BEA8", "Dark vanilla");
7033 Color.a("#9400D3", "Dark violet");
7034 Color.a("#9B870C", "Dark yellow");
7035 Color.a("#00703C", "Dartmouth green");
7036 Color.a("#555555", "Davy's grey");
7037 Color.a("#D70A53", "Debian red");
7038 Color.a("#A9203E", "Deep carmine");
7039 Color.a("#EF3038", "Deep carmine pink");
7040 Color.a("#E9692C", "Deep carrot orange");
7041 Color.a("#DA3287", "Deep cerise");
7042 Color.a("#B94E48", "Deep chestnut");
7043 Color.a("#C154C1", "Deep fuchsia");
7044 Color.a("#004B49", "Deep jungle green");
7045 Color.a("#F5C71A", "Deep lemon");
7046 Color.a("#9955BB", "Deep lilac");
7047 Color.a("#CC00CC", "Deep magenta");
7048 Color.a("#D473D4", "Deep mauve");
7049 Color.a("#355E3B", "Deep moss green");
7050 Color.a("#FFCBA4", "Deep peach");
7051 Color.a("#A95C68", "Deep puce");
7052 Color.a("#843F5B", "Deep ruby");
7053 Color.a("#FF9933", "Deep saffron");
7054 Color.a("#00BFFF", "Deep sky blue");
7055 Color.a("#4A646C", "Deep Space Sparkle");
7056 Color.a("#7E5E60", "Deep Taupe");
7057 Color.a("#66424D", "Deep Tuscan red");
7058 Color.a("#BA8759", "Deer");
7059 Color.a("#1560BD", "Denim");
7060 Color.a("#EDC9AF", "Desert sand");
7061 Color.a("#EA3C53", "Desire");
7062 Color.a("#B9F2FF", "Diamond");
7063 Color.a("#696969", "Dim gray");
7064 Color.a("#9B7653", "Dirt");
7065 Color.a("#1E90FF", "Dodger blue");
7066 Color.a("#D71868", "Dogwood rose");
7067 Color.a("#85BB65", "Dollar bill");
7068 Color.a("#664C28", "Donkey Brown");
7069 Color.a("#00009C", "Duke blue");
7070 Color.a("#E5CCC9", "Dust storm");
7071 Color.a("#EFDFBB", "Dutch white");
7072 Color.a("#E1A95F", "Earth yellow");
7073 Color.a("#555D50", "Ebony");
7074 Color.a("#1B1B1B", "Logan's old colour </3"); //Logan's old colour </3
7075 Color.a("#614051", "Eggplant");
7076 Color.a("#F0EAD6", "Eggshell");
7077 Color.a("#1034A6", "Egyptian blue");
7078 Color.a("#7DF9FF", "Electric blue");
7079 Color.a("#FF003F", "Electric crimson");
7080 Color.a("#00FF00", "Electric green");
7081 Color.a("#6F00FF", "Electric indigo");
7082 Color.a("#CCFF00", "Electric lime");
7083 Color.a("#BF00FF", "Electric purple");
7084 Color.a("#3F00FF", "Electric ultramarine");
7085 Color.a("#FFFF00", "Electric yellow");
7086 Color.a("#50C878", "Emerald");
7087 Color.a("#6C3082", "Eminence");
7088 Color.a("#1B4D3E", "English green");
7089 Color.a("#B48395", "English lavender");
7090 Color.a("#AB4B52", "English red");
7091 Color.a("#563C5C", "English violet");
7092 Color.a("#96C8A2", "Eton blue");
7093 Color.a("#44D7A8", "Eucalyptus");
7094 Color.a("#801818", "Falu red");
7095 Color.a("#B53389", "Fandango");
7096 Color.a("#DE5285", "Fandango pink");
7097 Color.a("#F400A1", "Fashion fuchsia");
7098 Color.a("#E5AA70", "Fawn");
7099 Color.a("#4D5D53", "Feldgrau");
7100 Color.a("#4F7942", "Fern green");
7101 Color.a("#FF2800", "Ferrari Red");
7102 Color.a("#6C541E", "Field drab");
7103 Color.a("#B22222", "Firebrick");
7104 Color.a("#CE2029", "Fire engine red");
7105 Color.a("#E25822", "Flame");
7106 Color.a("#FC8EAC", "Flamingo pink");
7107 Color.a("#F7E98E", "Flavescent"); //Logan's new stupid colour?
7108 Color.a("#EEDC82", "Flax");
7109 Color.a("#A2006D", "Flirt");
7110 Color.a("#FFFAF0", "Floral white");
7111 Color.a("#FFBF00", "Fluorescent orange");
7112 Color.a("#FF1493", "Fluorescent pink");
7113 Color.a("#FF004F", "Folly");
7114 Color.a("#014421", "Forest green");
7115 Color.a("#228B22", "Forest green (web)");
7116 Color.a("#856D4D", "French bistre");
7117 Color.a("#0072BB", "French blue");
7118 Color.a("#FD3F92", "French fuchsia");
7119 Color.a("#86608E", "French lilac");
7120 Color.a("#9EFD38", "French lime");
7121 Color.a("#FD6C9E", "French pink");
7122 Color.a("#4E1609", "French puce");
7123 Color.a("#C72C48", "French raspberry");
7124 Color.a("#F64A8A", "French rose");
7125 Color.a("#77B5FE", "French sky blue");
7126 Color.a("#8806CE", "French violet");
7127 Color.a("#AC1E44", "French wine");
7128 Color.a("#A6E7FF", "Fresh Air");
7129 Color.a("#FF77FF", "Fuchsia pink");
7130 Color.a("#CC397B", "Fuchsia purple");
7131 Color.a("#C74375", "Fuchsia rose");
7132 Color.a("#E48400", "Fulvous");
7133 Color.a("#CC6666", "Fuzzy Wuzzy");
7134 Color.a("#DCDCDC", "Gainsboro");
7135 Color.a("#E49B0F", "Gamboge");
7136 Color.a("#007F66", "Generic viridian");
7137 Color.a("#F8F8FF", "Ghost white");
7138 Color.a("#FE5A1D", "Giants orange");
7139 Color.a("#B06500", "Ginger");
7140 Color.a("#6082B6", "Glaucous");
7141 Color.a("#E6E8FA", "Glitter");
7142 Color.a("#00AB66", "GO green");
7143 Color.a("#D4AF37", "Gold (metallic)");
7144 Color.a("#FFD700", "Gold (web) (Golden)");
7145 Color.a("#85754E", "Gold Fusion");
7146 Color.a("#996515", "Golden brown");
7147 Color.a("#FCC200", "Golden poppy");
7148 Color.a("#FFDF00", "Golden yellow");
7149 Color.a("#DAA520", "Goldenrod");
7150 Color.a("#A8E4A0", "Granny Smith Apple");
7151 Color.a("#6F2DA8", "Grape");
7152 Color.a("#808080", "Gray");
7153 Color.a("#BEBEBE", "Gray (X11 gray)");
7154 Color.a("#465945", "Gray-asparagus");
7155 Color.a("#1CAC78", "Green (Crayola)");
7156 Color.a("#008000", "Green");
7157 Color.a("#00A877", "Green (Munsell)");
7158 Color.a("#009F6B", "Green (NCS)");
7159 Color.a("#00A550", "Green (pigment)");
7160 Color.a("#66B032", "Green (RYB)");
7161 Color.a("#ADFF2F", "Green-yellow");
7162 Color.a("#A99A86", "Grullo");
7163 Color.a("#663854", "Halaya ube");
7164 Color.a("#446CCF", "Han blue");
7165 Color.a("#5218FA", "Beyonce Purple");
7166 Color.a("#E9D66B", "Hansa yellow");
7167 Color.a("#3FFF00", "Harlequin");
7168 Color.a("#C90016", "Harvard crimson");
7169 Color.a("#DA9100", "Harvest gold");
7170 Color.a("#DF73FF", "Heliotrope");
7171 Color.a("#AA98A9", "Heliotrope gray");
7172 Color.a("#F0FFF0", "Honeydew");
7173 Color.a("#006DB0", "Honolulu blue");
7174 Color.a("#49796B", "Chloe's green");
7175 Color.a("#FF1DCE", "Hot magenta");
7176 Color.a("#FF69B4", "Hot pink");
7177 Color.a("#71A6D2", "Iceberg");
7178 Color.a("#FCF75E", "Icterine");
7179 Color.a("#319177", "Illuminating Emerald");
7180 Color.a("#602F6B", "Imperial");
7181 Color.a("#002395", "Imperial blue");
7182 Color.a("#66023C", "Imperial purple");
7183 Color.a("#ED2939", "Imperial red");
7184 Color.a("#B2EC5D", "Inchworm");
7185 Color.a("#4C516D", "Independence");
7186 Color.a("#138808", "India green");
7187 Color.a("#CD5C5C", "Indian red");
7188 Color.a("#E3A857", "Indian yellow");
7189 Color.a("#4B0082", "Indigo");
7190 Color.a("#002FA7", "International Klein Blue");
7191 Color.a("#FF4F00", "International orange (aerospace)");
7192 Color.a("#BA160C", "International orange (engineering)");
7193 Color.a("#C0362C", "International orange (Golden Gate Bridge)");
7194 Color.a("#5A4FCF", "Iris");
7195 Color.a("#F4F0EC", "Isabelline");
7196 Color.a("#009000", "Islamic green");
7197 Color.a("#B2FFFF", "Italian sky blue");
7198 Color.a("#FFFFF0", "Ivory");
7199 Color.a("#00A86B", "Jade");
7200 Color.a("#9D2933", "Japanese carmine");
7201 Color.a("#264348", "Japanese indigo");
7202 Color.a("#5B3256", "Japanese violet");
7203 Color.a("#D73B3E", "Jasper");
7204 Color.a("#A50B5E", "Jazzberry jam");
7205 Color.a("#DA614E", "Jelly Bean");
7206 Color.a("#343434", "Jet");
7207 Color.a("#F4CA16", "Jonquil");
7208 Color.a("#8AB9F1", "Jordy blue");
7209 Color.a("#BDDA57", "June bud");
7210 Color.a("#29AB87", "Jungle green");
7211 Color.a("#4CBB17", "Kelly green");
7212 Color.a("#7C1C05", "Kenyan copper");
7213 Color.a("#3AB09E", "Keppel");
7214 Color.a("#C3B091", "Khaki");
7215 Color.a("#E79FC4", "Kobi");
7216 Color.a("#354230", "Kombu green");
7217 Color.a("#E8000D", "KU Crimson");
7218 Color.a("#087830", "La Salle Green");
7219 Color.a("#D6CADD", "Languid lavender");
7220 Color.a("#26619C", "Lapis lazuli");
7221 Color.a("#A9BA9D", "Laurel green");
7222 Color.a("#CF1020", "Lava");
7223 Color.a("#B57EDC", "Lavender (floral)");
7224 Color.a("#CCCCFF", "Lavender blue");
7225 Color.a("#FFF0F5", "Lavender blush");
7226 Color.a("#C4C3D0", "Lavender gray");
7227 Color.a("#9457EB", "Lavender indigo");
7228 Color.a("#EE82EE", "Lavender magenta");
7229 Color.a("#E6E6FA", "Lavender mist");
7230 Color.a("#FBAED2", "Lavender pink");
7231 Color.a("#967BB6", "Lavender purple");
7232 Color.a("#FBA0E3", "Lavender rose");
7233 Color.a("#7CFC00", "Lawn green");
7234 Color.a("#FFF700", "Lemon");
7235 Color.a("#FFFACD", "Lemon chiffon");
7236 Color.a("#CCA01D", "Lemon curry");
7237 Color.a("#FDFF00", "Lemon glacier");
7238 Color.a("#E3FF00", "Lemon lime");
7239 Color.a("#F6EABE", "Lemon meringue");
7240 Color.a("#FFF44F", "Lemon yellow");
7241 Color.a("#1A1110", "Licorice");
7242 Color.a("#545AA7", "Liberty");
7243 Color.a("#FDD5B1", "Light apricot");
7244 Color.a("#ADD8E6", "Light blue");
7245 Color.a("#B5651D", "Light brown");
7246 Color.a("#E66771", "Light carmine pink");
7247 Color.a("#F08080", "Light coral");
7248 Color.a("#93CCEA", "Light cornflower blue");
7249 Color.a("#F56991", "Light crimson");
7250 Color.a("#E0FFFF", "Light cyan");
7251 Color.a("#FF5CCD", "Light deep pink");
7252 Color.a("#C8AD7F", "Light French beige");
7253 Color.a("#F984EF", "Light fuchsia pink");
7254 Color.a("#FAFAD2", "Light goldenrod yellow");
7255 Color.a("#D3D3D3", "Light gray");
7256 Color.a("#90EE90", "Light green");
7257 Color.a("#FFB3DE", "Light hot pink");
7258 Color.a("#F0E68C", "Light khaki");
7259 Color.a("#D39BCB", "Light medium orchid");
7260 Color.a("#ADDFAD", "Light moss green");
7261 Color.a("#E6A8D7", "Light orchid");
7262 Color.a("#B19CD9", "Light pastel purple");
7263 Color.a("#FFB6C1", "Light pink");
7264 Color.a("#E97451", "Light red ochre");
7265 Color.a("#FFA07A", "Light salmon");
7266 Color.a("#FF9999", "Light salmon pink");
7267 Color.a("#20B2AA", "Light sea green");
7268 Color.a("#87CEFA", "Light sky blue");
7269 Color.a("#778899", "Light slate gray");
7270 Color.a("#B0C4DE", "Light steel blue");
7271 Color.a("#B38B6D", "Light taupe");
7272 Color.a("#FFFFE0", "Light yellow");
7273 Color.a("#C8A2C8", "Lilac");
7274 Color.a("#BFFF00", "Lime");
7275 Color.a("#32CD32", "Lime green");
7276 Color.a("#9DC209", "Limerick");
7277 Color.a("#195905", "Prostitute green");
7278 Color.a("#FAF0E6", "Linen");
7279 Color.a("#6CA0DC", "Little boy blue");
7280 Color.a("#B86D29", "Liver (dogs)");
7281 Color.a("#6C2E1F", "Liver");
7282 Color.a("#987456", "Liver chestnut");
7283 Color.a("#FFE4CD", "Lumber");
7284 Color.a("#E62020", "Lust");
7285 Color.a("#FF00FF", "Magenta");
7286 Color.a("#CA1F7B", "Magenta (dye)");
7287 Color.a("#D0417E", "Magenta (Pantone)");
7288 Color.a("#FF0090", "Magenta (process)");
7289 Color.a("#9F4576", "Magenta haze");
7290 Color.a("#AAF0D1", "Magic mint");
7291 Color.a("#F8F4FF", "Magnolia");
7292 Color.a("#C04000", "Mahogany");
7293 Color.a("#6050DC", "Majorelle Blue");
7294 Color.a("#0BDA51", "Malachite");
7295 Color.a("#979AAA", "Manatee");
7296 Color.a("#FF8243", "Mango Tango");
7297 Color.a("#74C365", "Mantis"); //The colour of Mantis (#78cb53) - new fav colour
7298 Color.a("#880085", "Mardi Gras");
7299 Color.a("#800000", "Maroon");
7300 Color.a("#E0B0FF", "Mauve");
7301 Color.a("#915F6D", "Mauve taupe");
7302 Color.a("#EF98AA", "Mauvelous");
7303 Color.a("#4C9141", "May green");
7304 Color.a("#73C2FB", "Maya blue");
7305 Color.a("#E5B73B", "Golden");
7306 Color.a("#66DDAA", "Medium aquamarine");
7307 Color.a("#0000CD", "Medium blue");
7308 Color.a("#E2062C", "Medium candy apple red");
7309 Color.a("#AF4035", "Medium carmine");
7310 Color.a("#035096", "Medium electric blue");
7311 Color.a("#1C352D", "Medium jungle green");
7312 Color.a("#BA55D3", "Medium orchid");
7313 Color.a("#9370DB", "Medium purple");
7314 Color.a("#BB3385", "Medium red-violet");
7315 Color.a("#AA4069", "Medium ruby");
7316 Color.a("#3CB371", "Medium sea green");
7317 Color.a("#80DAEB", "Medium sky blue");
7318 Color.a("#7B68EE", "Medium slate blue");
7319 Color.a("#C9DC87", "Medium spring bud");
7320 Color.a("#00FA9A", "Medium spring green");
7321 Color.a("#674C47", "Medium taupe");
7322 Color.a("#48D1CC", "Medium turquoise");
7323 Color.a("#D9603B", "Pale vermilion");
7324 Color.a("#F8B878", "Mellow apricot");
7325 Color.a("#F8DE7E", "Mellow yellow");
7326 Color.a("#FDBCB4", "Melon");
7327 Color.a("#0A7E8C", "Metallic Seaweed");
7328 Color.a("#9C7C38", "Metallic Sunburst");
7329 Color.a("#E4007C", "Mexican pink");
7330 Color.a("#191970", "Midnight blue");
7331 Color.a("#004953", "Midnight green (eagle green)");
7332 Color.a("#FFC40C", "Mikado yellow");
7333 Color.a("#E3F988", "Mindaro");
7334 Color.a("#3EB489", "Mint");
7335 Color.a("#F5FFFA", "Mint cream");
7336 Color.a("#98FF98", "Mint green");
7337 Color.a("#FFE4E1", "Misty rose");
7338 Color.a("#73A9C2", "Moonstone blue");
7339 Color.a("#AE0C00", "Mordant red 19");
7340 Color.a("#8A9A5B", "Moss green");
7341 Color.a("#30BA8F", "Mountain Meadow");
7342 Color.a("#997A8D", "Mountbatten pink");
7343 Color.a("#18453B", "MSU Green");
7344 Color.a("#306030", "Mughal green");
7345 Color.a("#C54B8C", "Mulberry");
7346 Color.a("#FFDB58", "Mustard");
7347 Color.a("#317873", "Myrtle green");
7348 Color.a("#F6ADC6", "Nadeshiko pink");
7349 Color.a("#2A8000", "Napier green");
7350 Color.a("#FFDEAD", "Navajo white");
7351 Color.a("#000080", "Navy");
7352 Color.a("#FFA343", "Neon Carrot");
7353 Color.a("#FE4164", "Neon fuchsia");
7354 Color.a("#39FF14", "Neon green");
7355 Color.a("#214FC6", "New Car");
7356 Color.a("#D7837F", "New York pink");
7357 Color.a("#A4DDED", "Non-photo blue");
7358 Color.a("#059033", "North Texas Green");
7359 Color.a("#E9FFDB", "Nyanza");
7360 Color.a("#0077BE", "Ocean Boat Blue");
7361 Color.a("#CC7722", "Ochre");
7362 Color.a("#43302E", "Old burgundy");
7363 Color.a("#CFB53B", "Old gold");
7364 Color.a("#FDF5E6", "Old lace");
7365 Color.a("#796878", "Old lavender");
7366 Color.a("#673147", "Old mauve");
7367 Color.a("#867E36", "Old moss green");
7368 Color.a("#C08081", "Old rose");
7369 Color.a("#808000", "Olive");
7370 Color.a("#6B8E23", "Olive Drab #3");
7371 Color.a("#3C341F", "Olive Drab #7");
7372 Color.a("#9AB973", "Olivine");
7373 Color.a("#353839", "Onyx");
7374 Color.a("#B784A7", "Opera mauve");
7375 Color.a("#FF7F00", "Orange");
7376 Color.a("#FF7538", "Orange (Crayola)");
7377 Color.a("#FF5800", "Orange (Pantone)");
7378 Color.a("#FB9902", "Orange (RYB)");
7379 Color.a("#FFA500", "Orange (web)");
7380 Color.a("#FF9F00", "Orange peel");
7381 Color.a("#FF4500", "Orange-red");
7382 Color.a("#DA70D6", "Orchid");
7383 Color.a("#F2BDCD", "Orchid pink");
7384 Color.a("#FB4F14", "Orioles orange");
7385 Color.a("#414A4C", "Outer Space");
7386 Color.a("#FF6E4A", "Outrageous Orange");
7387 Color.a("#002147", "Oxford Blue");
7388 Color.a("#990000", "Crimson Red");
7389 Color.a("#006600", "Pakistan green");
7390 Color.a("#273BE2", "Palatinate blue");
7391 Color.a("#682860", "Palatinate purple");
7392 Color.a("#BCD4E6", "Pale aqua");
7393 Color.a("#AFEEEE", "Pale blue");
7394 Color.a("#987654", "Pale brown");
7395 Color.a("#9BC4E2", "Pale cerulean");
7396 Color.a("#DDADAF", "Pale chestnut");
7397 Color.a("#DA8A67", "Pale copper");
7398 Color.a("#ABCDEF", "Pale cornflower blue");
7399 Color.a("#E6BE8A", "Pale gold");
7400 Color.a("#EEE8AA", "Pale goldenrod");
7401 Color.a("#98FB98", "Pale green");
7402 Color.a("#DCD0FF", "Pale lavender");
7403 Color.a("#F984E5", "Pale magenta");
7404 Color.a("#FADADD", "Pale pink");
7405 Color.a("#DDA0DD", "Pale plum");
7406 Color.a("#DB7093", "Nipple");
7407 Color.a("#96DED1", "Pale robin egg blue");
7408 Color.a("#C9C0BB", "Pale silver");
7409 Color.a("#ECEBBD", "Pale spring bud");
7410 Color.a("#BC987E", "Pale taupe");
7411 Color.a("#78184A", "Pansy purple");
7412 Color.a("#009B7D", "Paolo Veronese green");
7413 Color.a("#FFEFD5", "Papaya whip");
7414 Color.a("#E63E62", "Paradise pink");
7415 Color.a("#AEC6CF", "Pastel blue");
7416 Color.a("#836953", "Pastel brown");
7417 Color.a("#CFCFC4", "Pastel gray");
7418 Color.a("#77DD77", "Pastel green");
7419 Color.a("#F49AC2", "Pastel magenta");
7420 Color.a("#FFB347", "Pastel orange");
7421 Color.a("#DEA5A4", "Pastel pink");
7422 Color.a("#B39EB5", "Pastel purple");
7423 Color.a("#FF6961", "Pastel red");
7424 Color.a("#CB99C9", "Pastel violet");
7425 Color.a("#FDFD96", "Pastel yellow");
7426 Color.a("#FFE5B4", "Peach");
7427 Color.a("#FFCC99", "Peach-orange");
7428 Color.a("#FFDAB9", "Peach puff");
7429 Color.a("#FADFAD", "Peach-yellow");
7430 Color.a("#D1E231", "Pear");
7431 Color.a("#EAE0C8", "Pearl");
7432 Color.a("#88D8C0", "Dolphin Aqua");
7433 Color.a("#B768A2", "Pearly purple");
7434 Color.a("#E6E200", "Peridot");
7435 Color.a("#1C39BB", "Persian blue");
7436 Color.a("#00A693", "Persian green");
7437 Color.a("#32127A", "Persian indigo");
7438 Color.a("#D99058", "Persian orange");
7439 Color.a("#F77FBE", "Persian pink");
7440 Color.a("#701C1C", "Persian plum");
7441 Color.a("#CC3333", "Persian red");
7442 Color.a("#FE28A2", "Persian rose");
7443 Color.a("#EC5800", "Persimmon");
7444 Color.a("#CD853F", "Peru");
7445 Color.a("#000F89", "Phthalo blue");
7446 Color.a("#123524", "Phthalo green");
7447 Color.a("#45B1E8", "Picton blue");
7448 Color.a("#C30B4E", "Pictorial carmine");
7449 Color.a("#FDDDE6", "Piggy pink");
7450 Color.a("#01796F", "Pine green");
7451 Color.a("#FFC0CB", "Pink");
7452 Color.a("#D74894", "Pink (Pantone)");
7453 Color.a("#FFDDF4", "Pink lace");
7454 Color.a("#D8B2D1", "Pink lavender");
7455 Color.a("#FF9966", "Pink-orange");
7456 Color.a("#E7ACCF", "Pink pearl");
7457 Color.a("#F78FA7", "Pink Sherbet");
7458 Color.a("#93C572", "Pistachio");
7459 Color.a("#E5E4E2", "Platinum");
7460 Color.a("#8E4585", "Plum");
7461 Color.a("#BE4F62", "Popstar");
7462 Color.a("#FF5A36", "Portland Orange");
7463 Color.a("#B0E0E6", "Powder blue");
7464 Color.a("#FF8F00", "Princeton orange");
7465 Color.a("#003153", "Prussian blue");
7466 Color.a("#DF00FF", "Psychedelic purple");
7467 Color.a("#CC8899", "Puce");
7468 Color.a("#644117", "Pullman Brown (UPS Brown)");
7469 Color.a("#FF7518", "Pumpkin");
7470 Color.a("#800080", "Purple");
7471 Color.a("#9F00C5", "Purple (Munsell)");
7472 Color.a("#A020F0", "Purple");
7473 Color.a("#69359C", "Purple Heart");
7474 Color.a("#9678B6", "Purple mountain majesty");
7475 Color.a("#4E5180", "Purple navy");
7476 Color.a("#FE4EDA", "Purple pizzazz");
7477 Color.a("#50404D", "Purple taupe");
7478 Color.a("#9A4EAE", "Purpureus");
7479 Color.a("#51484F", "Quartz");
7480 Color.a("#436B95", "Queen blue");
7481 Color.a("#E8CCD7", "Queen pink");
7482 Color.a("#8E3A59", "Quinacridone magenta");
7483 Color.a("#FF355E", "Radical Red");
7484 Color.a("#FBAB60", "Rajah");
7485 Color.a("#E30B5D", "Raspberry");
7486 Color.a("#E25098", "Raspberry pink");
7487 Color.a("#B3446C", "Raspberry rose");
7488 Color.a("#826644", "Raw umber");
7489 Color.a("#FF33CC", "Razzle dazzle rose");
7490 Color.a("#E3256B", "Razzmatazz");
7491 Color.a("#8D4E85", "Razzmic Berry");
7492 Color.a("#FF0000", "Red");
7493 Color.a("#EE204D", "Red (Crayola)");
7494 Color.a("#F2003C", "Red (Munsell)");
7495 Color.a("#C40233", "Red (NCS)");
7496 Color.a("#ED1C24", "Red (pigment)");
7497 Color.a("#FE2712", "Red (RYB)");
7498 Color.a("#A52A2A", "Red-brown");
7499 Color.a("#860111", "Red devil");
7500 Color.a("#FF5349", "Red-orange");
7501 Color.a("#E40078", "Red-purple");
7502 Color.a("#C71585", "Red-violet");
7503 Color.a("#A45A52", "Redwood");
7504 Color.a("#522D80", "Regalia");
7505 Color.a("#002387", "Resolution blue");
7506 Color.a("#777696", "Rhythm");
7507 Color.a("#004040", "Rich black");
7508 Color.a("#F1A7FE", "Rich brilliant lavender");
7509 Color.a("#D70040", "Rich carmine");
7510 Color.a("#0892D0", "Rich electric blue");
7511 Color.a("#A76BCF", "Rich lavender");
7512 Color.a("#B666D2", "Rich lilac");
7513 Color.a("#B03060", "Rich maroon");
7514 Color.a("#444C38", "Rifle green");
7515 Color.a("#704241", "Deep Roast coffee");
7516 Color.a("#00CCCC", "Robin egg blue");
7517 Color.a("#8A7F80", "Rocket metallic");
7518 Color.a("#838996", "Roman silver");
7519 Color.a("#F9429E", "Rose bonbon");
7520 Color.a("#674846", "Rose ebony");
7521 Color.a("#B76E79", "Rose gold");
7522 Color.a("#FF66CC", "Rose pink");
7523 Color.a("#C21E56", "Rose red");
7524 Color.a("#905D5D", "Rose taupe");
7525 Color.a("#AB4E52", "Rose vale");
7526 Color.a("#65000B", "Rosewood");
7527 Color.a("#D40000", "Rosso corsa");
7528 Color.a("#BC8F8F", "Rosy brown");
7529 Color.a("#0038A8", "Royal azure");
7530 Color.a("#002366", "Royal blue");
7531 Color.a("#4169E1", "Royal light blue");
7532 Color.a("#CA2C92", "Royal fuchsia");
7533 Color.a("#7851A9", "Royal purple");
7534 Color.a("#FADA5E", "Royal yellow");
7535 Color.a("#CE4676", "Ruber");
7536 Color.a("#D10056", "Rubine red");
7537 Color.a("#E0115F", "Ruby");
7538 Color.a("#9B111E", "Ruby red");
7539 Color.a("#FF0028", "Ruddy");
7540 Color.a("#BB6528", "Ruddy brown");
7541 Color.a("#E18E96", "Ruddy pink");
7542 Color.a("#A81C07", "Rufous");
7543 Color.a("#80461B", "Russet");
7544 Color.a("#679267", "Russian green");
7545 Color.a("#32174D", "Russian violet");
7546 Color.a("#B7410E", "Rust");
7547 Color.a("#DA2C43", "Rusty red");
7548 Color.a("#8B4513", "Saddle brown");
7549 Color.a("#FF6700", "Safety orange (blaze orange)");
7550 Color.a("#EED202", "Safety yellow");
7551 Color.a("#F4C430", "Saffron");
7552 Color.a("#BCB88A", "Sage");
7553 Color.a("#23297A", "St. Patrick's blue");
7554 Color.a("#FA8072", "Salmon");
7555 Color.a("#FF91A4", "Salmon pink");
7556 Color.a("#C2B280", "Sand");
7557 Color.a("#ECD540", "Sandstorm");
7558 Color.a("#F4A460", "Sandy brown");
7559 Color.a("#92000A", "Sangria");
7560 Color.a("#507D2A", "Sap green");
7561 Color.a("#0F52BA", "Sapphire");
7562 Color.a("#0067A5", "Sapphire blue");
7563 Color.a("#CBA135", "Satin sheen gold");
7564 Color.a("#FF2400", "Scarlet");
7565 Color.a("#FFD800", "School bus yellow");
7566 Color.a("#76FF7A", "Screamin' Green");
7567 Color.a("#006994", "Sea blue");
7568 Color.a("#2E8B57", "Sea green");
7569 Color.a("#321414", "Seal brown");
7570 Color.a("#FFF5EE", "Seashell");
7571 Color.a("#FFBA00", "Selective yellow");
7572 Color.a("#704214", "Sepia");
7573 Color.a("#8A795D", "Shadow");
7574 Color.a("#778BA5", "Shadow blue");
7575 Color.a("#FFCFF1", "Shampoo");
7576 Color.a("#009E60", "Shamrock green");
7577 Color.a("#8FD400", "Sheen Green");
7578 Color.a("#D98695", "Shimmering Blush");
7579 Color.a("#FC0FC0", "Shocking pink");
7580 Color.a("#882D17", "Sienna");
7581 Color.a("#C0C0C0", "Silver");
7582 Color.a("#ACACAC", "Silver chalice");
7583 Color.a("#5D89BA", "Silver Lake blue");
7584 Color.a("#C4AEAD", "Silver pink");
7585 Color.a("#BFC1C2", "Silver sand");
7586 Color.a("#CB410B", "Sinopia");
7587 Color.a("#007474", "Skobeloff");
7588 Color.a("#87CEEB", "Sky blue");
7589 Color.a("#CF71AF", "Sky magenta");
7590 Color.a("#6A5ACD", "Slate blue");
7591 Color.a("#708090", "Slate gray");
7592 Color.a("#C84186", "Smitten");
7593 Color.a("#738276", "Smoke");
7594 Color.a("#933D41", "Smokey topaz");
7595 Color.a("#100C08", "Smoky black");
7596 Color.a("#FFFAFA", "Snow");
7597 Color.a("#CEC8EF", "Soap");
7598 Color.a("#893843", "Solid pink");
7599 Color.a("#757575", "Sonic silver");
7600 Color.a("#9E1316", "Spartan Crimson");
7601 Color.a("#1D2951", "Space cadet");
7602 Color.a("#807532", "Spanish bistre");
7603 Color.a("#0070B8", "Spanish blue");
7604 Color.a("#D10047", "Spanish carmine");
7605 Color.a("#E51A4C", "Spanish crimson");
7606 Color.a("#989898", "Spanish gray");
7607 Color.a("#009150", "Spanish green");
7608 Color.a("#E86100", "Spanish orange");
7609 Color.a("#F7BFBE", "Spanish pink");
7610 Color.a("#E60026", "Spanish red");
7611 Color.a("#4C2882", "Spanish violet");
7612 Color.a("#007F5C", "Spanish viridian");
7613 Color.a("#0FC0FC", "Spiro Disco Ball");
7614 Color.a("#A7FC00", "Spring bud");
7615 Color.a("#00FF7F", "Spring green");
7616 Color.a("#007BB8", "Star command blue");
7617 Color.a("#4682B4", "Steel blue");
7618 Color.a("#CC33CC", "Steel pink");
7619 Color.a("#4F666A", "Stormcloud");
7620 Color.a("#E4D96F", "Straw");
7621 Color.a("#FC5A8D", "Strawberry");
7622 Color.a("#FFCC33", "Sunglow");
7623 Color.a("#E3AB57", "Sunray");
7624 Color.a("#FAD6A5", "Sunset");
7625 Color.a("#FD5E53", "Sunset orange");
7626 Color.a("#CF6BA9", "Super pink");
7627 Color.a("#D2B48C", "Tan");
7628 Color.a("#F94D00", "Tangelo");
7629 Color.a("#F28500", "Tangerine");
7630 Color.a("#FFCC00", "Tangerine yellow");
7631 Color.a("#483C32", "Dark Grayish Brown");
7632 Color.a("#8B8589", "Taupe gray");
7633 Color.a("#D0F0C0", "Tea green");
7634 Color.a("#F4C2C2", "Tea rose");
7635 Color.a("#008080", "Teal");
7636 Color.a("#367588", "Teal blue");
7637 Color.a("#99E6B3", "Teal deer");
7638 Color.a("#00827F", "Teal green");
7639 Color.a("#CF3476", "Telemagenta");
7640 Color.a("#CD5700", "Tenne");
7641 Color.a("#E2725B", "Terra cotta");
7642 Color.a("#D8BFD8", "Thistle");
7643 Color.a("#DE6FA1", "Thulian pink");
7644 Color.a("#FC89AC", "Tickle Me Pink");
7645 Color.a("#0ABAB5", "Tiffany Blue");
7646 Color.a("#E08D3C", "Tiger's eye");
7647 Color.a("#DBD7D2", "Timberwolf");
7648 Color.a("#EEE600", "Titanium yellow");
7649 Color.a("#FF6347", "Tomato");
7650 Color.a("#746CC0", "Toolbox");
7651 Color.a("#FFC87C", "Topaz");
7652 Color.a("#FD0E35", "Tractor red");
7653 Color.a("#00755E", "Tropical rain forest");
7654 Color.a("#0073CF", "True Blue");
7655 Color.a("#417DC1", "Tufts Blue");
7656 Color.a("#FF878D", "Tulip");
7657 Color.a("#DEAA88", "Tumbleweed");
7658 Color.a("#B57281", "Turkish rose");
7659 Color.a("#40E0D0", "Turquoise");
7660 Color.a("#00FFEF", "Turquoise blue");
7661 Color.a("#A0D6B4", "Turquoise green");
7662 Color.a("#7C4848", "Tuscan red");
7663 Color.a("#C09999", "Tuscany");
7664 Color.a("#8A496B", "Twilight lavender");
7665 Color.a("#0033AA", "UA blue");
7666 Color.a("#D9004C", "UA red");
7667 Color.a("#8878C3", "Ube");
7668 Color.a("#536895", "UCLA Blue");
7669 Color.a("#FFB300", "UCLA Gold");
7670 Color.a("#3CD070", "UFO Green");
7671 Color.a("#120A8F", "Ultramarine");
7672 Color.a("#4166F5", "Ultramarine blue");
7673 Color.a("#FF6FFF", "Ultra pink");
7674 Color.a("#635147", "Umber");
7675 Color.a("#FFDDCA", "Unbleached silk");
7676 Color.a("#5B92E5", "United Nations blue");
7677 Color.a("#B78727", "University of California Gold");
7678 Color.a("#FFFF66", "Unmellow yellow");
7679 Color.a("#7B1113", "UP Maroon");
7680 Color.a("#AE2029", "Upsdell red");
7681 Color.a("#E1AD21", "Urobilin");
7682 Color.a("#004F98", "USAFA blue");
7683 Color.a("#F77F00", "University of Tennessee Orange");
7684 Color.a("#D3003F", "Utah Crimson");
7685 Color.a("#F3E5AB", "Vanilla");
7686 Color.a("#F38FA9", "Vanilla ice");
7687 Color.a("#C5B358", "Vegas gold");
7688 Color.a("#C80815", "Venetian red");
7689 Color.a("#43B3AE", "Verdigris");
7690 Color.a("#E34234", "Medium vermilion");
7691 Color.a("#D9381E", "Vermilion");
7692 Color.a("#8F00FF", "Violet");
7693 Color.a("#7F00FF", "Violet (color wheel)");
7694 Color.a("#8601AF", "Violet (RYB)");
7695 Color.a("#324AB2", "Logie Bear");
7696 Color.a("#F75394", "Violet-red");
7697 Color.a("#40826D", "Viridian");
7698 Color.a("#009698", "Viridian green");
7699 Color.a("#922724", "Vivid auburn");
7700 Color.a("#9F1D35", "Vivid burgundy");
7701 Color.a("#DA1D81", "Vivid cerise");
7702 Color.a("#CC00FF", "Vivid orchid");
7703 Color.a("#00CCFF", "Vivid sky blue");
7704 Color.a("#FFA089", "Vivid tangerine");
7705 Color.a("#9F00FF", "Vivid violet");
7706 Color.a("#004242", "Warm black");
7707 Color.a("#A4F4F9", "Waterspout");
7708 Color.a("#645452", "Wenge");
7709 Color.a("#F5DEB3", "Wheat");
7710 Color.a("#FFFFFF", "White");
7711 Color.a("#F5F5F5", "White smoke");
7712 Color.a("#A2ADD0", "Wild blue yonder");
7713 Color.a("#D470A2", "Wild orchid");
7714 Color.a("#FF43A4", "Wild Strawberry");
7715 Color.a("#FC6C85", "Wild watermelon");
7716 Color.a("#FD5800", "Willpower orange");
7717 Color.a("#A75502", "Windsor tan");
7718 Color.a("#722F37", "Wine");
7719 Color.a("#C9A0DC", "Wisteria");
7720 Color.a("#C19A6B", "Wood brown");
7721 Color.a("#738678", "Xanadu");
7722 Color.a("#0F4D92", "Yale Blue");
7723 Color.a("#1C2841", "Yankees blue");
7724 Color.a("#FCE883", "Yellow Crayola");
7725 Color.a("#EFCC00", "Yellow Munsell");
7726 Color.a("#FEDF00", "Yellow Pantone");
7727 Color.a("#FEFE33", "Yellow");
7728 Color.a("#9ACD32", "Yellow Green");
7729 Color.a("#FFAE42", "Yellow Orange");
7730 Color.a("#FFF000", "Yellow rose");
7731 Color.a("#0014A8", "Zaffre");
7732 Color.a("#2C1608", "Zinnwaldite brown");
7733 Color.a("#39A78E", "Zomp");
7734
7735 // where it receives the message
7736 gClient.on("a", function (msg) {
7737 chat.receive(msg);
7738 });
7739
7740 $("#chat input").on("focus", function (evt) {
7741 releaseKeyboard();
7742 $("#chat").addClass("chatting");
7743 chat.scrollToBottom();
7744 });
7745
7746 $(document).mousedown(function (evt) {
7747 if (!$("#chat").has(evt.target).length > 0) {
7748 chat.blur();
7749 }
7750 });
7751
7752 document.addEventListener("touchstart", function (event) {
7753 for (var i in event.changedTouches) {
7754 var touch = event.changedTouches[i];
7755 if (!$("#chat").has(touch.target).length > 0) {
7756 chat.blur();
7757 }
7758 }
7759 });
7760
7761 $(document).on("keydown", function (evt) {
7762 if ($("#chat").hasClass("chatting")) {
7763 if (evt.keyCode == 27) {
7764 chat.blur();
7765 evt.preventDefault();
7766 evt.stopPropagation();
7767 } else if (evt.keyCode == 13) {
7768 $("#chat input").focus();
7769 }
7770 } else if (!gModal && (evt.keyCode == 27 || evt.keyCode == 13)) {
7771 $("#chat input").focus();
7772 }
7773 });
7774
7775 $("#chat input").on("keydown", function (evt) {
7776 if (evt.keyCode == 13) {
7777 var message = $(this).val();
7778
7779 // ♥ // local commands // ♥ //
7780
7781 if (message.length == 0) { //close chat if no input
7782 chat.blur();
7783
7784 } else if (message.substring(0, 6).toLowerCase() == cmdChar+"lhelp" || message.substring(0, 6).toLowerCase() == "!lhelp") { //local command list
7785 // thanks Someguy!
7786 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)");
7787 $(this).val(""); //empties chatbox
7788 chat.blur(); //closes chat
7789
7790 } else if (message.substring(0, 5).toLowerCase() == cmdChar+"name" || message.substring(0, 5).toLowerCase() == "!name") { //name
7791 if (message.substring(5).trim() == "") {
7792 msgBox('Rename', 'Usage: '+cmdChar+'name new_name.', 3000, '#piano');
7793
7794 } else {
7795 gClient.sendArray([{
7796 "m": "userset",
7797 "set": {
7798 "name": message.substring(5).trim()
7799 }
7800 }]);
7801 selfName = message.substring(5).trim();
7802 msgBox('Renamed', message.substring(5).trim(), 3000, '#piano');
7803 }
7804 $(this).val("");
7805 chat.blur();
7806
7807 } else if (message.substring(0, 5).toLowerCase() == cmdChar+"svol" || message.substring(0, 5).toLowerCase() == "!svol") { //speech volume
7808 var speechVolumeTEMP = message.substring(6).trim()
7809 if (isNaN(speechVolumeTEMP) || speechVolumeTEMP > 1 || speechVolumeTEMP < 0 || speechVolumeTEMP == '') {
7810 msgBox('Speech Volume [usage]', 'Please enter a number no greater than 1 and no less than 0.', 5000, '#piano');
7811 $(this).val("");
7812 chat.blur();
7813 return;
7814
7815 } else {
7816 speechVolume = speechVolumeTEMP; //sets new variable value
7817 msgBox('Speech Volume', speechVolume, 3000, '#piano');
7818
7819 $(this).val("");
7820 chat.blur();
7821 }
7822
7823 } else if (message.substring(0, 7).toLowerCase() == cmdChar+"spitch" || message.substring(0, 7).toLowerCase() == "!spitch") { //speech pitch
7824 var speechPitchTEMP = message.substring(8).trim()
7825 if (isNaN(speechPitchTEMP) || speechPitchTEMP > 2 || speechPitchTEMP < 0 || speechPitchTEMP == '') {
7826 msgBox('Speech Pitch [usage]', 'Please enter a number no greater than 2 and no less than 0.', 5000, '#piano');
7827 $(this).val("");
7828 chat.blur();
7829 return;
7830
7831 } else {
7832 speechPitch = message.substring(8).trim() //sets new variable value
7833 msgBox('Pitch', speechPitch, 3000, '#piano');
7834 $(this).val("");
7835 chat.blur();
7836 }
7837
7838 } else if (message.substring(0, 6).toLowerCase() == cmdChar+"srate" || message.substring(0, 6).toLowerCase() == "!srate") { //speech rate
7839 var speechRateTEMP = message.substring(7).trim()
7840 if (isNaN(speechRateTEMP) || speechRateTEMP > 2 || speechRateTEMP < 0 || speechRateTEMP == '') {
7841 msgBox('Speech Pitch [usage]', 'Please enter a number no greater than 2 and no less than 0.', 5000, '#piano');
7842 $(this).val("");
7843 chat.blur();
7844 return;
7845
7846 } else {
7847 speechRate = message.substring(7).trim() //sets new variable value
7848 msgBox('Rate', speechRate, 3000, '#piano');
7849 $(this).val("");
7850 chat.blur();
7851 }
7852
7853 } else if (message.substring(0, 9).toLowerCase() == cmdChar+"sdefault" || message.substring(0, 9).toLowerCase() == "!sdefault") { //speech default
7854 speechVolume = 0.5; //default volume for spoken text
7855 speechPitch = 1; //default pitch for spoken text
7856 speechRate = 1; //default speed for spoken text
7857 msgBox('Speech Default', 'Volume, pitch and rate all reset.', 3000, '#piano');
7858 $(this).val("");
7859 chat.blur();
7860
7861 } else if (message.substring(0, 6).toLowerCase() == cmdChar+"lobby" || message.substring(0, 6).toLowerCase() == "!lobby") { //lobby
7862 if (gClient.isOwner()) {
7863 var lobbyConfirm = prompt("Are you sure you want to turn this room into a lobby?\nThis cannot be undone.\n\nEnter \"Yes, I am sure.\" below to continue.");
7864 if (lobbyConfirm == "Yes, I am sure.") {
7865 MPP.client.sendArray([{m: "chset", set: {lobby: true}}]);
7866 msgBox('Room is now a lobby', '', 3000, '#piano');
7867 } else {
7868 alert("Incorrectly entered text or you cancled.");
7869 }
7870
7871 } else {
7872 alert("You're not the owner of this room!");
7873 }
7874
7875 $(this).val("");
7876 chat.blur();
7877
7878 } else if (message.substring(0, 9).toLowerCase() == cmdChar+"givefish" || message.substring(0, 9).toLowerCase() == "!givefish") { //give fish
7879 giveFish = !giveFish;
7880 if (!giveFish) {
7881 msgBox('Give Fish', 'Off', 3000, '#piano');
7882
7883 } else {
7884 msgBox('Give Fish', 'On', 3000, '#piano');
7885 }
7886
7887 $(this).val("");
7888 chat.blur();
7889
7890 } else if (message.substring(0, 9).toLowerCase() == cmdChar+"fishlord" || message.substring(0, 9).toLowerCase() == "!fishlord") { //fish lord
7891 fishLord = message.substring(10).trim();
7892 if (fishLord == '') {
7893 msgBox('Fish Lord [usage]', cmdChar+'fishlord name_here', 3000, '#piano');
7894 $(this).val("");
7895 chat.blur();
7896 return;
7897 }
7898 msgBox('Fish Lord', 'Fish lord: ' + fishLord, 3000, '#piano');
7899 $(this).val("");
7900 chat.blur();
7901
7902 } else if (message.substring(0, 7).toLowerCase() == cmdChar+"juggle" || message.substring(0, 7).toLowerCase() == "!juggle") { //juggle
7903 function jugglePls() {
7904 juggling = setInterval(function() {
7905 gClient.sendArray([{
7906 m: "chown"
7907 }]);
7908 }, 2100); //2300 is good for just the dropping of it
7909 }
7910
7911 if (juggle) {
7912 juggle = false;
7913 clearInterval(juggling);
7914
7915 gClient.sendArray([{
7916 m: "chown",
7917 id: gClient.participantId
7918 }]);
7919 msgBox('Juggle Crown', 'Off', 2000, '#piano');
7920
7921 } else {
7922 juggle = true;
7923 jugglePls();
7924 msgBox('Juggle Crown', 'On', 2000, '#piano');
7925 }
7926
7927 $(this).val("");
7928 chat.blur();
7929
7930 } else if (message.substring(0, 10).toLowerCase() == cmdChar+"mathcheat" || message.substring(0, 10).toLowerCase() == "!mathcheat") { //juggle
7931 if (mathCheat) {
7932 mathCheat = false;
7933 msgBox('Math Cheats', 'Off', 2000, '#piano');
7934 } else {
7935 mathCheat = true;
7936 msgBox('Math Cheats', 'On', 2000, '#piano');
7937 }
7938
7939 $(this).val("");
7940 chat.blur();
7941
7942 // ♥ // local commands // ♥ //
7943
7944 } else if (message.length <= 512) {
7945 if (!meow && !leet) {
7946 //console.log("Triggered first");
7947 chat.send(message);
7948 $(this).val("");
7949 chat.blur();
7950 }
7951 if (message.substring(0,1).trim() != "!" && message.substring(0,1).trim() != "/" && message.substring(0,1).trim() != cmdChar) {
7952 if (meow) {
7953 //thanks electrashave!
7954 leet = false;
7955 var words = ['meow', 'meow', 'mew', 'purr'];
7956 var final = '';
7957 for (var i = 0; words.length > i; i++) {
7958 final += words[Math.floor(Math.random()*words.length)] + ' ';
7959 }
7960 final = final.toLowerCase();
7961 final = final.charAt(0).toUpperCase() + final.slice(1).trim() + '. *' + message.trim() + '*';
7962 chat.send(final);
7963 $(this).val("");
7964 chat.blur();
7965
7966 } else if (!leet){
7967 $(this).val("");
7968 chat.blur();
7969 }
7970
7971 if (leet) {
7972 meow = false;
7973 var alpha1 = "abcdefghijklmnopqrstuvwxyz0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789~`?-=[]\;'\",./_+{}|:<>!@#$%^&*()♥°¬";
7974 var alpha2 = "4bcd3fgh1jklmn0pqrstuvwxyz0123456789 4BCD3FGH1JKLMN0PQRSTUVWXYZ0123456789~`?-=[]\;'\",./_+{}|:<>!@#$%^&*()♥°¬";
7975 var str = message;
7976 var newstr = '';
7977 for (var i = 0; i < str.length; i++) {
7978 charPos = alpha1.indexOf(str.charAt(i));
7979 newstr += alpha2.charAt(charPos);
7980 }
7981 chat.send(newstr);
7982 $(this).val("");
7983 chat.blur();
7984
7985 } else if (!meow) {
7986 $(this).val("");
7987 chat.blur();
7988 }
7989
7990 } else if (meow || leet) {
7991 //console.log("Triggered final");
7992 chat.send(message);
7993 $(this).val("");
7994 chat.blur();
7995 }
7996
7997 }
7998
7999 evt.preventDefault();
8000 evt.stopPropagation();
8001 } else if (evt.keyCode == 27) {
8002 chat.blur();
8003 evt.preventDefault();
8004 evt.stopPropagation();
8005 } else if (evt.keyCode == 9) {
8006 evt.preventDefault();
8007 evt.stopPropagation();
8008 }
8009 });
8010
8011 return {
8012 show: function () {
8013 $("#chat").fadeIn();
8014 },
8015
8016 hide: function () {
8017 $("#chat").fadeOut();
8018 },
8019
8020 clear: function () {
8021 if (clearChat) {
8022 $("#chat li").remove();
8023 return;
8024 }
8025 },
8026
8027 scrollToBottom: function () {
8028 var ele = $("#chat ul").get(0);
8029 ele.scrollTop = ele.scrollHeight;
8030 },
8031
8032 blur: function () {
8033 if ($("#chat").hasClass("chatting")) {
8034 $("#chat input").get(0).blur();
8035 $("#chat").removeClass("chatting");
8036 chat.scrollToBottom();
8037 captureKeyboard();
8038 }
8039 },
8040
8041 send: function (message) {
8042 gClient.sendArray([{
8043 m: "a",
8044 message: message
8045 }]);
8046 },
8047
8048
8049 receive: function (msg) {
8050 if (gChatMutes.indexOf(msg.p._id) != -1) return;
8051 msg.a = msg.a.replace(/</g, '<');
8052 msg.p.name = msg.p.name.replace(/</g, '<');
8053 content = msg.a.replace(/((https?\:\/\/|ftp\:\/\/)|(www\.))(\S+)(\w{2,4})(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/gi, function(url) {
8054 nice = url;
8055 if( url.match('^https?:\/\/') ) nice = nice.replace(/^https?:\/\//i,'')
8056 else url = 'http://' + url;
8057
8058 return '<a target="_blank" style="text-decoration: none;" href="'+ url +'">'+ url +'</a>';
8059 });
8060 var final = content;
8061
8062 var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
8063
8064 var li = $('<li><span class="name"/><span style="position: initial!important;" class="message"/>');
8065
8066 li.find(".name").html(msg.p.name + afterName); //fix for <3 showing up as lt;3 using .text instead of .html -thanks Someguy
8067 if (debug) {
8068 li.find(".name").html("[" + msg.p._id + "] " + msg.p.name + afterName);
8069 }
8070 if (timeStamp) {
8071 li.find(".name").html(getTime() + " | " + msg.p.name + afterName);
8072 }
8073 li.find(".message").html(
8074 "<span class='msg_'>"+ final + "</span>"
8075 );
8076
8077 li.css("color", msg.p.color || "white");
8078
8079 $("#chat ul").append(li);
8080
8081 var eles = $("#chat ul li").get();
8082 for (var i = 1; i <= 50 && i <= eles.length; i++) {
8083 eles[eles.length - i].style.opacity = 1.0 - (i * 0.03); //chat fade
8084 }
8085 if (eles.length > 50) {
8086 eles[0].style.display = "none";
8087 }
8088 if (eles.length > chatLimit) { //max chat log history default was 256
8089 $(eles[0]).remove();
8090 }
8091 updateChatLength(eles.length);
8092
8093 // scroll to bottom if not "chatting" or if not scrolled up
8094 if (!$("#chat").hasClass("chatting")) {
8095 chat.scrollToBottom();
8096 } else {
8097 var ele = $("#chat ul").get(0);
8098 if (ele.scrollTop > ele.scrollHeight - ele.offsetHeight - 50)
8099 chat.scrollToBottom();
8100 }
8101 if (debug2) {
8102 // test
8103 //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
8104 //length of msg: $('#chat li .msg_').get(0).innerHTML.length
8105 var myString = $('#chat li:last .msg_').get(0).innerHTML;
8106 var cut = myString.length;
8107 console.log("length: " + cut);
8108 var myArray = myString.split("");
8109 var loopTimer = 70;
8110 console.log('before loop ' + myString);
8111 $('#chat li:last .msg_').get(0).innerHTML = myString.substring(cut, cut);
8112 var frameLooper = setInterval( function() {
8113 console.log('looping ' + myString);
8114 if(myArray.length > 0) {
8115 $('#chat li:last .msg_').get(0).innerHTML += myArray.shift();
8116 } else {
8117 clearInterval(frameLooper);
8118 console.log('clearing loop ' + myString);
8119 return false;
8120 }
8121 }, loopTimer);
8122 console.log('done ' + myString);
8123
8124 //$('#chat li:last .msg_').get(0).innerHTML
8125
8126 // test
8127 }
8128
8129
8130 }
8131 };
8132
8133 })();
8134
8135
8136 clearChatFunc = function() {
8137 chat.clear();
8138 updateChatLength(0);
8139 }
8140
8141
8142 // use midi bridge (old one started here)
8143 $("#blah-btn").on("click", function (evt) {
8144 var pRoom = prompt("Enter the name of your lobby...", hotkeyRoom);
8145 if (!pRoom) return;
8146 var room_name = pRoom;
8147 changeRoom(room_name, "right", {
8148 "visible": true,
8149 "chat": true,
8150 "crownsolo": false,
8151 "lobby": true
8152 });
8153 });
8154
8155 // use midi bridge (old one ended here)
8156
8157
8158 // New MIDI
8159 var gWebMidiWorking;
8160 (function() {
8161
8162 MIDI_TRANSPOSE = -12;
8163
8164 var MIDI_KEY_NAMES = ["a-1", "as-1", "b-1"];
8165 var bare_notes = "c cs d ds e f fs g gs a as b".split(" ");
8166 for(var oct = 0; oct < 7; oct++) {
8167 for(var i in bare_notes) {
8168 MIDI_KEY_NAMES.push(bare_notes[i] + oct);
8169 }
8170 }
8171 MIDI_KEY_NAMES.push("c7");
8172
8173 if (navigator.requestMIDIAccess) {
8174 navigator.requestMIDIAccess().then(
8175 function(midi) {
8176 console.log(midi);
8177 if(midi.inputs.size > 0) {
8178 var inputs = midi.inputs.values();
8179 for(var input_it = inputs.next(); input_it && !input_it.done; input_it = inputs.next()) {
8180 var input = input_it.value;
8181 console.log(input);
8182 input.onmidimessage = function(evt) {
8183 var channel = evt.data[0] & 0xf;
8184 var cmd = evt.data[0] >> 4;
8185 var note_number = evt.data[1];
8186 var vel = evt.data[2];
8187 //console.log(channel, cmd, note_number, vel);
8188 if(cmd == 8 || (cmd == 9 && vel == 0)) {
8189 // NOTE_OFF
8190 release(MIDI_KEY_NAMES[note_number - 9 + MIDI_TRANSPOSE]);
8191 } else if(cmd == 9) {
8192 // NOTE_ON
8193 press(MIDI_KEY_NAMES[note_number - 9 + MIDI_TRANSPOSE], vel / 100);
8194 } else if(cmd == 11) {
8195 // CONTROL_CHANGE
8196 if(!gAutoSustain) {
8197 if(note_number == 64) {
8198 if(vel > 0) {
8199 pressSustain();
8200 } else {
8201 releaseSustain();
8202 }
8203 }
8204 }
8205 }
8206 };
8207 if(!gWebMidiWorking) {
8208 gWebMidiWorking = true;
8209 new Notification({title:"Nice!", text:"Web MIDI is going.", duration:2000}); //MIDI working
8210 }
8211 }
8212 } else {
8213 console.log("no midi inputs");
8214 gWebMidiWorking = false;
8215 }
8216 if(gMidiOutTest && midi.outputs.size > 0) {
8217 var outputs = midi.outputs.values();
8218 for(var output_it = outputs.next(); output_it && !output_it.done; output_it = outputs.next()) {
8219 var output = output_it.value;
8220 console.log(output);
8221 }
8222 gMidiOutTest = function(note_name, vel, delay_ms) {
8223 var note_number = MIDI_KEY_NAMES.indexOf(note_name);
8224 if(note_number == -1) return;
8225 note_number = note_number + 9 - MIDI_TRANSPOSE;
8226
8227 var outputs = midi.outputs.values();
8228 for(var output_it = outputs.next(); output_it && !output_it.done; output_it = outputs.next()) {
8229 var output = output_it.value;
8230 output.send([0x90, note_number, vel], window.performance.now() + delay_ms);
8231 }
8232 }
8233 }
8234 },
8235 function(err){
8236 console.log(err);
8237 gWebMidiWorking = false;
8238 } );
8239 }
8240 })();
8241
8242
8243
8244 //More button
8245 (function () {
8246 var loaded = false;
8247 $("#social").fadeIn(250);
8248 $("#more-button").click(function () {
8249 //stuff goes between here and..
8250 if (leet) {
8251 leet = false;
8252 } else {
8253 leet = true;
8254 }
8255 msgBox('1337 Mode', ''+leet, 2000, '#piano');
8256 });
8257 })();
8258
8259
8260 //api
8261 //window.MPP
8262 MPP = {
8263 press: press,
8264 release: release,
8265 piano: gPiano,
8266 client: gClient,
8267 chat: chat,
8268 msgBox: msgBox
8269 };
8270
8271
8272});
8273//main end
8274
8275//Thanks B@K$
8276MPP.client.sendArray = function(arr) {
8277 if (arr[0].m == "m") {
8278 logie = this;
8279 logie.participantUpdate({
8280 id: logie.participantId
8281 , x: parseFloat(arr[0].x)
8282 , y: parseFloat(arr[0].y)
8283 , m: "m"
8284 });
8285 }
8286 this.send(JSON.stringify(arr));
8287}
8288
8289// miscellaneous HTML changes
8290 // default place holder for chat
8291 $("#chat .translate").attr("placeholder", "")
8292
8293// miscellaneous HTML changes
8294
8295//HTML Stuff (note: the big buttons are 120px apart and the heart buttons are 25px apart -Logan)
8296//button 1
8297$("body #bottom .relative").append('<div id="1-btn" class="ugly-button 1_btn" style="position: fixed;bottom: 29px;right: 365px;width: 100px">Toggle Piano</div>');
8298$("#1-btn").click(function(){
8299 $("#piano").fadeToggle(1000);
8300});
8301
8302//Joke Generator
8303//button 2
8304$("body #bottom .relative").append('<div id="2-btn" class="ugly-button 2_btn" style="position: fixed;bottom: 29px;right: 245px;width: 100px">Joke Generator</div>');
8305$("#2-btn").click(function(){
8306 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', 'igunana', 'lemming', 'crab', 'ladybird', 'rinoceros'];
8307 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'];
8308 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.'];
8309 var Aselection = Math.floor(Math.random() * Animal.length);
8310 var Lselection = Math.floor(Math.random() * Location.length);
8311 var Pselection = Math.floor(Math.random() * Punchline.length);
8312 jokeGens++;
8313 document.getElementById("2-btn").innerHTML = "Joke Generator " + jokeGens
8314 sendChat("[Joke Generator #" + jokeGens + "] Why did the " + Animal[Aselection] + " cross the " + Location[Lselection] + "? " + Punchline[Pselection]);
8315});
8316
8317//Bunny ASCII Art
8318//button 3
8319$("body #bottom .relative").append('<div id="3-btn" class="ugly-button 3_btn" style="position: fixed;bottom: 29px;right: 125px;width: 100px">Bunny ASCII Art</div>');
8320$("#3-btn").click(function(){
8321
8322 });
8323
8324//♥ Test Button ♥
8325//button 4
8326function updateChatLength(num) {
8327 document.getElementById("4-btn").innerHTML = "Msgs: " + num;
8328}
8329$("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>');
8330$("#4-btn").click(function(){
8331 var yayNayChat = confirm("Do you want to clear the chat?");
8332
8333 if (yayNayChat) {
8334 clearChat = true;
8335 clearChatFunc();
8336 clearChat = false;
8337 }
8338});
8339
8340//♥ button 5
8341$("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>');
8342$("#5-btn").click(function(){
8343 if (debug) {
8344 //off
8345 debug = false;
8346 document.getElementById("5-btn").style.color = "red";
8347 } else {
8348 //on
8349 debug = true;
8350 document.getElementById("5-btn").style.color = "green";
8351 }
8352});
8353
8354//♥ button 6
8355$("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>');
8356$("#6-btn").click(function(){
8357 document.getElementById("6-btn").style.color = Col();
8358 //nothing as of now
8359});
8360
8361//♥ button 7
8362$("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>');
8363$("#7-btn").click(function(){
8364 document.getElementById("7-btn").style.color = Col();
8365 //nothing as of now
8366});
8367
8368//♥ button 8
8369$("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>');
8370$("#8-btn").click(function(){
8371 document.getElementById("8-btn").style.color = Col();
8372 //nothing as of now
8373});
8374
8375//♥ button 9
8376$("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>');
8377$("#9-btn").click(function(){
8378 document.getElementById("9-btn").style.color = Col();
8379 //nothing as of now
8380});
8381
8382//♥ button 10
8383$("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>');
8384$("#10-btn").click(function(){
8385 document.getElementById("10-btn").style.color = Col();
8386 //nothing as of now
8387});
8388
8389//♥ button 11
8390$("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>');
8391$("#11-btn").click(function(){
8392 document.getElementById("11-btn").style.color = Col();
8393 //nothing as of now
8394});
8395
8396//♥ button 12
8397$("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>');
8398$("#12-btn").click(function(){
8399 document.getElementById("12-btn").style.color = Col();
8400 //nothing as of now
8401});
8402
8403//♥ button 13
8404$("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>');
8405$("#13-btn").click(function(){
8406 document.getElementById("13-btn").style.color = Col();
8407 //nothing as of now
8408});
8409
8410//♥ button 14
8411$("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>');
8412$("#14-btn").click(function(){
8413 document.getElementById("14-btn").style.color = Col();
8414 //nothing as of now
8415});
8416
8417//♥ button 15
8418$("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>');
8419$("#15-btn").click(function(){
8420 document.getElementById("15-btn").style.color = Col();
8421 //nothing as of now
8422});
8423
8424//♥ button 16
8425$("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>');
8426var playingMid = false;
8427document.getElementById("16-btn").style.color = "red";
8428$("#16-btn").click(function(){
8429 if (!playingMid) {
8430 //MIDIjs.play('http://localhost:3000/midis/logan.mid');
8431 playingMid = true;
8432 document.getElementById("16-btn").style.color = "green";
8433 } else {
8434 //MIDIjs.stop();
8435 document.getElementById("16-btn").style.color = "red";
8436 playingMid = false;
8437 }
8438});
8439
8440//♥ button 17
8441$("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>');
8442var spinning = false;
8443document.getElementById("17-btn").style.color = "red";
8444$("#17-btn").click(function(){
8445 if (spinning) {
8446 document.getElementById("17-btn").style.color = "red";
8447 $("#piano").removeClass("spin");
8448 spinning = false;
8449 } else {
8450 document.getElementById("17-btn").style.color = "green";
8451 $("#piano").addClass("spin");
8452 spinning = true;
8453 }
8454});
8455
8456//♥ button 18
8457$("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>');
8458$("#18-btn").click(function(){
8459 document.getElementById("18-btn").style.color = Col();
8460 MPP.press("b1", volume); MPP.press("fs2", volume); MPP.press("d2", volume); MPP.press("b2", volume); MPP.press("b-1", volume);
8461});
8462
8463//♥ button 19
8464$("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>');
8465$("#19-btn").click(function(){
8466 document.getElementById("19-btn").style.color = Col();
8467 MPP.press("b1", volume); MPP.press("fs2", volume); MPP.press("ds2", volume); MPP.press("b2", volume); MPP.press("b-1", volume);
8468});
8469
8470//♥ button 20
8471$("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>');
8472$("#20-btn").click(function(){
8473 document.getElementById("20-btn").style.color = Col();
8474 MPP.press("cs2", volume); MPP.press("e2", volume); MPP.press("as2", volume); MPP.press("fs0", volume);
8475});
8476
8477//♥ button 21
8478$("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>');
8479$("#21-btn").click(function(){
8480 document.getElementById("21-btn").style.color = Col();
8481 MPP.press("cs2", volume); MPP.press("e2", volume); MPP.press("gs2", volume); MPP.press("cs0", volume);
8482});
8483
8484//♥ button 22
8485$("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>');
8486$("#22-btn").click(function(){
8487 document.getElementById("22-btn").style.color = Col();
8488 MPP.press("c2", volume); MPP.press("fs2", volume); MPP.press("gs2", volume);
8489});
8490
8491//♥ button 23
8492$("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>');
8493$("#23-btn").click(function(){
8494 document.getElementById("23-btn").style.color = Col();
8495 MPP.press("b1", volume); MPP.press("e2", volume); MPP.press("gs2", volume);
8496});
8497
8498//♥ button 24
8499$("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>');
8500$("#24-btn").click(function(){
8501 setCmdChar();
8502 updateCmdChar(cmdChar);
8503
8504});
8505
8506// le label
8507$("body").append('<div id="resource-label" style="position: fixed; bottom: 529px; right: 17px;">Resource Monitor</div>');
8508
8509// thanks http://stackoverflow.com/users/165737/anurag
8510$("body #resource-label").css("fontSize", "11px");
8511
8512console.log(window.performance.now() - startUpDelay);
8513
8514// @copyright 2015+, electrashave
8515if (window.localStorage) {
8516 if (!localStorage.soundpack) {
8517 localStorage.soundpack = JSON.stringify({
8518 url: '/mp3/',
8519 ext: '.wav.mp3',
8520 name: 'MPP Default'
8521 });
8522 }
8523}
8524var soundpack = JSON.parse(localStorage.soundpack);
8525
8526$("#volume-label").text("Volume: " + Math.floor(MPP.piano.audio.volume * 100) + "%");
8527$(".volume-slider").on("mousemove", function(evt) {
8528 var v = evt.srcElement.value;
8529 MPP.piano.audio.setVolume(v);
8530 if (window.localStorage) localStorage.volume = v;
8531 $("#volume-label").text("Volume: " + Math.floor(v * 100) + "%");
8532});
8533
8534function reloadSounds(meow, asdf) {
8535if (meow.name == soundpack.name && !asdf) return false;
8536soundpack = meow;
8537 for (var i in MPP.piano.keys) {
8538 if (!MPP.piano.keys.hasOwnProperty(i)) continue;
8539 (function() {
8540 var key = MPP.piano.keys[i];
8541 MPP.piano.audio.load(key.note, soundpack.url + key.note + soundpack.ext, function() { //thanks Sommie
8542 key.loaded = true;
8543 key.timeLoaded = Date.now();
8544 if (key.domElement) // todo: move this to renderer somehow
8545 $(key.domElement).removeClass("loading");
8546 });
8547 })();
8548 }
8549 $("#meow").val("Current Sound: " + soundpack.name);
8550}
8551reloadSounds(soundpack, true);
8552//$.getScript('http://pastebin.com/raw.php?i=hWr6BgjW');
8553var gModal;
8554
8555function modalHandleEsc(evt) {
8556 if (evt.keyCode == 27) {
8557 closeModal();
8558 evt.preventDefault();
8559 evt.stopPropagation();
8560 }
8561};
8562
8563function openModal(selector, focus) {
8564 chat.blur();
8565 $(document).on("keydown", modalHandleEsc);
8566 $("#modal #modals > *").hide();
8567 $("#modal").fadeIn(250);
8568 $(selector).show();
8569 setTimeout(function() {
8570 $(selector).find(focus).focus();
8571 }, 100);
8572 gModal = selector;
8573};
8574
8575function closeModal() {
8576 $(document).off("keydown", modalHandleEsc);
8577 $("#modal").fadeOut(100);
8578 $("#modal #modals > *").hide();
8579 gModal = null;
8580
8581};
8582
8583
8584//from Logies script
8585setInterval(function() {
8586 for (var id in MPP.client.ppl) {
8587 if (!MPP.client.ppl.hasOwnProperty(id)) continue;
8588 var part = MPP.client.ppl[id];
8589 if (part.cursorDiv && (Math.abs(part.x - part.displayX) > 0.1 || Math.abs(part.y - part.displayY) > 0.1)) {
8590 part.displayX += (part.x - part.displayX) * 0.25;
8591 part.displayY += (part.y - part.displayY) * 0.25;
8592 part.cursorDiv.style.left = part.displayX + "%";
8593 part.cursorDiv.style.top = part.displayY + "%";
8594 }
8595 }
8596}, 1);
8597
8598$("#modals").append('<div id="select-sound" class="dialog" style="display: none; height: 275px; margin-top: -130px;"><input type="text" class="text translate" id="meow" value="Current Sound: ' + soundpack.name + '" readonly><p></p><p></p><div class="ugly-button default-piano">MPP Default</div><p></p> <p></p><div class="ugly-button hard-piano">Maestro</div><p></p> <p></p><div class="ugly-button new-piano">Guitar</div><p></p> <p></p><div class="ugly-button soft-piano">Soft Piano</div><p></p> <p></p><div class="ugly-button harpsicord">Klaver</div><p></p> <p></p><div class="ugly-button music-box">NewPiano</div><p></p> <p></p><div class="ugly-button bells">8-bit</div><p></p> </div>');
8599
8600$("body #bottom .relative").append('<div id="sound-btn" class="ugly-button sound-btn" style="position: fixed;bottom: 23px;right: 30px;width: 100px">Sounds</div>'); // bottom: 30px;right: 588px; = default
8601$("#sound-btn").click(function() {
8602 openModal("#select-sound");
8603});
8604$("#select-sound .new-piano").click(function() {
8605 localStorage.soundpack = JSON.stringify({
8606 url: 'https://dl.dropboxusercontent.com/u/24213061/Acustic%20Guitar%20v2/',
8607 ext: '.wav',
8608 name: 'Guitar'
8609 });
8610 closeModal();
8611 reloadSounds(JSON.parse(localStorage.soundpack));
8612});
8613$("#select-sound .hard-piano").click(function() {
8614 localStorage.soundpack = JSON.stringify({
8615 url: 'https://dl.dropboxusercontent.com/u/216104606/LoudAndProudPiano/',
8616 ext: '.mp3',
8617 name: 'Maestro'
8618 });
8619 closeModal();
8620 reloadSounds(JSON.parse(localStorage.soundpack));
8621});
8622$("#select-sound .music-box").click(function() {
8623 localStorage.soundpack = JSON.stringify({
8624 url: 'https://dl.dropboxusercontent.com/u/258840068/CustomSounds/NewPiano/',
8625 ext: '.mp3',
8626 name: 'NewPiano'
8627 });
8628 closeModal();
8629 reloadSounds(JSON.parse(localStorage.soundpack));
8630});
8631$("#select-sound .bells").click(function() {
8632 localStorage.soundpack = JSON.stringify({
8633 url: 'https://dl.dropboxusercontent.com/u/24213061/Digital/',
8634 ext: '.wav',
8635 name: '8-bit'
8636 });
8637 closeModal();
8638 reloadSounds(JSON.parse(localStorage.soundpack));
8639});
8640$("#select-sound .soft-piano").click(function() {
8641 localStorage.soundpack = JSON.stringify({
8642 url: 'https://dl.dropboxusercontent.com/u/216104606/GreatAndSoftPiano/',
8643 ext: '.mp3',
8644 name: 'Soft Piano'
8645 });
8646 closeModal();
8647 reloadSounds(JSON.parse(localStorage.soundpack));
8648});
8649$("#select-sound .default-piano").click(function() {
8650 localStorage.soundpack = JSON.stringify({
8651 url: '/mp3/',
8652 ext: '.wav.mp3',
8653 name: 'MPP Default'
8654 });
8655 closeModal();
8656 reloadSounds(JSON.parse(localStorage.soundpack));
8657});
8658$("#select-sound .harpsicord").click(function() {
8659 localStorage.soundpack = JSON.stringify({
8660 url: 'https://dl.dropboxusercontent.com/u/70730519/Klaver/',
8661 ext: '.wav',
8662 name: 'Klaver'
8663 });
8664 closeModal();
8665 reloadSounds(JSON.parse(localStorage.soundpack));
8666});
8667$("#banner").remove();
8668
8669
8670
8671//Theme
8672$("body").append('<style>* { margin: 0; } * { user-select: none; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; } /*@font-face { font-family:QT; src: url(fonts/Roboto_Condensed/RobotoCondensed-Regular.tff); }*/ html, body { width: 100%; height: 100%; overflow: hidden; font: 20pt verdana; color: white; text-shadow: #666666 1px 1px; } body { position: absolute; } body { background: rgb(254,255,232); /* Old browsers */ background: -moz-radial-gradient(center, ellipse cover, rgba(66, 66, 64, 1) 0%, rgba(8, 8, 8, 1) 100%) 100%); /* FF3.6+ */ background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%,rgba(254,255,232,1)), color-stop(100%,rgba(214,219,191,1))); /* Chrome,Safari4+ */ background: -webkit-radial-gradient(center, ellipse cover, rgba(254,255,232,1) 0%,rgba(214,219,191,1) 100%); /* Chrome10+,Safari5.1+ */ background: -o-radial-gradient(center, ellipse cover, rgba(254,255,232,1) 0%,rgba(214,219,191,1) 100%); /* Opera 12+ */ background: -ms-radial-gradient(center, ellipse cover, rgba(254,255,232,1) 0%,rgba(214,219,191,1) 100%); /* IE10+ */ background: radial-gradient(ellipse at center, rgba(66, 66, 64, 1) 0%,rgba(8, 8, 8, 1) 100%); /* W3C */ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr="#feffe8", endColorstr="#d6dbbf",GradientType=1 ); /* IE6-9 fallback on horizontal gradient */ } a { cursor: pointer; color: #f46; transition: color 0.25s; } a:hover { color: #e05; transition: color 0.25s; } .link { text-decoration: underline; cursor: pointer; color: #ffee00; } table { border: 0; padding: 0; margin: 0; } #names { position: fixed; top: 4px; left: 4px; font-size: 12px; width: 80%; } #names .name { float: left; position: relative; padding: 4px; margin: 2px; border-radius: 2px; -webkit-border-radius: 2px; -moz-border-radius: 2px; min-width: 50px; text-align: center; cursor: pointer; background-image: url("http://oi60.tinypic.com/4r8e4x.jpg"); } #names .name.me:after { content: "Me"; position: absolute; top: -4px; right: 50%; font-size: 10px; } #names .name.owner:before { content: url("http://i57.tinypic.com/s6rtsj.jpg"); position: absolute; top: -8px; left: 4px; } #names .name.play { transform: translateY(-4px); -webkit-transform: translateY(-4px); } #names .name.muted-notes { color: #7ae0ff; } #names .name.muted-notes:after { content: "Muted"; position: absolute; top: -4px; right: 50%; font-size: 8.6px; } #names .name.muted-chat { color: #7ae0ff; } #names .name.muted-chat:after { content: "Muted"; position: absolute; top: -4px; right: 50%; font-size: 8.6px; } #piano { width: 95%; height: 20%; margin: auto; position: relative; overflow: hidden; padding-left: 1%; } #piano .key { float: left; width: 1.8%; height: 90%; border: 1px solid black; background: #fff; margin-left: -0.5%; margin-bottom: 100%; box-shadow: 1px 2px 5px #000; -webkit-box-shadow: 1px 2px 5px #000; -moz-box-shadow: 1px 2px 5px #000; border-radius: 2px; -webkit-border-radius: 2px; -moz-border-radius: 2px; transition: background 4s ease-out; -webkit-transition: background 4s ease-out; -moz-transition: background 4s ease-out; -o-transition: background 4s ease-out; padding: 0px; overflow: hidden; } #piano .key.c, #piano .key.f { margin-left: 0; } #piano .key.sharp { width: 1.2%; height: 50%; background: #000; margin-left: -0.9%; position: relative; } #piano .key.loading { background: #888; } #piano .key.play { transform: translateY(1%); -webkit-transform: translateY(1%); -webkit-box-shadow: 0px 1px 2px #000; } .ease-out { transition: left 0.1s ease-out; -webkit-transition: left 0.1s ease-out; -moz-transition: left 0.1s ease-out; -o-transition: left 0.1s ease-out; } .ease-in { transition: left 0.1s ease-in; -webkit-transition: left 0.1s ease-in; -moz-transition: left 0.1s ease-in; -o-transition: left 0.1s ease-in; } .slide-left { left: -100%; } .slide-right { left: 100%; } .cursor { width: 16px; height: 24px; background: url("/cursor.png"); position: absolute; pointer-events: none; margin-left: -2px; margin-top: -2px; left: 200%; top: 100%;} .cursor .name { display: inline; position: relative; left: 16px; top: 8px; pointer-events: none; color: #fff; background: #000; border-radius: 2px; -webkit-border-radius: 2px; -moz-border-radius: 2px; white-space:nowrap; padding: 1px; font-size: 10px; background-image: url("http://oi60.tinypic.com/4r8e4x.jpg"); } .cursor.owner .name:after { content: url("http://i57.tinypic.com/s6rtsj.jpg"); position: relative; top: -8px; left: 0px; } .cursor .name { display: inline-block; } //.cursor .spotlight { display: none; position: relative; left: -14px; top: -9px; width: 32px; height: 32px; // border: 4px solid white; -webkit-border-radius: 100%; } .participant-menu { display: none; position: fixed; background: black; width: 150px; font-size: 12px; padding: 0px; margin: 0px; border-radius: 2px; } .participant-menu:last-child .menu-item:hover { border-bottom-left-radius: inherit; border-bottom-right-radius: inherit; } .participant-menu .info { height: 40px; text-align: center; line-height: 40px; font-size: 9px; color: rgba(255,255,255,0.9); overflow: hidden; opacity: 0; transition: opacity 0.2s ease-out; } .participant-menu .info:hover { opacity: 1; transition: opacity 0.2s ease-out; } .participant-menu .menu-item { cursor: pointer; margin: 0px; padding: 15px 5px; border-top: 1px solid rgba(255,255,255,0.3); } .participant-menu .menu-item:hover { background: rgba(255,255,255,0.4); } .participant-menu .menu-item.clicked { background: rgba(255,255,255,0.5); } #crown { position: absolute; width: 16px; height: 16px; background: url("http://i57.tinypic.com/s6rtsj.jpg") no-repeat; cursor: pointer; font-size: 10px; } #crown span { margin-left: 16px; margin-top: 2px; } #crownsolo-notice { position: fixed; top: 20%; width: 100%; text-align: center; opacity: 0.5; font-size: 20px; pointer-events: none; display: none; } #bottom{ position: fixed; bottom: 0px; left: 0px; width: 100%; height: 60px; background: #181818; margin-bottom: 3px; } #room, #room * { cursor: pointer; } #room { position: absolute; left: 0, top: 0; padding: 5px; width: 240px; height: 12px; background: #151515; border: 1px solid #393F39; cursor: pointer; margin: 9px 24px; font-size: 12px; } #room .info { white-space: nowrap; line-height: 12px; overflow: hidden; height: 20px; } #room .info.lobby { color: #85ceff; } #room .info.not-visible { color: #ce7aff; } //#room .info.crownsolo:after { content: url("/crownsolo.png"); position: relative; top: 2px; margin-left: 4px; } //#room .info.no-chat:after { content: url("/no-chat.png"); position: relative; top: 2px; margin-left: 4px; } #room .expand { width: 24px; height: 100%; position: absolute; right: 0; top: 0; background: #6D6D6D url("/arrow.png") no-repeat center 0%; } #room .more { display: none; position: absolute; bottom: 100%; left: -1px; width: 100%; overflow: hidden; overflow-y: scroll; background: #181818; border: 1px solid #2C2C2C; max-height: 600px; } #room .more > div { margin: 0; padding: 3px 6px 0px 6px; width: 100%; height: 20px; } #room .more .info:hover { background: #414141; } #room .more .new { background: #252525; } #room .more .new:hover { background: #535353; } .ugly-button { height: 12px; font-size: 12px; background: #3D3D3D; border: 1px solid #1A1A1A; padding: 5px; cursor: pointer; line-height: 12px; border-radius: 3px; -webkit-border-radius: 3px; -moz-border-radius: 3px; width: 100px; overflow: hidden; white-space:nowrap; } .ugly-button:hover { background: #444; } .ugly-button.stuck { background: #7B7B7B; } #new-room-btn { position: absolute; left: 300px; top: 9px; } #midi-btn { position: absolute; left: 420px; top: 9px; } #play-alone-btn { position: absolute; left: 540px; top: 9px; } #room-settings-btn { position: absolute; left: 660px; top: 9px; display: none; } #status { position: absolute; left: 0px; bottom: 10px; width: 320px; height: 20px; padding: 5px; font-size: 20px; font-weight: 800; line-height: 20px; pointer-events: none; } #status .number { font-size: 35px; } #volume { position: absolute; right: 478px; top: 0px; width: 100px; height: 40px; margin: 10px; } .volume-slider { width: 100%; height: 100%; background: /*url("http://24.158.102.46:8218/volume2.png") no-repeat*/none; background-position: 50% 50%; -webkit-appearance: none; } input[type=range] { -webkit-appearance: none; } input[type=range] { -webkit-appearance: none; border-radius: 8px; height: 7px; border: 1px solid #FFF; background-color:#2F2F2F; } input[type=range]::-webkit-slider-thumb {-webkit-appearance: none; background-color: #ecf0f1; border: 1px solid #bdc3c7; width: 20px; height: 20px; border-radius: 10px; cursor:pointer; } input[type=range]:focus { outline: none; } #volume-label { position: absolute; right: 495px; bottom: 7px; font-size: 10px; color: #ccc; } #banner { width: 468px; height: 60px; position: absolute; right: 0; top: 0; } #quota { width: 100%; height: 3px; position: fixed; bottom: 0; left: 0; background: #2D2D2D;background-image: url("http://oi60.tinypic.com/4r8e4x.jpg"); } #quota .value { width: 100%; height: 100%; display: block; background: #00C6FF; background-image: url("http://oi60.tinypic.com/4r8e4x.jpg");} .relative { position: relative; width: 100%; height: 100%; } .notification { position: absolute; } .notification-body { background: #131313; border-color: #131313; width: 400px; padding: 10px; position: relative; left: 0; top: 0; color: #bf7aff; font-size: 12px; text-shadow: #353535 1px 1px; border-radius: 6px; -webkit-border-radius: 6px; -moz-border-radius: 6px; } .notification-body:after { content: ""; position: absolute; top: 100%; left: 50%; margin-left: -3px; border-top: 10px solid transparent; border-top-color: inherit; border-left: 6px solid transparent; border-right: 6px solid transparent; } .title { border-bottom: 1px solid #7acaff; font-size: 16px; font-weight: bold; padding-bottom: 5px; margin-bottom: 8px; } .notification .x { position: absolute; right: 4px; top: 0; cursor: pointer; font-size: 16px; color: #44C2FF; text-shadow: none; } #modal { width: 100%; height: 100%; position: fixed; left: 0; top: 0; display: none; } #modal .bg { width: 100%; height: 100%; background: rgba(118, 131, 141, 0.94); opacity: 0.5; position: absolute; left: 0; top: 0; } #modal, #modal * { user-select: text; -webkit-user-select: text; -moz-user-select: text; -ms-user-select: text; } .dialog { background: #181818; width: 400px; height: 100px; position: fixed; left: 50%; top: 50%; margin-left: -200px; margin-top: -50px; padding: 10px; border: 1px solid #363636; overflow: hidden; border-radius: 4px; -webkit-border-radius: 4px; -moz-border-radius: 4px; box-shadow: 0px 0px 8px #000; -webkit-box-shadow: 0px 0px 8px #000; -moz-box-shadow: 0px 0px 8px #000; } .dialog p { margin: 10px; font-size: 20px; } .dialog input.text { font-size: 20px; height: 20px; width: 75%; } .dialog input.checkbox { margin: 0 5px; } .dialog .submit { background: #75BCF5; border: none; padding: 7px 40px 20px 30px; font-size: 20px; color: #fff; text-shadow: #444 2px 2px 2px; border-radius: 4px; -webkit-border-radius: 4px; -moz-border-radius: 4px; box-shadow: inset 0px 0px 4px #000; -webkit-box-shadow: inset 0px 0px 4px #000; -moz-box-shadow: inset 0px 0px 4px #000; transition: all 0.25s; -webkit-transition: all 0.25s; -moz-transition: all 0.25s; -o-transition: all 0.25s; position: absolute; bottom: -10px; right: -10px; } .dialog .submit:hover { background: #88CAFF; transition: all 0.25s; -webkit-transition: all 0.25s; -moz-transition: all 0.25s; -o-transition: all 0.25s; } .dialog .close { background: #fe4; border: none; padding: 7px 40px 20px 30px; font-size: 20px; color: #fff; text-shadow: #444 2px 2px 2px; border-radius: 4px; -webkit-border-radius: 4px; -moz-border-radius: 4px; box-shadow: inset 0px 0px 4px #000; -webkit-box-shadow: inset 0px 0px 4px #000; -moz-box-shadow: inset 0px 0px 4px #000; transition: all 0.25s; -webkit-transition: all 0.25s; -moz-transition: all 0.25s; -o-transition: all 0.25s; position: absolute; bottom: -10px; right: -10px; } .dialog .close:hover { background: #ff8; transition: all 0.25s; -webkit-transition: all 0.25s; -moz-transition: all 0.25s; -o-transition: all 0.25s; } #room-settings { height: 400px; margin-top: -200px; } #instruments { height: 180px; margin-top: -100px; } #options { height: 200px; margin-top: -100px; } #chat { display: none; } #chat { position: fixed; bottom: 64px; left: 0; width: 100%; vertical-align: bottom; font-size: 13px; color: rgb(183, 246, 255); text-shadow: #606060 1px 1px; } #chat, #chat * { user-select: text; -webkit-user-select: text; -moz-user-select: text; -ms-user-select: text; } #chat ul { list-style: circle; margin: 4px; padding: 0; } #chat li { padding: 2px; opacity: 0; } #chat li .name { font-weight: bold; margin-right: 10px; } #chat li .message { margin-right: 6px; } #chat li .quote { color: #789922; } #chat input { margin: 4px; width: 99%; border: 1px solid #fff; background: none; text-shadow: #888 1px 1px; color: #fff; border-radius: 4px; -webkit-border-radius: 4px; -moz-border-radius: 4px; } #chat input::-webkit-input-placeholder { color: #ccc; } #chat input:-moz-placeholder { color: #ccc; } #chat input:focus { outline: none; border: 1px solid #7acaff; } #chat.chatting { background: rgba(21, 39, 40, 0.5); border-radius: 5px; box-shadow: 1px 1px 5px #404040; transition: all 0.1s; } #chat.chatting li { display: list-item !important; opacity: 1 !important; text-shadow: #aaa 1px 1px; } #chat.chatting ul { max-height: 50em; overflow-y: scroll; overflow-x: hidden; word-wrap: break-word; } #midi-connections .half h2 { margin: 5px; } #midi-connections .half { width: 50%; float: left; text-align: center; } #midi-connections .half select { width: 80%; height: 20px; margin: 2px; } #midi-connections .half button.remove { width: 10%; height: 20px; margin: 2px; padding: 0; } #midi-connections .half button.add { width: 50%; height: 20px; margin: 2px; } #social { display: none; position: fixed; top: 4px; right: 6px; width: 80px; font-size: 12px; } #social #more-button { margin-top: 4px; width: 77px; height: 37px; border-radius: 5px; border: 1px solid #000000; cursor: pointer; transition: all 0.25s; box-shadow: 1px 1px 8px #000000; color: #000000; text-shadow: none; background: url("/kitten") 0px 1px no-repeat; background-color: rgba(2, 2, 2, 0.64); } #social #more-button:hover { color: #000000; background-color: #323232; transition: background-color 0.25s; } #more { display: none; width: 1250px; margin: 0 auto; padding: 0px; border-radius: 10px; font: 15px sans-serif; border: 1px solid #b0c0c0; color: #566; background: #bcc; box-shadow: 1px 1px 8px #899; position: fixed; top: 50px; right: 50px; text-shadow: none; } #more div { margin: 0px; padding: 0px; } #more .items { margin-left: 1%; } #more .items .item { width: 33%; float: left; background: #cdd; transition: background 0.25s; } #more .items .item:hover { background: #d0e0e0; transition: background 0.25s; } #more .items .item .content { height: 200px; padding: 10px; border-right: 1px solid #bcc; border-bottom: 1px solid #bcc; } #more .items .item .content p { margin-top: 1em; margin-bottom: 1em; } #more .header { padding: 5px 10px; } #more .footer { clear: both; padding: 5px 10px; font-size: 12px; } #email:before { content: url("/envelope.png"); margin: 4px; } #crownsolo-notice { z-index: 0; } #cursors { z-index: 1; } #chat { z-index: 100; } #social { z-index: 200; } #names { z-index: 300; } #piano { z-index: 400; } #piano .key { z-index: 401; } #piano .key.sharp { z-index: 402; } #bottom { z-index: 500; } #crown { z-index: 600; } .notification { z-index: 700; } #cursors .cursor { z-index: 800; } #chat.chatting { z-index: 900; } .participant-menu { z-index: 1000; } #modal { z-index: 10000; } .clear { clear: both; } .spin { animation: spin 1s linear infinite; -webkit-animation: spin 1s linear infinite; -moz-animation: spin 1s linear infinite; -o-animation: spin 1s linear infinite; -ms-animation: spin 1s linear infinite; } @-webkit-keyframes spin { 0% { -webkit-transform: rotate(0deg);} 100% { -webkit-transform: rotate(360deg);} } @-moz-keyframes spin { 0% { -moz-transform: rotate(0deg);} 100% { -moz-transform: rotate(360deg);} } @-o-keyframes spin { 0% { -o-transform: rotate(0deg);} 100% { -o-transform: rotate(360deg);} } @-ms-keyframes spin { 0% { -ms-transform: rotate(0deg);} 100% { -ms-transform: rotate(360deg);} } input[type=color] { display: none; }</style>');
8673
8674//END OF SCRIPT// //END OF SCRIPT// //END OF SCRIPT// //END OF SCRIPT// //END OF SCRIPT// //END OF SCRIPT/