· 6 years ago · Mar 15, 2020, 08:20 AM
1// ==UserScript==
2// @name Relyks's fixed MPP Piano Script
3// @namespace http://www.multiplayerpiano.com/
4// @notice This was originally made by electrashave. And furthermore edited by Relyks
5// @Version 8.0
6// @description Modded Script For Multiplayerpiano.com
7// @include http://www.multiplayerpiano.com/*
8// @match http://www.multiplayerpiano.com/script.js
9// @copyright 2013+
10// ==/UserScript==
11var startUpDelay = window.performance.now();
12// ♥ // personal notes // ♥ //
13/*
14Here's how to get your _id: MPP.client.getOwnParticipant()._id
15Here's how to get your id MPP.client.participantId
16Here's how to get a name: MPP.client.ppl["11b6b8d23ad8d4040b8ac00e"].name
17Here's how to get your name and split it up: MPP.client.getOwnParticipant().name.split('');
18Here's how to split the room into an array: MPP.client.channel._id.split('');
19Here's how to check if an something is in an array: if(arrayName.indexOf(id) != -1) { It is there. } else { Nope };
20Here'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)
21Here'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:
22Here'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 ); }
23Here'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")
24Here's how to append something to something (thanks SomeGuy) $("ul").append( name );
25Here's stuff: function x(min, max) { return Math.round(Math.random() * (max - min) + min); }; x(-10, 10)
26Here's stuff too: name.length === 5 && name === "Logan" && gClient.isOwner() && last_known_channel === "Logan" && last_known_channel.length === 5
27Here's more stuff: me = MPP.client.getOwnParticipant(); delete me.cursorDiv; delete me.nameDiv; JSON.stringify(me)
28Here's how to add notifications, thanks Kappa! new window.Notification("Hello", { icon: "http://dreamatico.com/data_images/kitten/kitten-2.jpg", body: "world" })
29Here'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()
30
31♥ Here's how databases work, Logan ♥
32 var puff = MPP.client.ppl[MPP.client.getOwnParticipant().id].name
33
34 Chacha–㉖ MPP.client.ppl is the DATABASE
35 Chacha–㉖ MPP.client.getOwnParticipant().id is the INDEX or KEY
36 Chacha–㉖ MPP.client.ppl[MPP.client.getOwnParticipant().id] is the RECORD or DATA
37 Chacha–㉖ MPP.client.ppl[MPP.client.getOwnParticipant().id].name is ONE FIELD OF THAT RECORD
38
39 //Object.defineProperty(MDB,"length",{get:function(){return Object.keys(this).length}})
40 //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("")})})
41♥ Here's how databases work, Logan ♥
42
43`X: ${mx} Y: ${my}` //template string
44
45καρρα To be exact, it is 4 every 6 seconds.
46καρρα 10 every 2 seconds when crowned.
47
48καρρα To get the properties names use: Object.getOwnPropertyNames(String.prototype)
49
50Josh MPP.piano.play('a1', 1, MPP.client.getOwnParticipant(), 0);
51
52//made by Impossible(RU)
53//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);
54
55x = 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);
56
57
58*/
59// ♥ // personal notes // ♥ //
60
61//Change to true to stop the notification displaying on start-up.
62//You can always view the hotkeys with the H key.
63//I encourage you to edit this script and see what cool things you can make.
64var i_know_how_to_use_this_bot = true;
65
66//js LOL = setInterval(() => { if (MDB[selfId].inventory.bananaMilk > 1000) { clearInterval(LOL) } MPP.chat.send('!mshop banana milk') }, 200)
67
68this.worker = new Worker("/workerTimer.js"); //must be same origin - thanks B@K$
69
70/*
71//List of names I find interesting or too funny to forget:
72Names: ""
73Names: ๖ۣۜʟᴏɢɪᴇ ๖ۣۜʙᴇᴀʀ
74Names: ℒℴℊąɳ
75Names: ℒℴℊɨℯ
76Names: ℋℯℓℓℴ ℐℳ ℒℴℊɨℯؕ ぼ
77Names: ℒℴℊɨℯ ܮ̬͔̰̹̮̫̬͔̰̹̮̫̬͔̰̹̮̫̇ͅͅͅ
78Names: ๖ۣۜSnorkel ๖ۣۜWarrior
79Names: くコ:彡 ๖ۣۜSevant ๖Squidly *le slurrpy*
80Names: ᶠᵃᵍᵍᵒᵗ
81Names: ████████████████████████████████████████
82Names: "ㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤ"
83Names: ͚ ͚͚ ͚͚͚ ͚͚͚͚ ͚͚͚͚͚ ͚͚͚͚͚͚ ͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚͚͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚͚͚͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚͚͚͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚͚͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚ ͚͚͚͚͚͚ ͚͚͚͚͚ ͚͚͚͚ ͚͚͚ ͚͚ ͚
84Names: ௵LOGAN!Ϡ
85Names: Raza२
86Names: Logan هلا
87Names: ✿ۣۣۜۜ✿
88Names: ♥̬͔̰̹̮̫̇ͪͣ͐̆̍̇ͩ́ͣ̕͞ͅ
89Names: ><(((⊚>
90Names: (_̅_̅_̅_̅_̅м̅a̅я̅i̅j̅u̅a̅n̅a̅_̅_̅_̅ () ด้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็็
91Names: █̶̧̗̫̜̟̟͓̈̎ͯ͌͗ͩ̀ͮ̾͊͌̈́͌̃ͪͮ̎̑̕͡͠█̷̧̣̘̣͓͕͍̜͎̝̝͉͚͓̩̩͇̭̱͔͋̀̏ͦͯͬͬͥͭ͋̇ͫ͒͝█̶̵̨̹̝͙̲̻̦̘͉̙̭̠̠̺̲̭͍̠̝̤͋̇̀̆ͯ̂ͤͦ͒̌̈́̌ͧ͂͢█̷̴̡̭̤̗̫͓̹̳̯̫̤͇̰̗͔͓ͫ̌̽̏̎̇̐̿͂ͦ█͚̫͖̯͇̝̲̞̱͕̟̗͍̳̠͛ͥ͂̅ͨ̆ͤͥͩͦ̉̈́̾̆̒ͥ̓̄́̕͘█̷̶͋̌̈͌̆̓͒̄̃̏͗̏̽҉̪͕͓̠̩̱̖͚█ͮͣ͛̓̌̓̊̆̌̑̇ͯͯ̽͞͏̷̛̩̝̫̱͉̦̼̳̱̮͓͙̤͓̦█̶̫̫͈̣͈̦̼̻̝̟͐̋͗̐̉̐̓̈̔ͪ͗͌͋͢͝█̔̾̊͒͑̉̔̈̀͋ͣ̓̓͆̎̎͂̾͏̡̰̟̺̻̬̳͚̝͉̝́ͅ█̸̌̓ͯ͌̆̀͏̛̗̙̣̻ͅ█̧ͧ̈͐ͫ̎͊̔ͨͩ̃ͨ̎̑̑̆ͮ͗ͯ́̕͏̮͈̳̲̤̪̹̘͔͔̜͘█̧̠͈̮̤̍͑̒͆̌͂̋̋ͭ́͜█̶̷̧̟͎̻̹͈͕͔͗ͪ͌ͧ͊ͩ͒͛ͨͫͩ͋ͦ̓̓ͨ̈͢͠█͊ͥ͛̒ͦ̿̉̃̽͌ͨ͆ͫ͟͢͡҉͍̤̳̗́█̴̴̸̡ͣ͐ͯͨ̆ͥ̊̾͋͆̎ͨ҉̘̻̳̺͍̺̹͙͓█̜̙̞̩̘͔̓ͧ̓͋͊̋ͦ̍̋ͯͦ̉͂͆̊̋̇̉̚͢͢͠ͅ█̢̫̙̭̜͕̺̦̥͔͍͕̺̻̀̈́̄̂̋͐̃̔͟͞ͅͅ█̸͙̯̝̟̘͉̙̪̬̰̪ͥ̏͂ͣ͐͐̽ͤͭ͡█̶̵̤̱͍̤̖͔̭̰̗̻̩͉̣̤͕̹͍̥͋ͩ̐͐͠͝█̷̧̱̱̖̱̠̤̥͔̪̖̪̠̖͖̞͖͖ͦ͋̑̈ͬ̈́ͫ͗ͦ̏̏ͤͨͩ̓̄͋̔ͅͅ█̴̏͑̉ͦ̊̀͒͑҉͈̜̼̗̪̘͍͉͇̼̝͖̻ͅͅ█̠͕̺͙̝̦͉͉͖̞̖͇͍̖̣ͪͤ̿ͬͧ͊̌͒̒̈́͗ͨ͋̈ͩͫͪ̌́͘█̢̖̱̣̣̆̾͒̿́͘͜͡█̡̢̗̺͎͇͙̺̜̤̜̭̦͔̞̬̖̌̈̐̀͘͡█̸̸̴̛͇̯̪̗̗͕̼̙̬̮̆ͭ̿̈́ͩ̍͊̒͢█̈́̽ͨ҉̡̳̰͙͓̟̯̹͈͙̩͕̥̘̫̱̀͘ͅ█̷̗͓͎͖͈͚̗͎̪͙̾͑͒̍͆̾̑̍ͮ̍̽̍ͪ͆̋́͘█̢̢̋̊̊ͪ̍͒̇̉̏̌ͪ́̚͘҉͔̬͓̫͍̞̥̫̤̯̭͚̝̗͖̖ͅ█̵̈́̏̐ͩ̆̑͠͠͏͖̫͇̣̗̣̠̤̠͟█̵ͣ̍̊̅ͤ̂ͫͧ̌̆̈̈́ͪ̆҉̭̟̣͚̳͢͡ͅͅ█͐͌̾̌̄͆̅̉̆̅̋ͪ͆͟҉͉̘̬̙͎̗̙͞█̘̲̳̘̯͎̱͍̮̱̎̏̀̀ͦ͠ͅ█̨̧̢̪̜̺̣̣̞̞̰͚̹̣̣̺͈ͨ̿ͭͤͭ̈́̇͜█ͩͯ̄̔͋̽̅̅̇̑҉̛̖̳̩̠̜͈́█̧̨̧̯̺̪̤̬̪̼͇͍̖͎̞̲̠̊̐̎ͤ͊̑ͪ͛ͥ͐̍̌́̔̿̏̀̕█̑̃͗̎̃͛̾̋̎̾͗́̆̚͜͏̫̮͕͚͍̳̣̱̬̼͙͇͎̥̘͕͎̦█̶̶̲͖̳͍̮̭̣͈̻͓̮̮̘̬̠̥͙ͨ͗̋̽̔͗̒ͣ͢͞█̵̸̧̲͔̙̻͉̫ͨ͑̀ͮͮ͒ͭ̉͢͜ͅ█̛̰̼̙̯̬͈͉̘̜̲͈̬̲̋̊̅͒̾͒͊͊ͯ͋́͠ͅ█̶̸̘̹̰̼͛͐̒̓͛̈́̐ͥͧ̐͐̓̌ͪ̆͑͜͝█̶̨̛̏̑͌̍ͭ̄ͩ̂ͥ͌̓͆̇ͯ͊̾ͮ͏̩̮̭͎̙͈̲̮͓͚̣█̷̴̡̙̖̪̖̯̻̫͙̄̔̍͛͛́̾̈ͬ̇̾̾͡█͕̠̮̭͖͚̉ͥͨ̉͒̅̋̌͊̄̎͞͞█̷̨̠̺͓̳̤͉̗͍͙̠̮̙̼̿͛̓̀ͧ̊̄ͫ͐̐̎̕͘█̶͎͍̮̲͈̫̲̭̈́͂͗̽ͫͥͧ́͞█͎̲̻̣͓̎̌̀ͪ͑̉ͥ̀ͭͩ̿̾̀█̙͍̦̘̪̥̦̪̲̖͙̤̤̭͓͌ͣ̏̆̂͞█̸̷̹̙̗̳̮͇͎̦͇͊͒ͣ̀̆̈́͒ͪ̀̿̓͊͋͂̃ͫ͝█̛̲̳̲̰̰̜̘̐ͥ̈͂̏̓̇̉̋ͪ̔̅͞█̶̯̰̯̖͉͈͇̮͇̝̻̥̰͔͔̬̙̪̂͑ͨ̍ͦͧ̀͢͡ͅ█̷͓̹͈̩̰̼̪͇̙͙͕̼̻ͭ̓̅̈̈ͮ̍ͯ̊ͫ̇͛̉͜͞͠͠█̵̧̛̩̺̼͍͕̞̾͂͑ͦ̅̀͐̏̄͝█̋̈͗ͫͩͤ̅ͦ͋̓͆̃̒̀҉̶͉͖̺̖̤͇͚̭̮̞̕͜█̵̢̰̞͔̜̥̠̤ͧ̉͐͐͒͊̎̎͊̐̀̍̔̎͛̾́͘͢█̴̶̧̛͇̩̰̼̣̲͚̠̻͖̞͚̯̼̝̲͙̻̒ͦ̍ͪ̾̊ͨ̇͠█̴̷̢͔͇̗̙̦̅͑̉͆̋̈̎ͤ͋͞█̧̛̞̺̥̳͚̭͔̰͉̮̟͎͇͙̗̾͌ͭͬͨ̒̉̂█̶̧̡̦̗̥̘̤̜̦̞̹̣̘͉̻̬̮̠͎̐ͭ̃͆̃ͮ͑ͯ̾̔ͨ█̡͚̺̮͔̭̺̰͉̗̦͉̝͈̀̋͛̽ͦ̋͂ͅ█̶̛̳̯̪̝͕̼̞͖̑̊ͥ̀ͅ█̅̍̆̆ͩ͛͌͐͊ͦͫ͏̶̤̻͉̯̣̪͎̳̯̦̠̭͎́█̨̹̖̩͍̭͉̺ͨ̃ͯͨ́ͬ̾̄̕█̸̸̡̥̞̯̺̪̹̬̙̼͎̹̫̗̘͖̤͑́ͥ̒͊͑̒̈́ͦ̂ͧ͑͡█̦̭̺̰͎͖͋͌͂͊̊́́͝͠█̵̵͚̥͍̰̮̫̥̙͕̬̳͔͐͐̅͂ͫͣ̕͝ͅͅ█ͮ̐̊͑̄̉͋̿̋̅̾̆̈͋ͫͭ͋̒ͭ͡҉̱͎̪̫̝̲̘̭̥͉͍̱̬̬ͅ█̶ͣ̈̆̉̂̾͠҉̖̹̻̯̣̯͉̟̠͚█̘̼̣͔̮̳̻͇̠͕͎̹̤̺̏̃̔ͩ̐̌͜͟͠͞█̶̧̫͔̼͇̭̞̫̤̹̱̞̖̙ͪͦ̉̈́̏̊̿̈͞█̷̸̨͔͚͎͇̬̠͕̣͎̟̩̠͙̬̥͉̞͗͗ͥ̑̽̋̔̈ͯͪ̋ͬ͊̅͐ͅ█̴̡̡̺̰͙̳̱̜̣̟̱̼͇̘̣̅͆͑͗͑ͭ̅̃͋ͦ̄̾ͩ̅̓̑̌̓́█̵̷̊͒̀ͣ͌̒̓ͧ̐̉̀͞͏̬̞̺̬̣̦̲̱̤̩͔͚̦̞̪ͅ█̮͔̳̏̐̓͛̐ͩ̂̾̍̚͝█̴̨͗ͯ̽̓̑͗̂̈̚̚͘͟͏͖̩͕̮͉█̖̹͇͓͖͍͖̪̱͔̗̣̯̬̾͛ͯͦͤͬ͒̾̚̚͜͡█̛̓̐̈ͥͣͮ͂ͨ̃҉̢̙̮̤̬̜̭͇̘͈͍̬█̷̶͔̩̖͙͙̺̟̞̻̖̜̈̂̌͋̾̾ͣ̓̃͌ͧ̏ͧ̀̎͛͢͠█̛̆ͤͫ̿ͯͩ̔̈̉͊́͛͌̽̽҉̧͏̣̣͓̜̙̭͖͝█̷̠͍̝̘̃͂̍̔̊̉͐͠█̴̨̧̨͉̞̤̜̪̠̥̣̬͒̏̊̿͐̋̀̓͊͡ͅ█̴̜͓͔̯͖͕̙̝̗͚̪̘͙ͤͫ̂̇̿̄ͪ̑̑͡█̳̥̬̬̭͈̟͚̪͉͕ͯ̒̓ͫ͗ͧͣͩ̇͋̎ͬ̌ͣ̿̚̕͢ͅ█̰̼̹͕̎̒ͩ͆ͧͨ̽̌͒͋̾̈́̍͐̎̇ͪ̌͜█̧͔͓̫̠̤̣̟̳̥̦̘̼͓ͤ͗ͥ̏̐ͨ̆ͥ͐̀ͩͤ̑̕͞͝█̶̛̊̿͗̓̇̅͏̴͖̫͉͚̩̣̟̠͎̟̟̙̜ͅ█̬̫̘̜̤̣̫̤̠͈̃̓̑̓̀̀͘█̶̹̱̙͎̺̥̹̙̟̩͍̰͓̹̤͎̞̞̃ͤͬ̈́̔̊̏͛͋̈́ͨ̂̈́ͪͭ̽█̴̴̨ͯ̉̃̿͌̅͒͛͗ͩ̀̚͡͏͙̫̥̰͚͈█̵̄ͫͤͬ́ͨͩ̏͂̆̀̈̃̌͋͏̷̛̗̬̰͚͞█̡̨͚̱̗̰̥̪̮͍ͤ͆͑ͧͭͣ̏ͩ͌ͩͭ̆̊̿̚█̜̦͓̪̪͔̯̖̳̺̾̃ͦ͗͆ͯ̓̑̆ͮ͢͟͜͝█̸̩̻̹̠͍̹̳̻͔̥̳̰̣͐́ͮͭ̓̈̆̓́́ͅ█̵̷̢̜̹͖͔̦̜̭̯̬̯ͤͥ̐͆͛̑͌̈ͥ̿̍ͥ̿̄ͪ̕█̷̸̸̤̲͙̙͕͉̺̮͚̹͔̖̠ͣ̽ͩ̇ͪͭ̉ͫ̃͗̀͞█̨̠̮͖̞̹͔͖͔̘͔ͭͥ̍̉̿̇ͫ̄͊̉́͠█̷̷̦̩̣͇̯̙̩̰̍͊ͣ̉̎̚
92Names: ♩ ♪ ♫ ♬
93Names: Logie the Bomb-Diggity
94Names: Logie the Small Mammal Strangulator
95Names: Hunny Bunny Woo Woo
96Names: " "
97Names: Day/̢̥̝͇̣̺̠̦̣͊̏̆̄͋̈́̀̌̈́̚͜
98Names: Mer mer mer mer mer~Logie the Sex Master
99Names: Cum Soaked Chest Hair ;)
100Names: '้ۜϠ
101Names: ª º°º ª
102Names: You stupid little spoon bitch.
103Names: ──★──
104Names: ༼ ºل͟º ༼ ºل͟º ༼ ºل͟º ༽ ºل͟º ༽ ºل͟º ༽
105Names: ℬℰℱℋℐℒℳ℘ℛℓℴℯɨℊℎ
106Names: ][_, ([]) ][_,
107Names: Special Little Snowflake
108Names: ⋙
109Names:(/Ꭷ ᴥ Ꭷ\)
110Names: ◘◘◘◘
111Names: ૯
112Names: ௵ௌ௵ௌ௵ௌ௵ௌ௵ௌ௵ௌ௵ௌ௵ௌ௵ௌ௵ௌ௵ௌ௵ௌ௵ௌ௵ௌ௵ௌ௵ௌ௵ௌ௵ௌ௵ௌ௵ௌ
113Names: ๖ۣ̲̲ۜB̲L̲U̲E̲S̲ ☕™
114
115Code:
116Flips page 180°: ['', '-ms-', '-webkit-', '-o-', '-moz-'].map(function(prefix){ document.body.style[prefix + 'transform'] = 'rotate(90deg)'; });
117Tilt 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)'; }); });
118
119
120if (my >= 50) { press('a-1'); my; } else { press('c7'); my}
121
122List of piano sounds:
123
124Steinway Piano: piano.audio.load(key.note, "https://dl.dropboxusercontent.com/u/24213061/HDPiano/" + key.note + ".wav", function () {
125Music Box: piano.audio.load(key.note, "http://24.183.232.15:8999/CustomSounds/MusicBox/" + key.note + ".mp3", function () {
126Harpsichord (good): piano.audio.load(key.note, "http://24.183.232.15:8222/CustomSounds/Harpischord/" + key.note + ".wav", function () {
127Amazing: piano.audio.load(key.note, "http://24.183.232.15:8222/CustomSounds/PianoSounds/" + key.note + ".mp3", function () {
128Clear Piano: piano.audio.load(key.note, "https://dl.dropboxusercontent.com/u/24213061/ClearPiano/" + key.note + ".wav", function () {
129Electric guitar: piano.audio.load(key.note, "https://dl.dropboxusercontent.com/u/258840068/CustomSounds/Guitar/" + key.note + ".mp3", function() {
130Hard and Tough piano.audio.load(key.note, "https://dl.dropboxusercontent.com/u/216104606/HardAndToughPiano/" + key.note + ".mp3", function () {
131Airhorn piano.audio.load(key.note, "https://dl.dropboxusercontent.com/u/24213061/Airhorn/" + key.note + ".wav", function () {
132Cello: piano.audio.load(key.note, "https://dl.dropboxusercontent.com/u/24213061/Cello/" + key.note + ".mp3", function () {
133Drums: piano.audio.load(key.note, "https://dl.dropboxusercontent.com/u/24213061/Drums/" + key.note + ".wav", function () {
134Grand piano: piano.audio.load(key.note, "https://dl.dropboxusercontent.com/u/24213061/GrandPiano/" + key.note + ".wav", function () {
135Guitar: piano.audio.load(key.note, "https://dl.dropboxusercontent.com/u/24213061/Acustic%20Guitar%20v2/" + key.note + ".wav", function () {
136Rape: piano.audio.load(key.note, " https://dl.dropboxusercontent.com/u/24213061/Rape/" + key.note + ".wav", function () {
137Digital Piano: piano.audio.load(key.note, "https://dl.dropboxusercontent.com/u/24213061/Digital/" + key.note + ".wav", function () {
138Harpsichord: piano.audio.load(key.note, "https://dl.dropboxusercontent.com/u/24213061/Harpischord/" + key.note + ".wav", function () {
139Bells Piano: piano.audio.load(key.note, "https://dl.dropboxusercontent.com/u/24213061/Bells/" + key.note + ".wav", function () {
140Soft Piano: piano.audio.load(key.note, "https://dl.dropboxusercontent.com/u/216104606/" + key.note + ".mp3", function () {
141Default Piano: piano.audio.load(key.note, "/mp3/" + key.note + ".wav.mp3", function () {
142
143Local sounds (you won't be able to load these)
144Amazing Local: piano.audio.load(key.note, "http://localhost:3000/sounds/amazing/" + key.note + ".mp3", function () {
145piano2 Local: piano.audio.load(key.note, "http://localhost:3000/sounds/piano2/" + key.note + ".mp3", function () {
146newPiano Local: piano.audio.load(key.note, "http://localhost:3000/sounds/newPiano/" + key.note + ".mp3", function () {
147
148*/
149
150//background music: document.body.style.background = " url('https://www.dropbox.com/s/1tcf42b0f41ib40/Music.gif?raw=1') no-repeat right top";
151//Totoro: document.body.style.background = "url('http://f8.topit.me/8/56/31/113111364735131568o.jpg') no-repeat right top";
152//background landscape: document.body.style.background = " url('http://i.imgur.com/fUdprux.jpg') no-repeat center 90%";
153//Beethoven: document.body.style.background = "url('http://wallpoper.com/images/00/41/58/86/music-beethoven_00415886.jpg')"; document.body.style.backgroundSize = "1366px 768px";
154
155// creates a lobby
156//MPP.client.sendArray([{m: "chset", set: {lobby: true}}]);
157
158// creates new room
159//MPP.client.sendArray([{m: "ch", _id: name + "'s room"}]);
160
161//asdf = setInterval(function() { transLvl++; if (transLvl > 6) { transLvl = 0; } }, 450);
162
163/*
164test
165gClient.on("a",function(msg){ gClient.sendArray([{m:"userset", set:{name:msg.p.name}}]); });
166
167gClient.on("a",function(msg){ if (msg.a.indexOf(gClient.getOwnParticipant().name + " is enabled " )!== -1) { sendChat("/octave")} });
168*/
169
170
171// basic settings - settings I encourage you change for your prefrences. Just be careful.
172 //below is the message of the day
173var Lmotd = "MOTD: Clefairy's Polar bear - http://i.imgur.com/gVudKiN.jpg & check this out!!!1¹ http://aem1k.com/world/";
174var botVersion = "8.0" //version. saves time instead of changing all throughout script
175var selfName = "Relyks | Pc Keyboard"; //your name
176var keyword = "Relyks"; //your name or word you would like to be alerted about (make sure you allow Chrome notifications and swap the MP3 sound for alert)
177var selfId = "cc1da5795a9c2ff30c83bfe1"; //your id here, easy way to make yourself master and op. Just replace one Id instead of 7 or so.
178var sheetURL = "https://lilcryte.wixsite.com/mppnotes"; //link to pastebin for PC sheets
179var refresh_rate = 2100; //delay between name change. Min: 2.1 sec. Default: 2100
180var hotkeyRoom = "Welcome and Enjoy!"; //the name of the numpad 2 lobby room to be created
181var randNoteColour = false; //default setting for SomeGuy's random note colours
182var showOwnMouse = true; //whether or not you can see your own mouse (I like havng it on sdfghjk)
183var chatLimit = 10240; //maximum chat messages that are shown when you scroll up chat (not upon room join) default was 256
184var fSpeed = 0.25; //default speed for following when you click a user's name then click follow
185var fRadius = 2; //default radius for following (how far away you rotate)
186var fDegree = 180; //which way you spin, not exactly sure
187var afterName = " "; //symbol in chat after name
188var closeCheck = false; //when true prompts you if you try to close/refresh the page.
189var timeStamp = false; //shows time next to message
190var cmdChar = '!'; //the symbol you want chat commands to use ! was default (note trim() if you run into problems Logan)
191var autoFollow = false; //auto follow user's mouses (needs to be true for strict follow)
192
193var strictMode = false; //only lets peoople with (); at the end of their name use the bot
194
195//speech settings
196 var speechStatus = false; //read chat by default or use numpad 7 to toggle
197 var speechVolume = 1; //0.5 //default volume for spoken text
198 var speechPitch = 1; //default pitch for spoken text
199 var speechRate = 1; //default speed for spoken text
200 var speechLang = "en-GB"; //default for speech language (there's more search Google speech API supported languages)
201 //en-GB, en-US, es-ES, fr-FR, ja-JP, de-DE ,it-IT
202//speech settings
203
204//$("body").css('cursor','url(http://static.tumblr.com/c07b69a007660c9d85e65fd98d03bdbb/u8lqlti/RjRnh9jhe/tumblr_static_dmtjjg29joooc4cwwkskwkwcs.gif), auto');
205
206//audio settings
207 //var alertSound = new Audio('http://localhost:3000/sounds/alert.mp3'); //alert!
208 var alertSound = new Audio('http://localhost:3000/sounds/alert(mario).mp3'); //alert mario!
209 var yeySound = new Audio('http://localhost:3000/sounds/yey.mp3'); //yey!
210 var friendSound = new Audio('http://localhost:3000/sounds/friendJoin.mp3'); //friendJoin
211
212 alertSound.volume = 0.05; //still bloody scares me
213
214 var alertName = true; //plays mp3 when your name is said in chat (edit your name there)
215//audio settings
216
217//voice
218 var Voice = new webkitSpeechRecognition();
219//voice
220
221var debug = false; //toggle ids next to names in chat
222var 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.
223//end of basic settings
224//tests
225
226/*
227!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}}])});
228!js i=1; foo = setInterval(() => { move(i+=1,i+=1); i > 100 ? ( clearInterval(foo), move(50,50) ) : true }, 60);
229
230a = setInterval( function() {
231 if (fSpeed >= 1) {
232 fSpeed = -1
233 } else {
234 fSpeed += 0.1
235 }
236}, 300)
237
238*/
239
240//tests
241keysArray = ['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'];
242var MIDI_TRANSPOSE;
243var followId = null;
244var following = false;
245
246// 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
247// 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
248var database = {}; //use for something like storing IDs Logan
249var food_calories = 0; //tracks calories of food consumed
250var drink_calories = 0; //tracks calories of liquid consumed
251var fishCaught = 0; //tracks your fish caught
252var naughty = 0; //tracks how many times the bot has been sworn at
253var jokeGens = 0; //tracks the number of generated jokes
254var octTemp = 1; //incremental number for number of octaves
255var susTemp = true; //boolean for sustain toggling
256var rollTemp = false; //now includes MIDI supported multi-note. Thanks Josh!
257var volume = 0.5; //volume for all (if not most) notes played by you
258var transLvl = 0; //electrashave's transposition
259var delPlay = false; //for delay play
260var delays = 150; //delay
261var delTime = 1000; //amount of delay
262var copyNotes = false; //copy other's notes
263var ignoreNotes = false; //ignore notes default setting
264var politePlay = false; //doesn't send your notes so you can play while others are without interrupting
265var testflipN = false; //for Yoshify's speech to text
266var testflipP = false; //for cursor pong hotkey
267var testflipB = false; //for cursor bunny hotkey
268var testflipF = false; //for cursor follow hotkey
269var incognito = false; //turn this on to be incognito by default
270var juggle = false; //crown juggling
271var listening = false; //setting for speech to text, leave false so hotkey is off by default
272var alertOnFriendJoin = true; //sends a message in chat when a friend joins
273var crownSoloToggle = false; //toggle for hotkey
274var roomVisibleToggle = true; //toggle for hotkey
275var usersAsleep = []; //x3
276var usersDead = []; //x.x
277var giveFish = false; //toggle for !fishlord whether or not it gives fish out
278var fishLord = ""; //name of person whom receives fish if you're giving out fish
279var clearing = false; //used when clearing chat to stop spamming
280var Lvel = false; //for muting PC notes
281var meow = false; //meow meow meow meow meow meow meow meow meow
282var leet = false; //h3ll0, my n4m3 is l0g4n :3
283var animName = false; //hey hey, cuddlepet. how're you?
284var asked = false; //for !math
285var hardEnglish = true; //for !mtype difficulty
286var hardLength = 30;
287var askedEnglish = false; //for !mtype
288var sentence; //for !mtype
289var mathDiff = 2 //default difficulty for !math
290var mathDiffTxt = "Medium"; //for difficulty in text
291var mathAnswered = 0; //amount of answered questions
292var mathSkipped = 0; //amount of skipped questions
293var mathCheat = false; //c'mon >:3
294var tabbedIn = false; //for notifications only if tabbed in
295var botLoaded = false; //used for detecting if bot is loaded
296var mouseNote = false; //Chacha's mouse note thing :3
297var ouch = false; //ouch
298var ouchN = 10; //ouchNumber
299var ouchD = 0; //ouchDelay
300var lolNo = false; //no
301var sayIt = false; //Google says hi!
302var clearChat = false; //will switch to true for a few seconds when you click message count button to clear chat. Otherwise chat log is retained
303
304//my theme (if you'd like it just ask I'll upload a "friendly" version that doesn't use anything from localhost)
305$('head').append('<link rel="stylesheet" type="text/css" href="http://localhost:3000/scripts/style.css"/>');
306
307// end of advanced settings
308
309// localStorage
310var L = localStorage;
311
312// Meowpuff delerations
313if (L.MDB) {
314 var MDB = JSON.parse(L.MDB);
315 console.log('successfully loaded MDB');
316
317} else {
318 var MDB = {};
319 console.log('created new MDB');
320}
321
322var meowNeP = "You have insufficient funds for "; //not enough meow points
323
324//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)
325for (var idObj in MDB) {
326 for (var prop in MDB[idObj]) {
327 if (MDB[idObj]['meowing'] === true) MDB[idObj]['meowing'] = false;
328 }
329}
330
331// functions start //
332
333// get random interger
334function randNum(min, max) {
335 return Math.round(Math.random() * (max - min) + min);
336};
337
338// get random string
339function randStr(strLength) {
340 var str = "";
341 var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
342
343 for (var i=0; i < strLength; i++)
344 str += chars.charAt(Math.floor(Math.random() * chars.length));
345
346 return str;
347};
348
349// thanks SomeGuy and electrashave!
350function localMsg(msg) { //<3
351 MPP.client.emit('a', { m: 'a', a: msg, p: { name: "Clefairy", color: 'rgb(255, 88, 202)' }});
352};
353
354// thanks Yoshify!
355function capitalizeFirstLetter(string) {
356 return string.charAt(0).toUpperCase() + string.slice(1);
357};
358
359// date ahoy!
360function getTime() {
361 var date = new Date(); //constructor
362 var hours = date.getHours(); //hours
363 var minutes = date.getMinutes(); //minutes
364 var seconds = date.getSeconds(); //seconds
365 if (hours <= 9) hours = '0' + hours; //fix awkwardness..
366 if (minutes <= 9) minutes = '0' + minutes;
367 if (seconds <= 9) seconds = '0' + seconds;
368 return hours + ':' + minutes + ':' + seconds; //return the time formatted
369};
370
371// let's have a chat
372function say(phrase) {
373 boop = new Audio('http://ssl.gstatic.com/dictionary/static/sounds/de/0/' + phrase + '.mp3');
374 boop.play();
375};
376
377// update the cmdChar
378function updateCmdChar(cmd) {
379 document.getElementById("24-btn").innerHTML = cmd;
380}
381
382// tab (change to whatever)
383function tab() {
384 var faceArray = ["≧◔◡◔≦", "≤^.^≥", "◕ ‿ ◕",
385 "(`・ω・´)", "☜(⌒▽⌒)☞", "(◕‿◕✿)", "༼ つ ◕_◕ ༽つ", "(づ。◕‿‿◕。)づ", "(っ◕‿◕)っ", "(っ=◕‿◕=)っ"
386 ];
387 var faceSelection = Math.floor(Math.random() * faceArray.length);
388 sendChat(faceArray[faceSelection]);
389};
390
391// thanks Someguy!
392function Col(){
393 return ('#'+Math.floor(Math.random()*16777215).toString(16));
394};
395
396// thanks B@K$!
397function randomUser() { //Math.round <- was (floor is more reliable)
398 return MPP.client.ppl[Object.keys(MPP.client.ppl)[Math.floor(Math.random() * MPP.client.channel.count)]].name;
399};
400
401// thanks Ramid!
402function move(x, y){
403 MPP.client.sendArray([{ m: "m", x: x, y: y}]);
404}
405
406// (thanks for showing me Someguy)
407(function() {
408 var script = document.createElement('script');
409 script.onload = function() {
410 var stats = new Stats();
411 stats.domElement.style.cssText = ' position: fixed; top: 50px; right: 28px; z-index:10000';
412 document.body.appendChild(stats.domElement);
413 requestAnimationFrame(function loop() {
414 stats.update();
415 requestAnimationFrame(loop)
416 });
417 };
418 script.src = '//rawgit.com/mrdoob/stats.js/master/build/stats.min.js';
419 document.head.appendChild(script);
420})()
421
422// thanks electrashave!
423function similar(first, second, percent) {
424 if (first === null || second === null || typeof first === 'undefined' || typeof second === 'undefined') {
425 return 0;
426 }
427
428 first += '';
429 second += '';
430
431 var pos1 = 0,
432 pos2 = 0,
433 max = 0,
434 firstLength = first.length,
435 secondLength = second.length,
436 p, q, l, sum;
437
438 max = 0;
439
440 for (p = 0; p < firstLength; p++) {
441 for (q = 0; q < secondLength; q++) {
442 for (l = 0;
443 (p + l < firstLength) && (q + l < secondLength) && (first.charAt(p + l) === second.charAt(q + l)); l++)
444 ;
445 if (l > max) {
446 max = l;
447 pos1 = p;
448 pos2 = q;
449 }
450 }
451 }
452
453 sum = max;
454
455 if (sum) {
456 if (pos1 && pos2) {
457 sum += similar(first.substr(0, pos1), second.substr(0, pos2));
458 }
459
460 if ((pos1 + max < firstLength) && (pos2 + max < secondLength)) {
461 sum += similar(first.substr(pos1 + max, firstLength - pos1 - max), second.substr(pos2 + max,
462 secondLength - pos2 - max));
463 }
464 }
465
466 if (!percent) {
467 return sum;
468 } else {
469 return (sum * 200) / (firstLength + secondLength);
470 }
471}
472
473// thanks electrashave!
474function getUser(target) {
475 for (var id in MPP.client.ppl) {
476 if (!MPP.client.ppl.hasOwnProperty(id)) continue;
477 var part = MPP.client.ppl[id];
478 if (part.name.toLowerCase().indexOf(target) !== -1 || similar(part.name.toLowerCase(), target.toLowerCase(), 1) >= 60) {
479 return part;
480 break;
481 }
482 }
483}
484
485var z = 0;
486var follow = setInterval(function () {
487 if (following) {
488 for (var _id in MPP.client.ppl) {
489 if (!MPP.client.ppl.hasOwnProperty(_id)) continue; //if the id is yours do not follow yourself
490 var part = MPP.client.ppl[_id];
491 if (!followId) return;
492 if (part._id === followId) { //follows only that ID
493 var angle = (z) * (Math.PI/fDegree);
494 MPP.client.sendArray([{
495 m: "m",
496 x: part.x + Math.sin(angle)*fRadius,
497 y: part.y + Math.cos(angle)*fRadius
498 }]);
499 z += fSpeed;
500 }
501 }
502 }
503}, 1);
504
505// functions end //
506
507// midi btn
508$("body #bottom .relative").append('<div id="blah-btn" class="ugly-button blah_btn" style="position: absolute;bottom: 5px;left: 660px;width: 100px"; title="Creates a new lobby">New Lobby...</div>');
509
510
511// event listners start //
512
513window.addEventListener("beforeunload", function(event) {
514 if (closeCheck) {
515 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.";
516 }
517});
518// event listners end //
519
520$(function () {
521
522 var test_mode = (window.location.hash && window.location.hash.match(/^(?:#.+)*#test(?:#.+)*$/i));
523
524 //var gSeeOwnCursor = (window.location.hash && window.location.hash.match(/^(?:#.+)*#seeowncursor(?:#.+)*$/i));
525 //var lSeeOwnCursor = true; //silly
526
527 var gMidiOutTest = (window.location.hash && window.location.hash.match(/^(?:#.+)*#midiout(?:#.+)*$/i));
528
529 if (!Array.prototype.indexOf) {
530 Array.prototype.indexOf = function (elt) {
531 var len = this.length >>> 0;
532 var from = Number(arguments[1]) || 0;
533 from = (from < 0) ? Math.ceil(from) : Math.floor(from);
534 if (from < 0) from += len;
535 for (; from < len; from++) {
536 if (from in this && this[from] === elt) return from;
537 }
538 return -1;
539 };
540 }
541
542 window.requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame || function (cb) {
543 setTimeout(cb, 1000 / 30); //60
544 };
545
546 //thanks electrashave!
547 function msgBox(about, info, duration, target) {
548 window.gAlert = new Notification({
549 title: about,
550 html: info,
551 target: target,
552 duration: duration
553 });
554 }
555
556 setCmdChar = function() {
557 var promptChar = prompt('Enter a new symbol to be used for commands. (currently ' + cmdChar + ')', cmdChar);
558 cmdChar = promptChar.substring(0,1).toLowerCase();
559 msgBox('CMD symbol set to', ''+cmdChar, 2000, '#piano');
560 };
561
562
563
564 var DEFAULT_VELOCITY = 0.5;
565
566
567
568
569 var TIMING_TARGET = 1000;
570
571
572
573
574 // Utility
575
576 ////////////////////////////////////////////////////////////////
577
578
579
580 var Rect = function (x, y, w, h) {
581 this.x = x;
582 this.y = y;
583 this.w = w;
584 this.h = h;
585 this.x2 = x + w;
586 this.y2 = y + h;
587 };
588 Rect.prototype.contains = function (x, y) {
589 return (x >= this.x && x <= this.x2 && y >= this.y && y <= this.y2);
590 };
591
592 // performing translation
593
594 ////////////////////////////////////////////////////////////////
595
596 var Translation = (function () {
597 var strings = {
598 "people are playing": {
599 "pt": "pessoas est√£o jogando",
600 "es": "personas est√°n jugando",
601 "ru": "—á–µ–ª–æ–≤–µ–∫ –∏–≥—Ä–∞–µ—Ç",
602 "fr": "personnes jouent",
603 "ja": "人が遊んでいる",
604 "de": "Leute spielen",
605 "zh": "人被打",
606 "nl": "mensen spelen",
607 "pl": "osób grają",
608 "hu": "ember j√°tszik"
609 },
610 "New Room...": {
611 "pt": "Nova Sala ...",
612 "es": "Nueva sala de...",
613 "ru": "–ù–æ–≤—ã–π –Ω–æ–º–µ—Ä...",
614 "ja": "新しい部屋",
615 "zh": "新房间",
616 "nl": "nieuwe Kamer",
617 "hu": "√∫j szoba"
618 },
619 "room name": {
620 "pt": "nome da sala",
621 "es": "sala de nombre",
622 "ru": "–Ω–∞–∑–≤–∞–Ω–∏–µ –∫–æ–º–Ω–∞—Ç—ã",
623 "fr": "nom de la chambre",
624 "ja": "ルーム名",
625 "de": "Raumnamen",
626 "zh": "房间名称",
627 "nl": "kamernaam",
628 "pl": "nazwa pokój",
629 "hu": "szoba neve"
630 },
631 "Visible (open to everyone)": {
632 "pt": "Visível (aberto a todos)",
633 "es": "Visible (abierto a todo el mundo)",
634 "ru": "Visible (–æ—Ç–∫—Ä—ã—Ç—ã–π –¥–ª—è –≤—Å–µ—Ö)",
635 "fr": "Visible (ouvert à tous)",
636 "ja": "目に見える(誰にでも開いている)",
637 "de": "Sichtbar (offen für alle)",
638 "zh": "可见(向所有人开放)",
639 "nl": "Zichtbaar (open voor iedereen)",
640 "pl": "Widoczne (otwarte dla wszystkich)",
641 "hu": "Látható (nyitott mindenki számára)"
642 },
643 "Enable Chat": {
644 "pt": "Ativar bate-papo",
645 "es": "Habilitar chat",
646 "ru": "–í–∫–ª—é—á–∏—Ç—å —á–∞—Ç",
647 "fr": "Activer discuter",
648 "ja": "チャットを有効にする",
649 "de": "aktivieren Sie chatten",
650 "zh": "启用聊天",
651 "nl": "Chat inschakelen",
652 "pl": "Włącz czat",
653 "hu": "a csevegést"
654 }
655 // todo: it, tr, th, sv, ar, fi, nb, da, sv, he, cs, ko, ro, vi, id, nb, el, sk, bg, lt, sl, hr
656 // todo: Connecting, Offline mode, input placeholder, Notifications
657 };
658
659 var setLanguage = function (lang) {
660 language = lang
661 };
662
663 var getLanguage = function () {
664 if (window.navigator && navigator.language && navigator.language.length >= 2) {
665 return navigator.language.substr(0, 2).toLowerCase();
666 } else {
667 return "en";
668 }
669 };
670
671 var get = function (text, lang) {
672 if (typeof lang === "undefined") lang = language;
673 var row = strings[text];
674 if (row == undefined) return text;
675 var string = row[lang];
676 if (string == undefined) return text;
677 return string;
678 };
679
680 var perform = function (lang) {
681 if (typeof lang === "undefined") lang = language;
682 $(".translate").each(function (i, ele) {
683 var th = $(this);
684 if (ele.tagName && ele.tagName.toLowerCase() == "input") {
685 if (typeof ele.placeholder != "undefined") {
686 th.attr("placeholder", get(th.attr("placeholder"), lang))
687 }
688 } else {
689 th.text(get(th.text(), lang));
690 }
691 });
692 };
693
694 var language = getLanguage();
695
696 return {
697 setLanguage: setLanguage,
698 getLanguage: getLanguage,
699 get: get,
700 perform: perform
701 };
702 })();
703
704 Translation.perform();
705
706
707
708
709 // AudioEngine classes
710
711 ////////////////////////////////////////////////////////////////
712
713 var AudioEngine = function () {};
714
715 AudioEngine.prototype.init = function (cb) {
716 this.volume = 0.6;
717 this.sounds = {};
718 return this;
719 };
720
721 AudioEngine.prototype.load = function (id, url, cb) {};
722
723 AudioEngine.prototype.play = function () {};
724
725 AudioEngine.prototype.stop = function () {};
726
727 AudioEngine.prototype.setVolume = function (vol) {
728 this.volume = vol;
729 };
730
731
732 AudioEngineSM2 = function () {};
733
734 AudioEngineSM2.prototype = new AudioEngine();
735
736 AudioEngineSM2.prototype.init = function (cb) {
737 AudioEngine.prototype.init.call(this);
738
739 window.SM2_DEFER = true;
740 var script = document.createElement("script");
741 script.src = "/soundmanager2/soundmanager2.js";
742
743 var loaded = false;
744 script.onload = function () {
745 if (loaded) return;
746 if (typeof SoundManager === "undefined") {
747 setTimeout(script.onload, 4000);
748 return;
749 }
750 loaded = true;
751
752 //sound manager settings
753 window.soundManager = new SoundManager();
754 soundManager.url = "/soundmanager2/";
755 soundManager.debugMode = test_mode ? true : false;
756 soundManager.useHTML5Audio = false;
757 soundManager.flashVersion = 9;
758 soundManager.multiShot = true;
759 soundManager.useHighPerformance = true;
760 soundManager.beginDelayedInit();
761 if (cb) soundManager.onready(cb);
762 };
763 setTimeout(script.onload, 4000);
764
765 document.body.appendChild(script);
766 return this;
767 };
768
769 AudioEngineSM2.prototype.load = function (id, url, cb) {
770 this.sounds[id] = soundManager.createSound({
771 id: id,
772 url: url,
773 autoLoad: true,
774 volume: this.volume,
775 onload: cb
776 });
777 };
778
779 AudioEngineSM2.prototype.play = function (id, vol, delay_ms) {
780 var self = this;
781 setTimeout(function () {
782 soundManager.play(id, {
783 volume: self.volume * 100.0
784 });
785 }, delay_ms);
786 };
787
788 AudioEngineSM2.prototype.setVolume = function (vol) {
789 AudioEngine.prototype.setVolume.call(this, vol);
790 for (var i in this.sounds) {
791 if (this.sounds.hasOwnProperty(i)) {
792 this.sounds[i].setVolume(this.volume * 100.0);
793 }
794 }
795 };
796
797
798 AudioEngineWeb = function () {};
799
800 AudioEngineWeb.prototype = new AudioEngine();
801
802 AudioEngineWeb.prototype.init = function (cb) {
803 AudioEngine.prototype.init.call(this);
804 this.context = new AudioContext();
805 this.gainNode = this.context.createGain();
806 this.gainNode.connect(this.context.destination);
807 this.gainNode.gain.value = this.volume;
808 this.playings = {};
809 if (cb) setTimeout(cb, 0);
810 return this;
811 };
812
813 AudioEngineWeb.prototype.load = function (id, url, cb) {
814 var audio = this;
815 var req = new XMLHttpRequest();
816 req.open("GET", url);
817 req.responseType = "arraybuffer";
818 req.addEventListener("readystatechange", function (evt) {
819 if (req.readyState !== 4) return;
820 try {
821 audio.context.decodeAudioData(req.response, function (buffer) {
822 audio.sounds[id] = buffer;
823 if (cb) cb();
824 });
825 } catch (e) { //was commented
826 throw new Error(e.message
827 + " / id: " + id
828 + " / url: " + url
829 + " / status: " + req.status
830 + " / ArrayBuffer: " + (req.response instanceof ArrayBuffer)
831 + " / byteLength: " + (req.response && req.response.byteLength ? req.response.byteLength : "undefined"));
832 //was commented
833 new Notification({
834 id: "audio-download-error",
835 title: "Problem",
836 text: "For some reason, an audio download failed with a status of " + req.status + ". " + " I blame antivirus software.",
837 target: "#piano",
838 duration: 10000
839 });
840 }
841 });
842 req.send();
843 };
844
845 AudioEngineWeb.prototype.play = function (id, vol, delay_ms, part_id) {
846 if (!this.sounds.hasOwnProperty(id)) return;
847 var time = this.context.currentTime + (delay_ms / 1000);
848 var source = this.context.createBufferSource();
849 source.buffer = this.sounds[id];
850 var gain = this.context.createGain();
851 gain.gain.value = vol;
852 source.connect(gain);
853 gain.connect(this.gainNode);
854 source.start(time);
855 // Patch from ste-art remedies stuttering under heavy load
856 if (this.playings[id]) {
857 var playing = this.playings[id];
858 playing.gain.gain.setValueAtTime(playing.gain.gain.value, time);
859 playing.gain.gain.linearRampToValueAtTime(0.0, time + 0.1);
860 playing.source.stop(time + 0.1);
861 /*playing.gain.gain.linearRampToValueAtTime(0.0, time + 0.5); //Ray's fix for single notes being pressed multiple times
862 playing.source.stop(time + 0.6);*/
863 }
864 this.playings[id] = {
865 "source": source,
866 "gain": gain,
867 "part_id": part_id
868 };
869 };
870
871 AudioEngineWeb.prototype.stop = function (id, delay_ms, part_id) {
872 if (this.playings.hasOwnProperty(id) && this.playings[id] && this.playings[id].part_id === part_id) {
873 var time = this.context.currentTime + (delay_ms / 1000);
874 var gain = this.playings[id].gain.gain;
875 gain.setValueAtTime(gain.value, time);
876 gain.linearRampToValueAtTime(gain.value * 0.1, time + 0.16);
877 gain.linearRampToValueAtTime(0.0, time + 1.9);
878 this.playings[id].source.stop(time + 2.0);
879 this.playings[id] = null;
880 }
881 };
882
883 AudioEngineWeb.prototype.setVolume = function (vol) {
884 AudioEngine.prototype.setVolume.call(this, vol);
885 this.gainNode.gain.value = this.volume;
886 };
887
888
889
890
891 // VolumeSlider inst
892
893 ////////////////////////////////////////////////////////////////
894
895 var VolumeSlider = function (ele, cb) {
896 this.rootElement = ele;
897 this.cb = cb;
898 var range = document.createElement("input");
899 try {
900 range.type = "range";
901 } catch (e) {
902 // Hello, IE9
903 }
904 if (range.min !== undefined) {
905 this.range = range;
906 this.rootElement.appendChild(range);
907 range.className = "volume-slider"; //volume settings
908 range.min = "0.0";
909 range.max = "1.0";
910 range.step = "0.01";
911 $(range).on("change", function (evt) {
912 cb(range.value);
913 });
914 } else {
915 if (window.console) console.warn("Warning: for some stupid reason there's no volume-slider");
916 // todo
917 }
918 };
919
920 VolumeSlider.prototype.set = function (v) {
921 if (this.range !== undefined) {
922 this.range.value = v;
923 } else {
924 // todo
925 }
926 };
927
928
929
930
931 // Renderer classes
932
933 ////////////////////////////////////////////////////////////////
934
935 var Renderer = function () {};
936
937 Renderer.prototype.init = function (piano) {
938 this.piano = piano;
939 this.resize();
940 return this;
941 };
942
943 Renderer.prototype.resize = function (width, height) {
944 if (typeof width == "undefined") width = $(this.piano.rootElement).width();
945 if (typeof height == "undefined") height = Math.floor(width * 0.2);
946 $(this.piano.rootElement).css({
947 "height": height + "px",
948 marginTop: Math.floor($(window).height() / 2 - height / 2) + "px"
949 });
950 this.width = width;
951 this.height = height;
952 };
953
954 Renderer.prototype.visualize = function (key, color) {};
955
956
957
958
959 var DOMRenderer = function () {
960 Renderer.call(this);
961 };
962
963 DOMRenderer.prototype = new Renderer();
964
965 DOMRenderer.prototype.init = function (piano) {
966 // create keys in dom
967 for (var i in piano.keys) {
968 if (!piano.keys.hasOwnProperty(i)) continue;
969 var key = piano.keys[i];
970 var ele = document.createElement("div");
971 key.domElement = ele;
972 piano.rootElement.appendChild(ele);
973 // "key sharp cs cs2"
974 ele.note = key.note;
975 ele.id = key.note;
976 ele.className = "key " + (key.sharp ? "sharp " : " ") + key.baseNote + " " + key.note + " loading";
977 var table = $('<table width="100%" height="100%" style="pointer-events:none"></table>');
978 var td = $('<td valign="bottom"></td>');
979 table.append(td);
980 td.valign = "bottom";
981 $(ele).append(table);
982 }
983 // add event listeners
984 var mouse_down = false;
985 $(piano.rootElement).mousedown(function (event) {
986 // todo: IE10 doesn't support the pointer-events css rule on the "blips"
987 var ele = event.target;
988 if ($(ele).hasClass("key") && piano.keys.hasOwnProperty(ele.note)) {
989 var key = piano.keys[ele.note];
990 press(key.note);
991 mouse_down = true;
992 event.stopPropagation();
993 };
994 //event.preventDefault();
995 });
996 piano.rootElement.addEventListener("touchstart", function (event) {
997 for (var i in event.changedTouches) {
998 var ele = event.changedTouches[i].target;
999 if ($(ele).hasClass("key") && piano.keys.hasOwnProperty(ele.note)) {
1000 var key = piano.keys[ele.note];
1001 press(key.note);
1002 mouse_down = true;
1003 event.stopPropagation();
1004 }
1005 }
1006 //event.preventDefault();
1007 }, false);
1008 $(window).mouseup(function (event) {
1009 mouse_down = false;
1010 });
1011
1012 Renderer.prototype.init.call(this, piano);
1013 return this;
1014 };
1015
1016 DOMRenderer.prototype.resize = function (width, height) {
1017 Renderer.prototype.resize.call(this, width, height);
1018 };
1019
1020 DOMRenderer.prototype.visualize = function (key, color) { //mess with Logan
1021 var k = $(key.domElement);
1022 k.addClass("play");
1023 setTimeout(function () {
1024 k.removeClass("play");
1025 }, 100);
1026 // "blips"
1027 var d = $('<div style="width:100%;height:10%;margin:0;padding:0"> </div>');
1028 d.css("background", color);
1029 k.find("td").append(d);
1030 d.fadeOut(1000, function () {
1031 d.remove();
1032 });
1033 };
1034
1035
1036
1037
1038 var CanvasRenderer = function () {
1039 Renderer.call(this);
1040 };
1041
1042 CanvasRenderer.prototype = new Renderer();
1043
1044 CanvasRenderer.prototype.init = function (piano) {
1045 this.canvas = document.createElement("canvas");
1046 this.ctx = this.canvas.getContext("2d");
1047 piano.rootElement.appendChild(this.canvas);
1048
1049 Renderer.prototype.init.call(this, piano); // calls resize()
1050
1051 // create render loop
1052 var self = this;
1053 var render = function () {
1054 self.redraw();
1055 requestAnimationFrame(render);
1056 };
1057 requestAnimationFrame(render);
1058
1059 // add event listeners
1060 var mouse_down = false;
1061 var last_key = null;
1062 $(piano.rootElement).mousedown(function(event) {
1063 mouse_down = true;
1064 event.preventDefault();
1065
1066 var pos = CanvasRenderer.translateMouseEvent(event);
1067 var hit = self.getHit(pos.x, pos.y);
1068 if(hit) {
1069 press(hit.key.note, volume);
1070 last_key = hit.key;
1071 }
1072 });
1073 piano.rootElement.addEventListener("touchstart", function (event) { //mess with Logan
1074 mouse_down = true;
1075 event.preventDefault();
1076 for (var i in event.changedTouches) {
1077 var pos = CanvasRenderer.translateMouseEvent(event);
1078 var hit = self.getHit(pos.x, pos.y);
1079 if (hit) {
1080 last_key = hit.key;
1081 }
1082 }
1083 }, false);
1084 $(window).mouseup(function (event) {
1085 if (last_key) {
1086 release(last_key.note);
1087 }
1088 mouse_down = false;
1089 last_key = null;
1090 });
1091 $(piano.rootElement).mousemove(function(event) { //enables you to hold mouse and drag across notes.
1092 if(!mouse_down) return;
1093 var pos = CanvasRenderer.translateMouseEvent(event);
1094 var hit = self.getHit(pos.x, pos.y);
1095 if(hit && hit.key != last_key) {
1096 press(hit.key.note, volume);
1097 last_key = hit.key;
1098 release(last_key.note); //fix for sustain ignoring mouse being dragged across keys -Logan
1099 }
1100 });
1101
1102 return this;
1103 };
1104
1105 CanvasRenderer.prototype.resize = function (width, height) {
1106 Renderer.prototype.resize.call(this, width, height);
1107 if (this.width < 52 * 2) this.width = 52 * 2;
1108 if (this.height < this.width * 0.2) this.height = Math.floor(this.width * 0.2);
1109 this.canvas.width = this.width;
1110 this.canvas.height = this.height;
1111
1112 // calculate key sizes
1113 this.whiteKeyWidth = Math.floor(this.width / 52);
1114 this.whiteKeyHeight = Math.floor(this.height * 0.9);
1115 this.blackKeyWidth = Math.floor(this.whiteKeyWidth * 0.75);
1116 this.blackKeyHeight = Math.floor(this.height * 0.5);
1117
1118 this.blackKeyOffset = Math.floor(this.whiteKeyWidth - (this.blackKeyWidth / 2));
1119 this.keyMovement = Math.floor(this.whiteKeyHeight * 0.015);
1120
1121 this.whiteBlipWidth = Math.floor(this.whiteKeyWidth * 0.7);
1122 this.whiteBlipHeight = Math.floor(this.whiteBlipWidth * 0.8);
1123 this.whiteBlipX = Math.floor((this.whiteKeyWidth - this.whiteBlipWidth) / 2);
1124 this.whiteBlipY = Math.floor(this.whiteKeyHeight - this.whiteBlipHeight * 1.2);
1125 this.blackBlipWidth = Math.floor(this.blackKeyWidth * 0.7);
1126 this.blackBlipHeight = Math.floor(this.blackBlipWidth * 0.8);
1127 this.blackBlipY = Math.floor(this.blackKeyHeight - this.blackBlipHeight * 1.2);
1128 this.blackBlipX = Math.floor((this.blackKeyWidth - this.blackBlipWidth) / 2);
1129
1130 // prerender white key
1131 this.whiteKeyRender = document.createElement("canvas");
1132 this.whiteKeyRender.width = this.whiteKeyWidth;
1133 this.whiteKeyRender.height = this.height + 10;
1134 var ctx = this.whiteKeyRender.getContext("2d");
1135 if (ctx.createLinearGradient) {
1136 var gradient = ctx.createLinearGradient(0, 0, 0, this.whiteKeyHeight);
1137 gradient.addColorStop(0, "#39ff14");
1138 gradient.addColorStop(0.35, "#39ff14");
1139 gradient.addColorStop(1, "#dad4d4");
1140 ctx.fillStyle = gradient;
1141 } else {
1142 ctx.fillStyle = "#fff";
1143 }
1144 ctx.strokeStyle = "#000";
1145 ctx.lineJoin = "round";
1146 ctx.lineCap = "round";
1147 ctx.lineWidth = 10;
1148 ctx.strokeRect(ctx.lineWidth / 2, ctx.lineWidth / 2, this.whiteKeyWidth - ctx.lineWidth, this.whiteKeyHeight - ctx.lineWidth);
1149 ctx.lineWidth = 2.5; //4 - shadow between the white keys
1150 ctx.fillRect(ctx.lineWidth / 2, ctx.lineWidth / 2, this.whiteKeyWidth - ctx.lineWidth, this.whiteKeyHeight - ctx.lineWidth);
1151
1152 // prerender black key
1153 this.blackKeyRender = document.createElement("canvas");
1154 this.blackKeyRender.width = this.blackKeyWidth + 10;
1155 this.blackKeyRender.height = this.blackKeyHeight + 10;
1156 var ctx = this.blackKeyRender.getContext("2d");
1157 if (ctx.createLinearGradient) {
1158 var gradient = ctx.createLinearGradient(0, 0, 0, this.blackKeyHeight);
1159 gradient.addColorStop(0, "#000");
1160 gradient.addColorStop(1, "#444");
1161 ctx.fillStyle = gradient;
1162 } else {
1163 ctx.fillStyle = "#000";
1164 }
1165 ctx.strokeStyle = "#222";
1166 ctx.lineJoin = "round";
1167 ctx.lineCap = "round";
1168 ctx.lineWidth = 8;
1169 ctx.strokeRect(ctx.lineWidth / 2, ctx.lineWidth / 2, this.blackKeyWidth - ctx.lineWidth, this.blackKeyHeight - ctx.lineWidth);
1170 ctx.lineWidth = 4;
1171 ctx.fillRect(ctx.lineWidth / 2, ctx.lineWidth / 2, this.blackKeyWidth - ctx.lineWidth, this.blackKeyHeight - ctx.lineWidth);
1172
1173 // prerender shadows
1174 this.shadowRender = [];
1175 var y = -this.canvas.height * 2;
1176 for (var j = 0; j < 2; j++) {
1177 var canvas = document.createElement("canvas");
1178 this.shadowRender[j] = canvas;
1179 canvas.width = this.canvas.width;
1180 canvas.height = this.canvas.height;
1181 var ctx = canvas.getContext("2d");
1182 var sharp = j ? true : false;
1183 ctx.lineJoin = "round";
1184 ctx.lineCap = "round";
1185 ctx.lineWidth = 1;
1186 ctx.shadowColor = "rgba(0, 0, 0, 0.5)";
1187 ctx.shadowBlur = this.keyMovement * 3;
1188 ctx.shadowOffsetY = -y + this.keyMovement;
1189 if (sharp) {
1190 ctx.shadowOffsetX = this.keyMovement;
1191 } else {
1192 ctx.shadowOffsetX = 0;
1193 ctx.shadowOffsetY = -y + this.keyMovement;
1194 }
1195 for (var i in this.piano.keys) {
1196 if (!this.piano.keys.hasOwnProperty(i)) continue;
1197 var key = this.piano.keys[i];
1198 if (key.sharp != sharp) continue;
1199
1200 if (key.sharp) {
1201 ctx.fillRect(this.blackKeyOffset + this.whiteKeyWidth * key.spatial + ctx.lineWidth / 2,
1202 y + ctx.lineWidth / 2,
1203 this.blackKeyWidth - ctx.lineWidth, this.blackKeyHeight - ctx.lineWidth);
1204 } else {
1205 ctx.fillRect(this.whiteKeyWidth * key.spatial + ctx.lineWidth / 2,
1206 y + ctx.lineWidth / 2,
1207 this.whiteKeyWidth - ctx.lineWidth, this.whiteKeyHeight - ctx.lineWidth);
1208 }
1209 }
1210 }
1211
1212 // update key rects
1213 for (var i in this.piano.keys) {
1214 if (!this.piano.keys.hasOwnProperty(i)) continue;
1215 var key = this.piano.keys[i];
1216 if (key.sharp) {
1217 key.rect = new Rect(this.blackKeyOffset + this.whiteKeyWidth * key.spatial, 0,
1218 this.blackKeyWidth, this.blackKeyHeight);
1219 } else {
1220 key.rect = new Rect(this.whiteKeyWidth * key.spatial, 0,
1221 this.whiteKeyWidth, this.whiteKeyHeight);
1222 }
1223 }
1224 };
1225
1226 CanvasRenderer.prototype.visualize = function (key, color) {
1227 key.timePlayed = Date.now();
1228 key.blips.push({
1229 "time": key.timePlayed,
1230 "color": color
1231 });
1232 };
1233
1234 CanvasRenderer.prototype.redraw = function () {
1235 var now = Date.now();
1236 var timeLoadedEnd = now - 1000;
1237 var timePlayedEnd = now - 100;
1238 var timeBlipEnd = now - 1000;
1239
1240 this.ctx.save();
1241 this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
1242 // draw all keys
1243 for (var j = 0; j < 2; j++) {
1244 this.ctx.globalAlpha = 1.0; //unloaded keys colour
1245 this.ctx.drawImage(this.shadowRender[j], 0, 0);
1246 var sharp = j ? true : false;
1247 for (var i in this.piano.keys) {
1248 if (!this.piano.keys.hasOwnProperty(i)) continue;
1249 var key = this.piano.keys[i];
1250 if (key.sharp != sharp) continue;
1251
1252 if (!key.loaded) {
1253 this.ctx.globalAlpha = 0.2;
1254 } else if (key.timeLoaded > timeLoadedEnd) {
1255 this.ctx.globalAlpha = ((now - key.timeLoaded) / 1000) * 0.8 + 0.2;
1256 } else {
1257 this.ctx.globalAlpha = 1.0;
1258 }
1259 var y = 0;
1260 if (key.timePlayed > timePlayedEnd) {
1261 y = Math.floor(this.keyMovement - (((now - key.timePlayed) / 100) * this.keyMovement));
1262 }
1263 var x = Math.floor(key.sharp ? this.blackKeyOffset + this.whiteKeyWidth * key.spatial : this.whiteKeyWidth * key.spatial);
1264 var image = key.sharp ? this.blackKeyRender : this.whiteKeyRender;
1265 this.ctx.drawImage(image, x, y);
1266
1267 // render blips
1268 if (key.blips.length) {
1269 var alpha = this.ctx.globalAlpha;
1270 var w, h;
1271 if (key.sharp) {
1272 x += this.blackBlipX;
1273 y = this.blackBlipY;
1274 w = this.blackBlipWidth;
1275 h = this.blackBlipHeight;
1276 } else {
1277 x += this.whiteBlipX;
1278 y = this.whiteBlipY;
1279 w = this.whiteBlipWidth;
1280 h = this.whiteBlipHeight;
1281 }
1282 for (var b = 0; b < key.blips.length; b++) {
1283 var blip = key.blips[b];
1284 if (blip.time > timeBlipEnd) {
1285 this.ctx.fillStyle = blip.color;
1286 this.ctx.globalAlpha = alpha - ((now - blip.time) / 1000);
1287 this.ctx.fillRect(x, y, w, h);
1288 } else {
1289 key.blips.splice(b, 1);
1290 --b;
1291 }
1292 y -= Math.floor(h * 1.1); //blips space apart
1293 }
1294 }
1295 }
1296 }
1297 this.ctx.restore();
1298 };
1299
1300 CanvasRenderer.prototype.getHit = function (x, y) {
1301 for (var j = 0; j < 2; j++) {
1302 var sharp = j ? false : true; // black keys first
1303 for (var i in this.piano.keys) {
1304 if (!this.piano.keys.hasOwnProperty(i)) continue;
1305 var key = this.piano.keys[i];
1306 if (key.sharp != sharp) continue;
1307 if (key.rect.contains(x, y)) {
1308 var v = y / (key.sharp ? this.blackKeyHeight : this.whiteKeyHeight);
1309 v += 0.25;
1310 v *= DEFAULT_VELOCITY;
1311 if (v > 1.0) v = 1.0;
1312 return {
1313 "key": key,
1314 "v": v
1315 };
1316 }
1317 }
1318 }
1319 return null;
1320 };
1321
1322
1323 CanvasRenderer.isSupported = function () {
1324 var canvas = document.createElement("canvas");
1325 return !!(canvas.getContext && canvas.getContext("2d"));
1326 };
1327
1328 CanvasRenderer.translateMouseEvent = function (evt) {
1329 var element = evt.target;
1330 var offx = 0;
1331 var offy = 0;
1332 do {
1333 offx += element.offsetLeft;
1334 offy += element.offsetTop;
1335 } while (element = element.offsetParent);
1336 return {
1337 x: evt.pageX - offx,
1338 y: evt.pageY - offy
1339 }
1340 };
1341
1342 // Soundpack Stuff by electrashave ♥
1343
1344////////////////////////////////////////////////////////////////
1345
1346 function SoundSelector(piano) {
1347 this.initialized = false;
1348 this.keys = piano.keys;
1349 this.loading = {};
1350 this.notification;
1351 this.packs = [];
1352 this.piano = piano;
1353 this.soundSelection = localStorage.soundSelection || "MPP Classic";
1354 this.addPack({name: "MPP Classic", keys: Object.keys(this.piano.keys), ext: ".mp3", url: "/sounds/mppclassic/"});
1355 }
1356
1357 SoundSelector.prototype.addPack = function(pack, load) {
1358 var self = this;
1359 self.loading[pack.url || pack] = true;
1360 function add(obj) {
1361 var added = false;
1362 for (var i = 0; self.packs.length > i; i++) {
1363 if (obj.name == self.packs[i].name) {
1364 added = true;
1365 break;
1366 }
1367 }
1368
1369 if (added) return console.warn("Sounds already added!!"); //no adding soundpacks twice D:<
1370
1371 if (obj.url.substr(obj.url.length-1) != "/") obj.url = obj.url + "/";
1372 var html = document.createElement("li");
1373 html.classList = "pack";
1374 html.innerText = obj.name + " (" + obj.keys.length + " keys)";
1375 html.onclick = function() {
1376 self.loadPack(obj.name);
1377 self.notification.close();
1378 };
1379 obj.html = html;
1380 self.packs.push(obj);
1381 self.packs.sort(function(a, b) {
1382 if(a.name < b.name) return -1;
1383 if(a.name > b.name) return 1;
1384 return 0;
1385 });
1386 if (load) self.loadPack(obj.name);
1387 delete self.loading[obj.url];
1388 }
1389
1390 if (typeof pack == "string") {
1391 $.getJSON(pack + "/info.json").done(function(json) {
1392 json.url = pack;
1393 add(json);
1394 });
1395 } else add(pack); //validate packs??
1396 };
1397
1398 SoundSelector.prototype.addPacks = function(packs) {
1399 for (var i = 0; packs.length > i; i++) this.addPack(packs[i]);
1400 };
1401
1402 SoundSelector.prototype.init = function() {
1403 var self = this;
1404 if (self.initialized) return console.warn("Sound selector already initialized!");
1405
1406 if (!!Object.keys(self.loading).length) return setTimeout(function() {
1407 self.init();
1408 }, 250);
1409
1410 $("#sound-btn").on("click", function() {
1411 if (document.getElementById("Notification-Sound-Selector") != null) return self.notification.close();
1412 var html = document.createElement("ul");
1413 $(html).append("<h1>Current Sound: " + self.soundSelection + "</h1>");
1414
1415 for (var i = 0; self.packs.length > i; i++) {
1416 var pack = self.packs[i];
1417 if (pack.name == self.soundSelection) pack.html.classList = "pack enabled";
1418 else pack.html.classList = "pack";
1419 html.appendChild(pack.html);
1420 }
1421 self.notification = new Notification({title: "Sound Selector:", html: html, id: "Sound-Selector", duration: -1, target: "#sound-btn"});
1422 });
1423 self.initialized = true;
1424 self.loadPack(self.soundSelection, true);
1425 };
1426
1427 SoundSelector.prototype.loadPack = function(pack, f) {
1428 for (var i = 0; this.packs.length > i; i++) {
1429 var p = this.packs[i];
1430 if (p.name == pack) {
1431 pack = p;
1432 break;
1433 }
1434 }
1435 if (typeof pack == "string") {
1436 console.warn("Sound pack does not exist! Loading default pack...");
1437 return this.loadPack("MPP Classic");
1438 }
1439
1440 if (pack.name == this.soundSelection && !f) return;
1441 if (pack.keys.length != Object.keys(this.piano.keys).length) {
1442 this.piano.keys = {};
1443 for (var i = 0; pack.keys.length > i; i++) this.piano.keys[pack.keys[i]] = this.keys[pack.keys[i]];
1444 this.piano.renderer.resize();
1445 }
1446
1447 var self = this;
1448 for (var i in this.piano.keys) {
1449 if (!this.piano.keys.hasOwnProperty(i)) continue;
1450 (function() {
1451 var key = self.piano.keys[i];
1452 key.loaded = false;
1453 self.piano.audio.load(key.note, pack.url + key.note + pack.ext, function() {
1454 key.loaded = true;
1455 key.timeLoaded = Date.now();
1456 });
1457 })();
1458 }
1459 localStorage.soundSelection = pack.name;
1460 this.soundSelection = pack.name;
1461 };
1462
1463 SoundSelector.prototype.removePack = function(name) {
1464 var found = false;
1465 for (var i = 0; this.packs.length > i; i++) {
1466 var pack = this.packs[i];
1467 if (pack.name == name) {
1468 this.packs.splice(i, 1);
1469 if (pack.name == this.soundSelection) this.loadPack(this.packs[0].name); //add mpp default if none?
1470 break;
1471 }
1472 }
1473 if (!found) console.warn("Sound pack not found!");
1474 };
1475
1476
1477
1478 // Pianoctor
1479
1480 ////////////////////////////////////////////////////////////////
1481
1482 var PianoKey = function(note, octave, num) {
1483 this.note = note + octave;
1484 this.baseNote = note;
1485 this.octave = octave;
1486 this.sharp = note.indexOf("s") != -1;
1487 this.loaded = false;
1488 this.timeLoaded = 0;
1489 this.domElement = null;
1490 this.timePlayed = 0;
1491 this.blips = [];
1492 this.num = num; //Ltranspose
1493 };
1494
1495 var Piano = function (rootElement) {
1496
1497 var piano = this;
1498 piano.rootElement = rootElement;
1499 piano.keys = {};
1500
1501 var white_spatial = 0;
1502 var black_spatial = 0;
1503 var black_it = 0;
1504 var black_lut = [2, 1, 2, 1, 1];
1505 var addKey = function(note, octave, num) {
1506 var key = new PianoKey(note, octave, num);
1507 piano.keys[key.note] = key;
1508 if (key.sharp) {
1509 key.spatial = black_spatial;
1510 black_spatial += black_lut[black_it % 5];
1511 ++black_it;
1512 } else {
1513 key.spatial = white_spatial;
1514 ++white_spatial;
1515 }
1516 }
1517 if (test_mode) { //Logan check!
1518 addKey("c", 2);
1519
1520 } else {
1521 addKey("a", -1, 1);
1522 addKey("as", -1, 2);
1523 addKey("b", -1, 3);
1524 var notes = "c cs d ds e f fs g gs a as b".split(" ");
1525 var count = 4;
1526
1527 for(var oct = 0; oct < 7; oct++) {
1528 for(var i in notes) {
1529 addKey(notes[i], oct, count);
1530 count++;
1531 }
1532 }
1533 addKey("c", 7); //default key
1534 addKey("cs", 7); //extra key
1535 addKey("d", 7); //extra key
1536 addKey("ds", 7); //extra key
1537 addKey("e", 7); //extra key
1538
1539 }
1540
1541
1542 var render_engine = CanvasRenderer.isSupported() ? CanvasRenderer : DOMRenderer;
1543 this.renderer = new render_engine().init(this);
1544
1545 $(window).resize(function () {
1546 piano.renderer.resize();
1547 });
1548
1549
1550 window.AudioContext = window.AudioContext || window.webkitAudioContext || undefined;
1551 var audio_engine = (window.AudioContext === undefined) ? AudioEngineSM2 : AudioEngineWeb;
1552
1553 // Firefox 25 supports WebAudio, but a decodeAudioData issue is blocking until 26
1554 // https://bugzilla.mozilla.org/show_bug.cgi?id=865553
1555 var search_str = " Firefox/";
1556 var idx = navigator.userAgent.indexOf(search_str);
1557 if (idx !== -1) {
1558 var version = parseFloat(navigator.userAgent.substring(idx + search_str.length));
1559 if (isNaN(version) || version < 26.0) {
1560 audio_engine = AudioEngineSM2;
1561 }
1562 }
1563
1564 this.audio = new audio_engine().init();
1565 };
1566
1567 Piano.prototype.play = function(note, vol, participant, delay_ms) {
1568 if(!this.keys.hasOwnProperty(note)) return;
1569 var key = this.keys[note];
1570 if(key.loaded) this.audio.play(key.note, vol, delay_ms, participant.id);
1571 if(typeof gMidiOutTest === "function") gMidiOutTest(key.note, vol * 100, delay_ms);
1572 var self = this;
1573 var jq_namediv = $(typeof participant == "undefined" ? null : participant.nameDiv);
1574 if(jq_namediv) {
1575 setTimeout(function() {
1576 self.renderer.visualize(key, typeof participant == "undefined" ? "yellow" : (participant.color || "#777"));
1577 jq_namediv.addClass("play");
1578 setTimeout(function() {
1579 jq_namediv.removeClass("play");
1580 }, 30);
1581 }, delay_ms);
1582 }
1583 };
1584
1585 Piano.prototype.stop = function(note, participant, delay_ms) {
1586 if(!this.keys.hasOwnProperty(note)) return;
1587 var key = this.keys[note];
1588 if(key.loaded) this.audio.stop(key.note, delay_ms, participant.id);
1589 if(typeof gMidiOutTest === "function") gMidiOutTest(key.note, 0, delay_ms);
1590 };
1591
1592 var gPiano = new Piano(document.getElementById("piano"));
1593
1594 var gSoundSelector = new SoundSelector(gPiano);
1595 gSoundSelector.addPacks(["/sounds/Emotional_2.0/", "/sounds/Harp/", "/sounds/Music_Box/", "/sounds/Vintage_Upright/", "/sounds/Steinway_Grand/", "/sounds/Emotional/", "/sounds/Untitled/"]);
1596 gSoundSelector.init();
1597
1598 var gAutoSustain = true;
1599 var gSustain = false;
1600
1601 var gHeldNotes = {};
1602 var gSustainedNotes = {};
1603
1604 // roll
1605 function roll(id, vol, i) {
1606 if (octTemp == 1) { //check Logan
1607 gPiano.play(id, vol !== undefined ? vol : DEFAULT_VELOCITY, gClient.getOwnParticipant(), 0);
1608 gClient.startNote(id, vol);
1609 return;
1610 }
1611 setTimeout(function() {
1612 gPiano.play(id, vol !== undefined ? vol : DEFAULT_VELOCITY, gClient.getOwnParticipant(), 0);
1613 gClient.startNote(id, vol);
1614 }, delays + (delays * i));
1615 }
1616 // pressing
1617 function pressing(id, vol) {
1618 if (ouch) {
1619 for (i=0; i <= ouchN; i++) {
1620 setTimeout( function() { gPiano.play(id, vol !== undefined ? vol : DEFAULT_VELOCITY, gClient.getOwnParticipant(), 0);}, ouchD * i);
1621 if (!politePlay) {
1622 setTimeout( function() { gClient.startNote(id, vol);}, ouchD * i)
1623 }
1624 }
1625
1626 } else {
1627 gPiano.play(id, vol !== undefined ? vol : DEFAULT_VELOCITY, gClient.getOwnParticipant(), 0);
1628 if (!politePlay) {
1629 gClient.startNote(id, vol);
1630 }
1631 }
1632 }
1633
1634 // press
1635 function press(id, vol) {
1636 //thanks electrashave!
1637 var pKey = gPiano.keys[id];
1638 for (as in MPP.piano.keys) {
1639 var key = MPP.piano.keys[as];
1640 if (key.num == (pKey.num + transLvl)) {
1641 id = key.note
1642 }
1643 }
1644
1645 if (mouseNote) {
1646 // thanks Chacha!
1647 try {
1648 var rect = gPiano.keys[id].rect;
1649 var t = 900; // 900
1650 var x = (rect.x + rect.x2) / 2; // Position within piano
1651 x /= gPiano.renderer.width; // Position within renderer
1652 x *= 95; // 100% minus left offset (3%) minus right offset (2%)
1653 x += 3; // Left offset of 3%, gives position within window
1654 var y = rect.h; // === rect.y2 - rect.y
1655 y -= gPiano.renderer.height * 0.75; // Center around midpoint between black and white keys.
1656 y /= 10; // Scale to fit the keys. (This is arbitrary since the height of the keys will vary between users anyway.)
1657 y += 50; // Center on middle of screen
1658 x += (Math.random()+Math.random()-1)*0.5; // Alters x slightly each press
1659 y += (Math.random()+Math.random()+Math.random()+Math.random()-2)*2.5; // Alters y slightly each press
1660 setTimeout(()=>gClient.sendArray([{ m: "m", x: x, y: y }]), t); // Wait for t before
1661 } catch (e) {console.log("mouseNote err: " + e)} // If there's an error log it
1662 }
1663
1664 var me = gClient.getOwnParticipant();
1665
1666 if (randNoteColour && !ignoreNotes && !politePlay) {
1667 me = gClient.getOwnParticipant();
1668 me.color = Col();
1669
1670 } else if (ignoreNotes && politePlay) {
1671 randNoteColour = true;
1672 me = gClient.getOwnParticipant();
1673 me.color = "purple";
1674
1675 } else if (ignoreNotes) {
1676 randNoteColour = true;
1677 me = gClient.getOwnParticipant();
1678 me.color = "red";
1679
1680 } else if (politePlay) {
1681 randNoteColour = true;
1682 me = gClient.getOwnParticipant();
1683 me.color = "blue";
1684 }
1685
1686
1687 if (delPlay) {
1688 setTimeout(function() {
1689 gPiano.play(id, vol !== undefined ? vol : DEFAULT_VELOCITY, gClient.getOwnParticipant(), 0);
1690 gClient.startNote(id, vol);
1691 }, delTime);
1692 }
1693
1694 var note = id.replace(/[0-9]/g, '').replace("-", "");
1695 var octave = parseInt(id.replace(/[^\d.]/, '').replace('s', ''));
1696 if (octTemp >= 3) {
1697 if (octTemp > 4) {
1698 octave = octave - 2;
1699 } else {
1700 octave = octave - 1;
1701 }
1702 }
1703 for (i = 0; i < octTemp; i++) {
1704 if (rollTemp) {
1705 roll(note + (octave + i), vol, i);
1706 } else {
1707 pressing(note + (octave + i), vol);
1708 }
1709 }
1710 gHeldNotes[id] = true;
1711 gSustainedNotes[id] = true;
1712
1713 }
1714 // release roll
1715 function releaseRoll(id, i) {
1716 setTimeout(function() {
1717 gPiano.stop(id, gClient.getOwnParticipant(), 0);
1718 gClient.stopNote(id);
1719 gSustainedNotes[id] = false;
1720 }, delays + (delays * i));
1721 }
1722
1723 // releasing
1724 function releasing(id) {
1725 gPiano.stop(id, gClient.getOwnParticipant(), 0);
1726 gClient.stopNote(id);
1727 gSustainedNotes[id] = false;
1728 }
1729
1730 // release
1731 function release(id) {
1732 if (gHeldNotes[id]) {
1733 gHeldNotes[id] = false;
1734 if (gAutoSustain || gSustain) {
1735 gSustainedNotes[id] = true;
1736 } else {
1737 if (gNoteQuota.spend(1)) {
1738 var octave = parseInt(id.replace(/[^\d.]/, '').replace('s', ''));
1739 var note = id.replace(/[0-9]/g, '').replace("-", "");
1740 if (octTemp >= 3) {
1741 if (octTemp > 4) {
1742 octave = octave - 2;
1743 } else {
1744 octave = octave - 1;
1745 }
1746 }
1747 for (i = 0; i < octTemp; i++) {
1748 if (rollTemp) {
1749 releaseRoll(note + (octave + i), i);
1750 } else {
1751 releasing(note + (octave + i));
1752 }
1753 }
1754 }
1755 }
1756 }
1757 }
1758
1759 function pressSustain() {
1760 gSustain = true;
1761 }
1762
1763 function releaseSustain() {
1764 gSustain = false;
1765 if (!gAutoSustain) {
1766 for (var id in gSustainedNotes) {
1767 if (gSustainedNotes.hasOwnProperty(id) && gSustainedNotes[id] && !gHeldNotes[id]) {
1768 if (gNoteQuota.spend(0)) {
1769 gPiano.stop(id, gClient.getOwnParticipant(), 0);
1770 gClient.stopNote(id);
1771 }
1772 }
1773 }
1774 }
1775 }
1776
1777
1778
1779
1780 // internet science
1781
1782 ////////////////////////////////////////////////////////////////
1783
1784 var channel_id = decodeURIComponent(window.location.pathname);
1785 if(channel_id.substr(0, 1) == "/") channel_id = channel_id.substr(1);
1786 if(channel_id == "") channel_id = "lolwutsecretlobbybackdoor"; //lobby
1787
1788 //FIX FOR HANDSHAKE ERROR
1789 var gClient = new Client("ws://" + window.location.hostname + ":443"); //FIX FOR HANDSHAKE ERROR
1790 //FIX FOR HANDSHAKE ERROR
1791
1792 //worker
1793 worker.onmessage = function(event) { if(event.data.args) if(event.data.args.action==0) { gClient.sendArray([{m:"m", x:event.data.args.x, y:event.data.args.y}]); } }
1794 gClient.setChannel(channel_id);
1795 gClient.start();
1796
1797 // Setting status
1798 (function () {
1799 gClient.on("count", function (status) {
1800 $("#status").text(status);
1801 });
1802 gClient.on("count", function (count) {
1803 if (count > 0) {
1804 $("#status").html('<span class="number">' + count + '</span> ' + (count == 1 ? 'player' : 'players'));
1805 document.title = "Relyks' Bot [v" + botVersion + "] (" + count + ")";
1806 } else {
1807 document.title = "Relyks' Bot [v" + botVersion + "]";
1808 }
1809 });
1810 })();
1811
1812 // Handle changes to participants
1813 (function () {
1814 gClient.on("participant added", function (part) {
1815
1816 part.displayX = 0.75; //150
1817 part.displayY = 25; //50
1818
1819 // add nameDiv
1820 var div = document.createElement("div");
1821 div.className = "name";
1822 div.participantId = part.id;
1823 div.textContent = part.name || selfName; // ""
1824 div.style.backgroundColor = part.color || "#000000";
1825 if (gClient.participantId === part.id) {
1826 $(div).addClass("me");
1827 }
1828 if (gClient.channel && gClient.channel.crown && gClient.channel.crown.participantId === part.id) {
1829 $(div).addClass("owner");
1830 }
1831 if (gPianoMutes.indexOf(part._id) !== -1) {
1832 $(part.nameDiv).addClass("muted-notes");
1833 }
1834 if (gChatMutes.indexOf(part._id) !== -1) {
1835 $(part.nameDiv).addClass("muted-chat");
1836 }
1837 div.style.display = "none";
1838 part.nameDiv = $("#names")[0].appendChild(div);
1839 $(part.nameDiv).fadeIn(500); //2000
1840
1841 // sort names
1842 var arr = $("#names .name");
1843 arr.sort(function (a, b) {
1844 a = a.style.backgroundColor; // todo: sort based on user id instead
1845 b = b.style.backgroundColor;
1846 if (a > b) return 1;
1847 else if (a < b) return -1;
1848 else return 0;
1849 });
1850 $("#names").html(arr);
1851
1852 // add cursorDiv //gSeeOwnCursor
1853 if (gClient.participantId !== part.id || showOwnMouse) {
1854 var div = document.createElement("div");
1855 div.className = "cursor";
1856 div.style.display = "none";
1857 part.cursorDiv = $("#cursors")[0].appendChild(div);
1858 $(part.cursorDiv).fadeIn(500); //2000
1859
1860 //sets mouse position on join (thanks Josh)
1861 part.cursorDiv.style.left = 46.73 + "%";
1862 part.cursorDiv.style.top = 19.60 + "%";
1863
1864 var div = document.createElement("div");
1865 div.className = "name";
1866 div.style.backgroundColor = part.color || "#000000"
1867 div.textContent = part.name || selfName; // ""
1868 part.cursorDiv.appendChild(div);
1869
1870 } else {
1871 part.cursorDiv = undefined;
1872 }
1873 });
1874 gClient.on("participant removed", function (part) { //when the participant leaves
1875 // remove nameDiv
1876 var nd = $(part.nameDiv);
1877 var cd = $(part.cursorDiv);
1878 cd.fadeOut(500); //2000
1879 nd.fadeOut(450, function () { //2000
1880 nd.remove();
1881 cd.remove();
1882 part.nameDiv = undefined;
1883 part.cursorDiv = undefined;
1884 });
1885 });
1886 gClient.on("participant update", function (part) {
1887 var name = part.name || "";
1888 var color = part.color || "#777";
1889 part.nameDiv.style.backgroundColor = color;
1890 part.nameDiv.textContent = name;
1891 $(part.cursorDiv)
1892 .find(".name")
1893 .text(name)
1894 .css("background-color", color);
1895 });
1896 gClient.on("ch", function (msg) {
1897 for (var id in gClient.ppl) {
1898 if (gClient.ppl.hasOwnProperty(id)) {
1899 var part = gClient.ppl[id];
1900 if (part.id === gClient.participantId) {
1901 $(part.nameDiv).addClass("me");
1902 } else {
1903 $(part.nameDiv).removeClass("me");
1904 }
1905 if (msg.ch.crown && msg.ch.crown.participantId === part.id) {
1906 $(part.nameDiv).addClass("owner");
1907 $(part.cursorDiv).addClass("owner");
1908 } else {
1909 $(part.nameDiv).removeClass("owner");
1910 $(part.cursorDiv).removeClass("owner");
1911 }
1912 if (gPianoMutes.indexOf(part._id) !== -1) {
1913 $(part.nameDiv).addClass("muted-notes");
1914 } else {
1915 $(part.nameDiv).removeClass("muted-notes");
1916 }
1917 if (gChatMutes.indexOf(part._id) !== -1) {
1918 $(part.nameDiv).addClass("muted-chat");
1919 } else {
1920 $(part.nameDiv).removeClass("muted-chat");
1921 }
1922 }
1923 }
1924 });
1925 })();
1926
1927
1928 // Handle changes to crown
1929 (function () {
1930 var jqcrown = $('<div id="crown"></div>').appendTo(document.body).hide();
1931 var jqcountdown = $('<span></span>').appendTo(jqcrown);
1932 var countdown_interval;
1933 jqcrown.click(function () {
1934 gClient.sendArray([{
1935 m: "chown",
1936 id: gClient.participantId
1937 }]);
1938 });
1939 gClient.on("ch", function (msg) {
1940 if (msg.ch.crown) {
1941 var crown = msg.ch.crown;
1942 if (!crown.participantId || !gClient.ppl[crown.participantId]) {
1943 var land_time = crown.time + 2000 - gClient.serverTimeOffset;
1944 var avail_time = crown.time + 15000 - gClient.serverTimeOffset;
1945 jqcountdown.text("");
1946 jqcrown.show();
1947 if (land_time - Date.now() <= 0) {
1948 jqcrown.css({
1949 "left": crown.endPos.x + "%",
1950 "top": crown.endPos.y + "%"
1951 });
1952 } else {
1953 jqcrown.css({
1954 "left": crown.startPos.x + "%",
1955 "top": crown.startPos.y + "%"
1956 });
1957 jqcrown.addClass("spin");
1958 jqcrown.animate({
1959 "left": crown.endPos.x + "%",
1960 "top": crown.endPos.y + "%"
1961 }, 2000, "linear", function () {
1962 jqcrown.removeClass("spin");
1963 });
1964 }
1965 clearInterval(countdown_interval);
1966 countdown_interval = setInterval(function () {
1967 var time = Date.now();
1968 if (time >= land_time) {
1969 var ms = avail_time - time;
1970 if (ms > 0) {
1971 jqcountdown.text(Math.ceil(ms / 1000) + "s");
1972 } else {
1973 jqcountdown.text("");
1974 clearInterval(countdown_interval);
1975 }
1976 }
1977 }, 1000);
1978 } else {
1979 jqcrown.hide();
1980 }
1981 } else {
1982 jqcrown.hide();
1983 }
1984 });
1985 gClient.on("disconnect", function () {
1986 jqcrown.fadeOut(2000);
1987 });
1988 })();
1989
1990
1991// Josh's playThing
1992 function playThing(notes, veloc, delay, times) {
1993 setTimeout(function() {
1994 gClient.sendArray([{
1995 m: "n",
1996 t: times,
1997 n: [{
1998 n: notes,
1999 v: veloc
2000 }]
2001 }]);
2002 }, delay);
2003 //console.log(notes);
2004 }
2005
2006
2007// Playing notes
2008 gClient.on("n", function(msg) {
2009 var t = msg.t - gClient.serverTimeOffset + TIMING_TARGET - Date.now();
2010 var participant = gClient.findParticipantById(msg.p);
2011 if (gPianoMutes.indexOf(participant._id) !== -1)
2012 return;
2013 for (var i = 0; i < msg.n.length; i++) {
2014 var note = msg.n[i];
2015 var octave = parseInt(note.n.replace( /[^\d.]/, '').replace('s', ''));
2016 if (octave > 7) {
2017 return;
2018 }
2019 var ms = t + (note.d || 0);
2020 if (ms < 0) {
2021 ms = 0;
2022 } else if (ms > 10000) continue;
2023 if (ignoreNotes) {
2024 if (participant.id == gClient.participantId) {
2025 if (note.s) {
2026 gPiano.stop(note.n, participant, ms);
2027 } else {
2028 var vel = (typeof note.v !== "undefined") ? parseFloat(note.v) : DEFAULT_VELOCITY;
2029 if (vel < 0) vel = 0;
2030 else if (vel > 1) vel = 1;
2031 gPiano.play(note.n, vel, participant, ms);
2032 }
2033 }
2034 } else {
2035 if (note.s) {
2036 gPiano.stop(note.n, participant, ms);
2037 } else {
2038 var vel = (typeof note.v !== "undefined") ? parseFloat(note.v) : DEFAULT_VELOCITY;
2039 if (vel < 0) vel = 0;
2040 else if (vel > 1) vel = 1;
2041 gPiano.play(note.n, vel, participant, ms);
2042 if (copyNotes){
2043 playThing(note.n,vel,note.d||0, t);
2044 }
2045 }
2046 }
2047 }
2048 });
2049
2050 // Send cursor updates
2051 // mouse optimizations by Alex
2052 var mx = 0, last_mx = -2.5, my = 0, last_my = -2.5;
2053 setInterval(function() {
2054 if (Math.abs(mx - last_mx) > 0.1 || Math.abs(my - last_my) > 0.1) {
2055 last_mx = mx;
2056 last_my = my;
2057 if (!incognito){
2058 gClient.sendArray([{m: "m", x: mx, y: my}]);
2059 }
2060 }
2061 }, 50);
2062
2063 $(document).mousemove(function(event) {
2064 mx = ((event.pageX / $(window).width()) * 100).toFixed(2);
2065 my = ((event.pageY / $(window).height()) * 100).toFixed(2);
2066 });
2067
2068 // Animate cursors
2069 setInterval(function() {
2070 for (var id in gClient.ppl) {
2071 if (!gClient.ppl.hasOwnProperty(id)) continue;
2072 var part = gClient.ppl[id];
2073 if (part.cursorDiv && (Math.abs(part.x - part.displayX) > 0.1 || Math.abs(part.y - part.displayY) > 0.1)) {
2074 part.displayX += (part.x - part.displayX) * 0.25;
2075 part.displayY += (part.y - part.displayY) * 0.25;
2076 part.cursorDiv.style.left = part.displayX + "%";
2077 part.cursorDiv.style.top = part.displayY + "%";
2078 if (autoFollow && part._id != selfId) {
2079 followId = part._id;
2080 }
2081 }
2082 }
2083 }, 1);
2084
2085 // Room settings button
2086 (function () {
2087 gClient.on("ch", function (msg) {
2088 if (gClient.isOwner()) {
2089 $("#room-settings-btn").show();
2090 $("#room-settings-btn").animate({opacity:0.7},100); //animates it thanks B@K$
2091 } else {
2092 $("#room-settings-btn").css("display","block"); //shows it
2093 $("#room-settings-btn").animate({opacity:0.3},100);
2094 }
2095 });
2096 $("#room-settings-btn").click(function (evt) { //room settings button
2097 if (gClient.channel && gClient.isOwner()) {
2098 var settings = gClient.channel.settings;
2099 openModal("#room-settings");
2100 setTimeout(function () {
2101 $("#room-settings .checkbox[name=visible]").prop("checked", settings.visible);
2102 $("#room-settings .checkbox[name=chat]").prop("checked", settings.chat);
2103 $("#room-settings .checkbox[name=crownsolo]").prop("checked", settings.crownsolo);
2104 }, 100);
2105 }
2106 });
2107 $("#room-settings .submit").click(function () {
2108 var settings = {
2109 visible: $("#room-settings .checkbox[name=visible]").is(":checked"),
2110 chat: $("#room-settings .checkbox[name=chat]").is(":checked"),
2111 crownsolo: $("#room-settings .checkbox[name=crownsolo]").is(":checked")
2112 };
2113 gClient.sendArray([{
2114 m: "chset",
2115 set: settings
2116 }]);
2117 closeModal();
2118 });
2119 $("#room-settings .drop-crown").click(function () {
2120 gClient.sendArray([{
2121 m: "chown"
2122 }]);
2123 closeModal();
2124 });
2125 })();
2126
2127 // Handle notifications
2128 gClient.on("notification", function (msg) {
2129 new Notification(msg);
2130 });
2131
2132 //cursor float
2133 /*gClient.on("ch", function (msg) {
2134 var chidlo = msg.ch._id.toLowerCase();
2135 if (chidlo === "a" || chidlo.substr() === "a") {
2136 $(".cursor").addClass("floating");
2137 } else {
2138
2139 $(".cursor").addClass("floating");
2140
2141 }
2142 });*/
2143
2144 // Don't forget spin
2145 /*gClient.on("ch", function (msg) {
2146 var chidlo = msg.ch._id.toLowerCase();
2147 if (chidlo === "spin" || chidlo.substr(-5) === "/spin") {
2148 $("#piano").addClass("spin");
2149 } else {
2150 $("#piano").removeClass("spin");
2151 }
2152 });*/
2153
2154 // Crownsolo notice
2155 gClient.on("ch", function (msg) {
2156 if (msg.ch.settings.crownsolo) {
2157 if ($("#crownsolo-notice").length == 0) {
2158 $('<div id="crownsolo-notice">').text('Only owner can play mode').appendTo("body").fadeIn(500);
2159 }
2160 } else {
2161 $("#crownsolo-notice").remove();
2162 }
2163 });
2164 gClient.on("disconnect", function () {
2165 $("#crownsolo-notice").remove();
2166 $("#nochat-notice").remove();
2167 });
2168
2169
2170
2171 var gPianoMutes = ["3ed152147e36d229cf5b7cba", "9b8df25492874a938ce9fb74"];
2172
2173 var gChatMutes = [];
2174
2175 //animated name stuff
2176 if (animName) {
2177 setInterval(function() {
2178 if (heyThereKitty == MPP.client.getOwnParticipant().name) return;
2179 updateName(heyThereKitty); //name to print
2180 if (followId == heyThereKittyId) return;
2181 followId = heyThereKittyId;
2182 }, 2100);
2183 }
2184
2185 // thanks Kappa
2186 /*
2187 var i = 0;
2188 setInterval(function() {
2189 MPP.client.sendArray([{
2190 m: "userset"
2191 , set: {
2192 name: selfName.slice(i % selfName.length) + selfName.slice(0, i++ % selfName.length)
2193 }
2194 }]);
2195 }, 2100)
2196 */
2197
2198 var volume_slider = new VolumeSlider(document.getElementById("volume"), function (v) {
2199 gPiano.audio.setVolume(v);
2200 if (window.localStorage) localStorage.volume = v;
2201 });
2202 volume_slider.set(gPiano.audio.volume);
2203
2204 var Note = function (note, octave) {
2205 this.note = note;
2206 this.octave = octave || 0;
2207 };
2208
2209
2210
2211 var n = function (a, b) {
2212 return {
2213 note: new Note(a, b),
2214 held: false
2215 };
2216 };
2217 //Logan, these are the key bindings for on the piano
2218 var key_binding = {
2219 65: n("gs"),
2220 90: n("a"),
2221 83: n("as"),
2222 88: n("b"),
2223 67: n("c", 1),
2224 70: n("cs", 1),
2225 86: n("d", 1),
2226 71: n("ds", 1),
2227 66: n("e", 1),
2228 78: n("f", 1),
2229 74: n("fs", 1),
2230 77: n("g", 1),
2231 75: n("gs", 1),
2232 188: n("a", 1),
2233 76: n("as", 1),
2234 190: n("b", 1),
2235 191: n("c", 2),
2236 222: n("cs", 2),
2237
2238 49: n("gs", 1),
2239 81: n("a", 1),
2240 50: n("as", 1),
2241 87: n("b", 1),
2242 69: n("c", 2),
2243 52: n("cs", 2),
2244 82: n("d", 2),
2245 53: n("ds", 2),
2246 84: n("e", 2),
2247 89: n("f", 2),
2248 55: n("fs", 2),
2249 85: n("g", 2),
2250 56: n("gs", 2),
2251 73: n("a", 2),
2252 57: n("as", 2),
2253 79: n("b", 2),
2254 80: n("c", 3),
2255 189: n("cs", 3),
2256 219: n("d", 3),
2257 187: n("ds", 3),
2258 221: n("e", 3)
2259 };
2260
2261 var capsLockKey = false; //here are some settings, Logan
2262 var gSustain = false;
2263 var keys = [];
2264 var volTemp = 1;
2265
2266 function handleKeyDown(evt) {
2267 var key = evt.keyCode;
2268 keys[key] = true;
2269
2270 // volume changing
2271 if (keys[107]) {
2272 volume > 0.9 ? volume = 1 : volume += 0.1;
2273 msgBox('Note Volume', 'Volume: ' + parseFloat(volume.toFixed(2)), 1000, '#piano');
2274
2275 } else if (keys[109]) {
2276 volume < 0.1 ? volume = 0 : volume -= 0.1;
2277 msgBox('Note Volume', 'Volume: ' + parseFloat(volume.toFixed(2)), 1000, '#piano');
2278 }
2279 // multi-octave toggling
2280 if (keys[38]) {
2281 octTemp > 6 ? octTemp = 7 : ++octTemp;
2282 msgBox('Multi-octave', 'Level ' + octTemp, 1000, '#piano');
2283
2284 } else if (keys[40]) {
2285 octTemp < 2 ? octTemp = 1 : --octTemp;
2286 msgBox('Multi-octave', 'Level ' + octTemp, 1000, '#piano');
2287 }
2288
2289 // roll toggling
2290 if (keys[35] && rollTemp) {
2291 rollTemp = false;
2292 msgBox('Roll', 'Disabled', 1000, '#piano');
2293
2294 } else if (keys[35] && !rollTemp) {
2295 rollTemp = true;
2296 msgBox('Roll', 'Enabled', 1000, '#piano');
2297 }
2298
2299 // sustain toggling
2300 //Backspace key
2301 if (keys[8] && !susTemp) {
2302 msgBox('Sustain', 'Enabled', 1000, '#piano');
2303 susTemp = true;
2304
2305 } else if (keys[8] && susTemp) {
2306 msgBox('Sustain', 'Disabled', 1000, '#piano');
2307 susTemp = false;
2308 }
2309 if (!susTemp) {
2310 gAutoSustain = false;
2311 } else if (susTemp) {
2312 gAutoSustain = true;
2313 }
2314
2315 var code = parseInt(evt.keyCode); //move up and make use of more Logan
2316
2317 //numpad5
2318 if (code == 101 || code == 12) { //delay
2319 delPlay = !delPlay; //swaps it
2320 if (!delPlay) {
2321 msgBox('Delay', 'Disabled', 1000, '#piano');
2322 } else {
2323 msgBox('Delay', 'Enabled', 1000, '#piano');
2324 }
2325 //Pagedown
2326 } else if (code == 34) { //ignore
2327 ignoreNotes = !ignoreNotes;
2328 if (!ignoreNotes) {
2329 msgBox('Ignore Notes', 'Disabled', 1000, '#piano');
2330 } else {
2331 msgBox('Ignore Notes', 'Enabled', 1000, '#piano');
2332 }
2333 //Pageup
2334 } else if (code == 33) { //bot on/off [clean this logan]
2335 if (bot == 2) {
2336 bot = 0;
2337 msgBox('Commands', 'Disabled', 1000, '#piano');
2338 } else if (bot == 0) {
2339 bot = 1;
2340 msgBox('Commands', 'For everyone', 1000, '#piano');
2341 } else if (bot == 1) {
2342 bot = 2;
2343 msgBox('Commands', 'Only for you', 1000, '#piano');
2344 }
2345
2346 //numpad *
2347 } else if (code == 106) { //bot on/off //♥ REMOVE AND JUST MAKE NUMPAD - GO TO 0 ♥//
2348 if (timeStamp) {
2349 timeStamp = false;
2350 msgBox('Timestamps', 'Off', 1000, '#piano');
2351 } else {
2352 timeStamp = true;
2353 msgBox('Timestamps', 'On', 1000, '#piano');
2354 }
2355
2356 //numpad 0
2357 } else if (code == 96) { //reconnect
2358 MPP.client.stop();
2359 MPP.client.start();
2360 msgBox('Reconnecting...', '', 2000, '#piano');
2361
2362 //numpad 1
2363 } else if (code == 97) { //private room
2364 var room_name = randStr(28);
2365 changeRoom(room_name, "right", {
2366 "visible": false,
2367 "chat": true,
2368 "crownsolo": false,
2369 "lobby": false
2370 });
2371 //numpad 2
2372 } else if (code == 98) { //illuminati hotkey (until I find a better use)
2373 if (autoFollow) {
2374 autoFollow = false;
2375 following = false;
2376 followId = null;
2377 msgBox('Auto Follow', 'Off', 2000, '#blah-btn');
2378 } else {
2379 autoFollow = true;
2380 following = true;
2381 msgBox('Auto Follow', 'On', 2000, '#blah-btn');
2382 }
2383 //tab
2384 } else if (code == 9) { //hotkeymsg
2385 tab(); //ring ring..
2386
2387 //ctrl
2388 } else if (code == 17) { //drop crown
2389 gClient.sendArray([{
2390 m: "chown"
2391 }]);
2392 msgBox('Dropping crown', '', 1000, '#piano');
2393
2394 //H
2395 } else if (code == 72) { //display help
2396 new Notification({id: "volume", title: "Hotkeys (Redesigned by Relyks)", html: '\
2397 <h3>๖ۣۜHold to display binds and hotkeys...</h3>\
2398 <font color="#FF0000 ">Page Up:</font>Turns on/off chat commands <br />\
2399 <font color="#FF4300">Page Down</font> Ignores everyone elses notes<br />\
2400 <font color="#FF8C00 ">End</font> Toggles rolling on multi-octaves<br />\
2401 <font color="#FFC000">Up/Down Arrows</font> Increases and decreases amount of octaves played<br />\
2402 <font color="#FFF400">Left/Right Arrows</font> Changes Key<br />\
2403 <font color="#AAFF00">backspace</font> Toggles sustain <br />\
2404 <font color="#4AFF00">Alt\</font> Goes one octave higher then Shift <br />\
2405 <font color="#00FF60">Spacebar</font> Plays low notes while held<br />\
2406 <font color="#00FF60">Insert</font> Toggles owner only mode (need crown)<br />\
2407 <font color="#00FFF4">6</font> Toggles room visibility (need crown)<br />\
2408 <font color="#00B9FF">Fn + / or ; </font> Change note volume<br />\
2409 <font color="#006FFF">Fn P</font> Toggles timestamps in chat<br />\
2410 <font color="#0000FF">Fn + L</font> Lenny<br />\
2411 <font color="#9B00FF">Fn U</font> Toggles Bunny<br />\
2412 <font color="#ED00FF">Fn + I</font> Toggles delay<br />\
2413 <font color="#FF00B9">Fn + O</font> Toggles Pong<br />\
2414 <font color="#FF0060">Fn + 8</font> Toggles SomeGuy\'s incognito<br />\
2415 <font color="#FF0000">H</font> Displays displays Hotkeys again<br />\
2416 <font color="#FFFFFF">!lhelp</font> Displays local commands in chat<br />\
2417 To stop this message displaying every time you start the script search for <font color="#1A0BFF">i_know_how_to_use_this_bot</font> and change <font color="#FF0000">false</font> to <font color="#4AFF00">true</font>.<br />\
2418 ', target: "#blah-btn", duration: 600});
2419
2420//--TEST--TEST--TEST////--TEST--TEST--TEST////--TEST--TEST--TEST//
2421 //numpad .
2422 } else if (code == 110) { //hotkey test
2423 if (meow) {
2424 meow = false;
2425 msgBox('Cat Mode', 'Off', 1000, '#blah-btn');
2426 } else {
2427 meow = true;
2428 msgBox('Cat Mode', 'On', 1000, '#blah-btn');
2429 }
2430
2431
2432//--TEST--TEST--TEST////--TEST--TEST--TEST////--TEST--TEST--TEST//
2433
2434
2435 // ♥ Thanks Josh ♥ //
2436
2437
2438 //numpad 7
2439 } else if (code == 103) { //speech toggle
2440 if (speechStatus) {
2441 speechStatus = false;
2442 speechSynthesis.cancel();
2443 msgBox('Text to Speech', 'Off', 1000, '#blah-btn');
2444 } else {
2445 speechStatus = true;
2446 msgBox('Text to Speech', 'On', 1000, '#blah-btn');
2447 }
2448
2449 //home
2450 } else if (code == 36) { //politePlay
2451 if (politePlay) {
2452 politePlay = false;
2453 msgBox('Polite Play', 'Off', 1000, '#blah-btn');
2454 } else {
2455 politePlay = true;
2456 msgBox('Polite Play', 'On (others cannot hear your notes)', 1000, '#blah-btn');
2457 }
2458
2459 // Insert key
2460 } else if (code == 45) { //owner only
2461 if (crownSoloToggle) {
2462 crownSoloToggle = false;
2463 MPP.client.sendArray([{m: "chset", set: {crownsolo: false}}]);
2464 msgBox('Owner Only', 'Off', 1000, '#blah-btn');
2465 } else {
2466 crownSoloToggle = true;
2467 MPP.client.sendArray([{m: "chset", set: {crownsolo: true}}]);
2468 msgBox('Owner Only', 'On', 1000, '#blah-btn');
2469 }
2470 // Delete key
2471 } else if (code == 46) { //hide room
2472 if (roomVisibleToggle) {
2473 roomVisibleToggle = false;
2474 MPP.client.sendArray([{m: "chset", set: {visible: false}}]);
2475 msgBox('Room Visible', 'No', 1000, '#blah-btn');
2476 } else {
2477 roomVisibleToggle = true;
2478 MPP.client.sendArray([{m: "chset", set: {visible: true}}]);
2479 msgBox('Room Visible', 'Yes', 1000, '#blah-btn');
2480 }
2481
2482 // \ key
2483 } else if (code == 220) { //mouse updates
2484 if (incognito) {
2485 incognito = false;
2486 msgBox('Incognito', 'Off', 1000, '#blah-btn');
2487 } else {
2488 incognito = true;
2489 msgBox('Incognito', 'On', 1000, '#blah-btn');
2490 }
2491
2492 } else if (code == 105) { //copy notes
2493 if (copyNotes) {
2494 copyNotes = false;
2495 msgBox('Copy Notes', 'Off', 1000, '#blah-btn');
2496 } else {
2497 copyNotes = true;
2498 msgBox('Copy Notes', 'On', 1000, '#blah-btn');
2499 }
2500
2501 } else if (code == 100) { //cursor bunny
2502 testflipB = !testflipB;
2503 if (!testflipB) {
2504 msgBox('Bunny', 'Off', 1000, '#blah-btn');
2505 } else {
2506 setTimeout(function () {
2507 client = MPP.client;
2508 var bunny = new Bunny(client);
2509 worker.onmessage = function(event)
2510 {
2511 if(event.data.args)
2512 if(event.data.args.action==0){
2513 if(testflipB){ bunny.tick(); }
2514 }
2515 }
2516 worker.postMessage({delay:120,args:{action:0}});
2517 }, 120);
2518
2519
2520 var Bunny = function (client) {
2521 this.client = client;
2522
2523 this.vx = 1.5;
2524 this.vy = 2.2;
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 Bunny.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 > 0) { //0 makes the ceiling which it bounces off
2545 this.vy = -this.vy;
2546 }
2547 this.client.sendArray([{
2548 m: "m",
2549 x: this.part.x,
2550 y: this.part.y
2551 }]);
2552 this.client.sendArray([{
2553 m: "m",
2554 x: this.part.x,
2555 y: this.part.y
2556 }]);
2557 worker.postMessage({delay:120,args:{action:0}});
2558 };
2559 msgBox('Bunny', 'On', 1000, '#blah-btn');
2560 }
2561
2562 //msgBox('Pong', 'Off', 1000, '#blah-btn');
2563
2564 } else if (code == 102) { //cursor pong
2565 testflipP = !testflipP;
2566 if (!testflipP) {
2567 msgBox('Pong', 'Off', 1000, '#blah-btn');
2568
2569 } else {
2570 //on
2571 setTimeout(function() {
2572 client = MPP.client;
2573 var pong = new Pong(client);
2574 worker.onmessage = function(event) {
2575 if (event.data.args)
2576 if (event.data.args.action == 0) {
2577 if (testflipP) {
2578 pong.tick();
2579 }
2580 }
2581 }
2582 worker.postMessage({
2583 delay: 60
2584 , args: {
2585 action: 0
2586 }
2587 });
2588 }, 60);
2589
2590
2591 var Pong = function(client) {
2592 this.client = client;
2593
2594 this.vx = 0.1875; //0.75
2595 this.vy = 0.275; //1.1
2596
2597 var self = this;
2598 self.part = self.client.ppl[self.client.participantId];
2599 client.on("ch", function() {
2600 self.part = self.client.ppl[self.client.participantId];
2601 });
2602 }
2603
2604 Pong.prototype.tick = function() {
2605 if (!this.client.isConnected() || !this.part) return;
2606 this.part.x += this.vx;
2607 this.part.y += this.vy;
2608 if (this.part.x < 0) {
2609 this.vx = -this.vx;
2610 } else if (this.part.x > 100) {
2611 this.vx = -this.vx;
2612 }
2613 if (this.part.y < 0) {
2614 this.vy = -this.vy;
2615 } else if (this.part.y > 100) {
2616 this.vy = -this.vy;
2617 }
2618
2619 //x is <--> 100 is --> 0 is <--
2620 //y is ^v 0 is ^ 100 is v
2621
2622 this.vx += Math.random() * 0.1 - 0.05;
2623 this.vy += Math.random() * 0.1 - 0.05;
2624 this.client.sendArray([{ //were two of these
2625 m: "m"
2626 , x: this.part.x
2627 , y: this.part.y
2628 }]);
2629 if (this.part.x < -10 || this.part.y < -10 || this.part.x > 110 || this.part.y > 110) {
2630 this.part.x = 50;
2631 this.part.y = 50;
2632 //resets the velocity when setting position
2633 this.vx = -this.vx;
2634 this.vy = -this.vy;
2635 }
2636 worker.postMessage({
2637 delay: 60
2638 , args: {
2639 action: 0
2640 }
2641 });
2642 };
2643 msgBox('Pong', 'On', 1000, '#blah-btn');
2644 }
2645
2646 } else if (code == 99) { //lenny
2647 var msgTmp = $("input").val(); //retain old text
2648 $("body #chat input").val(msgTmp + " Hello everyone! Type in (!help) to get my commands! Remember to stay cool ( ͡◕ ͜ʖ ͡◕)");
2649
2650 //numpad /
2651 } else if (code == 111) { //hotkey spam
2652 for(var key in MPP.piano.keys) MPP.press(key, volume);
2653
2654 //thanks electrashave!
2655 } else if (code == 39) {
2656 transLvl++;
2657 msgBox('Transposing (by electrashave)', 'Transpose level: ' + transLvl, 1000, '#blah-btn');
2658
2659 //thanks electrashave!
2660 } else if (code == 37) {
2661 transLvl--;
2662 msgBox('Transposing (by electrashave)', 'Transpose level: ' + transLvl, 1000, '#blah-btn');
2663 }
2664
2665 if (key_binding[code] !== undefined) {
2666 var binding = key_binding[code];
2667 if (!binding.held) {
2668 binding.held = true;
2669 if (gNoteQuota.spend(0)) {
2670 var note = binding.note;
2671 var octave = 1 + note.octave;
2672 // extra octaves
2673 if (keys[16])++octave;
2674 else if (keys[32])--octave == --octave + -octave;
2675 else if (keys[18])++octave == ++octave + +octave;
2676 else if (keys[192])++octave == ++octave + ++octave;
2677 else if (capsLockKey)--octave;
2678 var note = note.note;
2679 var vol = volume;
2680
2681 if (volume > 5) {
2682 volume = 5;
2683 }
2684 press(note + octave, vol);
2685 }
2686 }
2687
2688 if (++gKeyboardSeq == 3) {
2689 gKnowsYouCanUseKeyboard = true;
2690 if (window.gKnowsYouCanUseKeyboardTimeout) clearTimeout(gKnowsYouCanUseKeyboardTimeout);
2691 if (localStorage) localStorage.knowsYouCanUseKeyboard = true;
2692 if (window.gKnowsYouCanUseKeyboardNotification) gKnowsYouCanUseKeyboardNotification.close();
2693 }
2694
2695 evt.preventDefault();
2696 evt.stopPropagation();
2697 return false;
2698 } else if (code == 20) { // Caps Lock
2699 capsLockKey = true;
2700 evt.preventDefault();
2701 } else if (code === 0x20) { // Space Bar
2702 evt.preventDefault();
2703 } else if (code == 9) { // Tab (don't tab away from the piano)
2704 evt.preventDefault();
2705 } else if (code == 8) { // Backspace (don't navigate Back)
2706 evt.preventDefault();
2707 }
2708 };
2709
2710 //FIX BELOW MESS
2711
2712 var keys = [];
2713
2714 function handleKeyUp(evt) {
2715 var key = evt.keyCode;
2716 keys[key] = false;
2717 var code = parseInt(evt.keyCode);
2718 if (key_binding[code] !== undefined) {
2719 var binding = key_binding[code];
2720 if (binding.held) {
2721 keys[key] = false;
2722 binding.held = false;
2723
2724 if (!gAutoSustain && !gSustain) {
2725 if (gNoteQuota.spend(octTemp)) {
2726 var note = binding.note;
2727 var octave = 1 + note.octave;
2728 // extra octaves
2729 if (keys[16])++octave;
2730 else if (keys[32])--octave == --octave + -octave;
2731 else if (keys[18])++octave == ++octave + +octave;
2732 else if (keys[192])++octave == ++octave + ++octave;
2733 else if (capsLockKey)--octave;
2734 var note = note.note;
2735 release(note + octave); //was missing octave which didn't stop the note - Logan
2736 }
2737 }
2738 }
2739
2740 evt.preventDefault();
2741 evt.stopPropagation();
2742 return false;
2743 } else if (code == 20) { // Caps Lock
2744 capsLockKey = false;
2745 evt.preventDefault();
2746 } else if (code === 0x20) { // Space Bar
2747 evt.preventDefault();
2748 } else if (code == 8) { // Backspace (don't navigate Back)
2749 evt.preventDefault();
2750 }
2751 };
2752
2753 function handleKeyPress(evt) {
2754 evt.preventDefault();
2755 evt.stopPropagation();
2756 if (evt.keyCode == 27 || evt.keyCode == 13) {
2757 //add some stuff here Logan
2758 }
2759 return false;
2760 };
2761
2762 var recapListener = function (evt) {
2763 captureKeyboard();
2764 };
2765
2766 function captureKeyboard() {
2767 $("#piano").off("mousedown", recapListener);
2768 $("#piano").off("touchstart", recapListener);
2769 $(document).on("keydown", handleKeyDown);
2770 $(document).on("keyup", handleKeyUp);
2771 $(window).on("keypress", handleKeyPress);
2772 };
2773
2774 function releaseKeyboard() {
2775 $(document).off("keydown", handleKeyDown);
2776 $(document).off("keyup", handleKeyUp);
2777 $(window).off("keypress", handleKeyPress);
2778 $("#piano").on("mousedown", recapListener);
2779 $("#piano").on("touchstart", recapListener);
2780 };
2781
2782 captureKeyboard();
2783
2784
2785 var velocityFromMouseY = function () {
2786 return 0.1 + (my / 100) * 0.6;
2787 };
2788
2789
2790
2791
2792 // NoteQuota
2793 var gNoteQuota = (function () {
2794 var last_rat = 0;
2795 var nqjq = $("#quota .value");
2796 setInterval(function () {
2797 gNoteQuota.tick();
2798 }, 2000);
2799 return new NoteQuota(function (points) {
2800 // update UI
2801 var rat = (points / this.max) * 100; // 100
2802 if (rat <= last_rat)
2803 nqjq.stop(true, true).css("width", rat.toFixed(0) + "%");
2804 else
2805 nqjq.stop(true, true).animate({
2806 "width": rat.toFixed(0) + "%"
2807 }, 2000, "linear");
2808 last_rat = rat;
2809 });
2810 })();
2811 gClient.on("nq", function (nq_params) {
2812 gNoteQuota.setParams(nq_params);
2813 });
2814 gClient.on("disconnect", function () {
2815 gNoteQuota.setParams(NoteQuota.PARAMS_OFFLINE);
2816 });
2817
2818
2819
2820 // click participant names
2821 (function () {
2822 var ele = document.getElementById("names");
2823 var touchhandler = function (e) {
2824 var target_jq = $(e.target);
2825 if (target_jq.hasClass("name")) {
2826 target_jq.addClass("play");
2827 if (e.target.participantId == gClient.participantId) {
2828 var id = e.target.participantId;
2829 var part = gClient.ppl[id] || null;
2830 if (part) {
2831 participantMenu(part);
2832 e.stopPropagation();
2833 }
2834 } else if (e.target.participantId) {
2835 var id = e.target.participantId;
2836 var part = gClient.ppl[id] || null;
2837 if (part) {
2838 participantMenu(part);
2839 e.stopPropagation();
2840 }
2841 }
2842 }
2843 };
2844 ele.addEventListener("mousedown", touchhandler);
2845 ele.addEventListener("touchstart", touchhandler);
2846 var releasehandler = function (e) {
2847 $("#names .name").removeClass("play");
2848 };
2849 document.body.addEventListener("mouseup", releasehandler);
2850 document.body.addEventListener("touchend", releasehandler);
2851
2852 var removeParticipantMenus = function () {
2853 $(".participant-menu").fadeOut(500);
2854 $(".participantSpotlight").hide(); //what is this?
2855 document.removeEventListener("mousedown", removeParticipantMenus);
2856 document.removeEventListener("touchstart", removeParticipantMenus);
2857 };
2858
2859 var participantMenu = function (part) {
2860 if (!part) return;
2861 removeParticipantMenus();
2862 document.addEventListener("mousedown", removeParticipantMenus);
2863 document.addEventListener("touchstart", removeParticipantMenus);
2864 $("#" + part.id).find(".enemySpotlight").show(); //what is this D:
2865 var menu = $('<div class="participant-menu"></div>');
2866 $("body").append(menu);
2867 // move menu to name position
2868 var jq_nd = $(part.nameDiv);
2869 var pos = jq_nd.position();
2870 menu.css({
2871 "top": pos.top + jq_nd.height() + 15,
2872 "left": pos.left + 6,
2873 "background": part.color || "black"
2874 });
2875 menu.on("mousedown touchstart", function (evt) {
2876 evt.stopPropagation();
2877 var target = $(evt.target);
2878 if (target.hasClass("menu-item")) {
2879 target.addClass("clicked"); //why is this needed?
2880 menu.fadeOut(500, function () {
2881 removeParticipantMenus();
2882 });
2883 }
2884 });
2885 // this spaces stuff out but also can be used for informational purposes
2886 $('<div class="info"></div>').appendTo(menu).text(part._id)
2887 .on("mousedown touchstart", function (evt) {
2888 //prompt("Press CTRL C to copy "+ part.name +"'s ID", part._id);
2889 prompt(part.name.endsWith("s") ? "Press CTRL C to copy "+ part.name +"' ID" : "Press CTRL C to copy "+ part.name +"'s ID", part._id);
2890 });
2891
2892 // added menu items
2893
2894 // rename
2895 if (part._id == gClient.getOwnParticipant()._id) {
2896 $('<div class="menu-item">• Rename</div>').appendTo(menu)
2897 .on("mousedown touchstart", function (evt) {
2898 openModal("#rename", "input[name=name]");
2899 setTimeout(function () {
2900 $("#rename input[name=name]").val(gClient.ppl[gClient.participantId].name);
2901 $("#rename input[name=color]").val(gClient.ppl[gClient.participantId].color);
2902 }, 100);
2903 });
2904 }
2905
2906
2907 // master and unmaster
2908 if (masters.indexOf(part._id) == -1) {
2909 $('<div class="menu-item">• Master</div>').appendTo(menu)
2910 .on("mousedown touchstart", function (evt) {
2911 masters.push(part._id);
2912 gClient.sendArray([{ m: "a", message: "Mastered " + part.name + "."}])
2913 });
2914 } else {
2915 $('<div class="menu-item">• Unmaster</div>').appendTo(menu)
2916 .on("mousedown touchstart", function (evt) {
2917 delete masters[masters.indexOf(part._id)];
2918 gClient.sendArray([{ m: "a", message: "Unmastered " + part.name + "."}])
2919 });
2920 }
2921
2922
2923 // op and deop
2924 if (ops.indexOf(part._id) == -1) {
2925 $('<div class="menu-item">• Op</div>').appendTo(menu)
2926 .on("mousedown touchstart", function (evt) {
2927 ops.push(part._id);
2928 gClient.sendArray([{ m: "a", message: "Opped " + part.name + "."}])
2929 });
2930 } else {
2931 $('<div class="menu-item">• Deop</div>').appendTo(menu)
2932 .on("mousedown touchstart", function (evt) {
2933 delete ops[ops.indexOf(part._id)];
2934 gClient.sendArray([{ m: "a", message: "deopped " + part.name + "."}])
2935 });
2936 }
2937
2938 if (part._id != gClient.getOwnParticipant()._id) {
2939
2940 // follow and rest
2941 if (!followId) {
2942 $('<div class="menu-item">• Follow >.<</div>').appendTo(menu)
2943 .on("mousedown touchstart", function (evt) {
2944 following = true;
2945 followId = part._id;
2946
2947 msgBox('Following', part.name, 2000, '#piano');
2948 });
2949 } else {
2950 $('<div class="menu-item">• Rest <.></div>').appendTo(menu)
2951 .on("mousedown touchstart", function (evt) {
2952 following = false;
2953 followId = null;
2954 msgBox('Stopping', 'Ok...', 2000, '#piano');
2955 });
2956 }
2957
2958 if (gPianoMutes.indexOf(part._id) == -1) {
2959 $('<div class="menu-item">• Mute Notes</div>').appendTo(menu)
2960 .on("mousedown touchstart", function (evt) {
2961 gPianoMutes.push(part._id);
2962 $(part.nameDiv).addClass("muted-notes");
2963 });
2964 } else {
2965 $('<div class="menu-item">• Unmute Notes</div>').appendTo(menu)
2966 .on("mousedown touchstart", function (evt) {
2967 var i;
2968 while ((i = gPianoMutes.indexOf(part._id)) != -1)
2969 gPianoMutes.splice(i, 1);
2970 $(part.nameDiv).removeClass("muted-notes");
2971 });
2972 }
2973 if (gChatMutes.indexOf(part._id) == -1) {
2974 $('<div class="menu-item">• Mute Chat</div>').appendTo(menu)
2975 .on("mousedown touchstart", function (evt) {
2976 gChatMutes.push(part._id);
2977 $(part.nameDiv).addClass("muted-chat");
2978 });
2979 } else {
2980 $('<div class="menu-item">• Unmute Chat</div>').appendTo(menu)
2981 .on("mousedown touchstart", function (evt) {
2982 var i;
2983 while ((i = gChatMutes.indexOf(part._id)) != -1)
2984 gChatMutes.splice(i, 1);
2985 $(part.nameDiv).removeClass("muted-chat");
2986 });
2987 }
2988 if (!(gPianoMutes.indexOf(part._id) >= 0) || !(gChatMutes.indexOf(part._id) >= 0)) {
2989 $('<div class="menu-item">• Mute Completely</div>').appendTo(menu)
2990 .on("mousedown touchstart", function (evt) {
2991 gPianoMutes.push(part._id);
2992 gChatMutes.push(part._id);
2993 $(part.nameDiv).addClass("muted-notes");
2994 $(part.nameDiv).addClass("muted-chat");
2995 });
2996 }
2997 if ((gPianoMutes.indexOf(part._id) >= 0) || (gChatMutes.indexOf(part._id) >= 0)) {
2998 $('<div class="menu-item">• Unmute Completely</div>').appendTo(menu)
2999 .on("mousedown touchstart", function (evt) {
3000 var i;
3001 while ((i = gPianoMutes.indexOf(part._id)) != -1)
3002 gPianoMutes.splice(i, 1);
3003 while ((i = gChatMutes.indexOf(part._id)) != -1)
3004 gChatMutes.splice(i, 1);
3005 $(part.nameDiv).removeClass("muted-notes");
3006 $(part.nameDiv).removeClass("muted-chat");
3007 });
3008 }
3009
3010 // ban and unban
3011 if (banned.indexOf(part._id) == -1) {
3012 $('<div class="menu-item">• Ban</div>').appendTo(menu)
3013 .on("mousedown touchstart", function (evt) {
3014 banned.push(part._id);
3015 msgBox('Banned', part.name, 1000, '#piano');
3016 });
3017 } else {
3018 $('<div class="menu-item">• Unban</div>').appendTo(menu)
3019 .on("mousedown touchstart", function (evt) {
3020 delete banned[banned.indexOf(part._id)];
3021 msgBox('Unbanned', part.name, 1000, '#piano');
3022 });
3023 }
3024
3025 if (gClient.isOwner()) {
3026 $('<div class="menu-item give-crown">? Give Crown</div>').appendTo(menu)
3027 .on("mousedown touchstart", function(evt) {
3028 if (confirm("Give room ownership to " + part.name + "?"))
3029 gClient.sendArray([{
3030 m: "chown",
3031 id: part.id
3032 }]);
3033
3034 });
3035 $('<div class="menu-item kickban">Kickban</div>').appendTo(menu)
3036 .on("mousedown touchstart", function(evt) {
3037 var minutes = prompt("How many minutes? (0-60)", "60");
3038 if (minutes === null) return;
3039 minutes = parseFloat(minutes) || 0;
3040 var ms = minutes * 60 * 1000;
3041 gClient.sendArray([{
3042 m: "kickban",
3043 _id: part._id,
3044 ms: ms
3045 }]);
3046 });
3047 }
3048 }
3049 menu.fadeIn(500);
3050 };
3051 })();
3052
3053
3054
3055
3056// Notification class
3057
3058////////////////////////////////////////////////////////////////
3059
3060 var Notification = function(par) {
3061 EventEmitter.call(this);
3062
3063 var par = par || {};
3064
3065 this.id = "Notification-" + (par.id || Math.random());
3066 this.title = par.title || "";
3067 this.text = par.text || "";
3068 this.html = par.html || "";
3069 this.target = $(par.target || "#piano");
3070 this.duration = par.duration || 30000;
3071 this["class"] = par["class"] || "classic";
3072
3073 var self = this;
3074 var eles = $("#" + this.id);
3075 if(eles.length > 0) {
3076 eles.remove();
3077 }
3078 this.domElement = $('<div class="notification"><div class="notification-body"><div class="title"></div>' +
3079 '<div class="text"></div></div><div class="x">x</div></div>');
3080 this.domElement[0].id = this.id;
3081 this.domElement.addClass(this["class"]);
3082 this.domElement.find(".title").text(this.title);
3083 if(this.text.length > 0) {
3084 this.domElement.find(".text").text(this.text);
3085 } else if(this.html instanceof HTMLElement) {
3086 this.domElement.find(".text")[0].appendChild(this.html);
3087 } else if(this.html.length > 0) {
3088 this.domElement.find(".text").html(this.html);
3089 }
3090 document.body.appendChild(this.domElement.get(0));
3091
3092 this.position();
3093 this.onresize = function() {
3094 self.position();
3095 };
3096 window.addEventListener("resize", this.onresize);
3097
3098 this.domElement.find(".x").click(function() {
3099 self.close();
3100 });
3101
3102 if(this.duration > 0) {
3103 setTimeout(function() {
3104 self.close();
3105 }, this.duration);
3106 }
3107
3108 return this;
3109 }
3110
3111 mixin(Notification.prototype, EventEmitter.prototype);
3112 Notification.prototype.constructor = Notification;
3113
3114 Notification.prototype.position = function() {
3115 var pos = this.target.offset();
3116 var x = pos.left - (this.domElement.width() / 2) + (this.target.width() / 4);
3117 var y = pos.top - this.domElement.height() - 8;
3118 var width = this.domElement.width();
3119 if(x + width > $("body").width()) {
3120 x -= ((x + width) - $("body").width());
3121 }
3122 if(x < 0) x = 0;
3123 this.domElement.offset({left: x, top: y});
3124 };
3125
3126 Notification.prototype.close = function() {
3127 var self = this;
3128 window.removeEventListener("resize", this.onresize);
3129 this.domElement.fadeOut(500, function() {
3130 self.domElement.remove();
3131 self.emit("close");
3132 });
3133 };
3134
3135
3136
3137
3138 // set variables from settings or set settings
3139
3140 ////////////////////////////////////////////////////////////////
3141
3142 if(!i_know_how_to_use_this_bot) {
3143
3144 new Notification({id: "volume", title: "Hotkeys (Redesigned by Relyks)", html: '\
3145 <h3>๖ۣۜHold to display binds and hotkeys...</h3>\
3146 <font color="#FF0000 ">Page Up:</font>Turns on/off chat commands (excluding !js and !room)<br />\
3147 <font color="#FF4300">Page Down</font> Ignores everyone elses notes<br />\
3148 <font color="#FF8C00">End</font> Toggles rolling on multi-octaves<br />\
3149 <font color="#FFC000">Up Arrow</font> Turns on / increases multi-octave<br />\
3150 <font color="#33FCFF">Down Arrow:</font> Turns on / increases multi-octave<br />\
3151 <font color="#FFF400">Backspace</font> Toggles sustain <br />\
3152 <font color="#FF00F4">Alt\</font> Goes one octave higher then Shift <br />\
3153 <font color="#FF007E">Spacebar</font> Plays low notes while held<br />\
3154 <font color="#FF0025">~</font> Plays high notes while held<br />\
3155 <font color="#FF0066">Tab</font> Sends hotkey message<br />\
3156 <font color="#FF0066">.</font> Toggles owner only mode (need crown)<br />\
3157 <font color="#FF0066">,</font> Toggles room visibility (need crown)<br />\
3158 <font color="#FF0066">Fn + / or ;</font> Change note volume<br />\
3159 <font color="#FF0066">Numpad *</font> Toggles timestamps in chat<br />\
3160 <font color="#FF0066">Fn + L</font> Lenny<br />\
3161 <font color="#FF0066">Fn + u</font> Toggles Bunny<br />\
3162 <font color="#FF0066">Fn + i</font> Toggles delay<br />\
3163 <font color="#FF0066">Fn + o</font> Toggles Pong<br />\
3164 <font color="#FF0066">\</font> Toggles SomeGuy\'s incognito<br />\
3165 <font color="#FF0066">H</font> Displays displays Hotkeys again<br />\
3166 <font color="#FF3399">!lhelp</font> Displays local commands in chat<br />\
3167 To stop these messages displaying every time you start the script search for <font color="#0BF4FF">i_know_how_to_use_this_bot</font> and change <font color="#CC0000">false</font> to <font color="#0066FF">true</font>.<br />\
3168 ', target: "#blah-btn", duration: 0});
3169
3170
3171 setTimeout(function() { //I think wrapping this in setTimeout hoists it so it wait for the buttons to be placed
3172 msgBox('Chat log is saved between rooms', 'To clear click Msgs button (i know it\'s on wrong button >.<)', 0, '#4-btn');
3173 }, 0);
3174
3175 }
3176
3177 var gKeyboardSeq = 0;
3178 var gKnowsYouCanUseKeyboard = false;
3179 if (localStorage && localStorage.knowsYouCanUseKeyboard) gKnowsYouCanUseKeyboard = true;
3180 if (!gKnowsYouCanUseKeyboard) {
3181 window.gKnowsYouCanUseKeyboardTimeout = setTimeout(function () {
3182 window.gKnowsYouCanUseKeyboardNotification = new Notification({
3183 title: "Did you know!?!",
3184 text: "You can play the piano with your keyboard, too. Try it!",
3185 target: "#piano",
3186 duration: 10000
3187 });
3188 }, 30000);
3189 }
3190
3191
3192
3193
3194 if (window.localStorage) {
3195
3196 if (localStorage.volume) {
3197 volume_slider.set(localStorage.volume);
3198 gPiano.audio.setVolume(localStorage.volume);
3199 } else localStorage.volume = gPiano.audio.volume;
3200
3201 window.gHasBeenHereBefore = (localStorage.gHasBeenHereBefore || false);
3202 if (gHasBeenHereBefore) {}
3203 localStorage.gHasBeenHereBefore = true;
3204
3205 }
3206
3207
3208
3209
3210 // New room, change room
3211
3212 ////////////////////////////////////////////////////////////////
3213
3214 $("#room > .info").text("--");
3215 gClient.on("ch", function (msg) {
3216 var channel = msg.ch;
3217 var info = $("#room > .info");
3218 info.text(channel._id);
3219 if (channel.settings.lobby) info.addClass("lobby");
3220 else info.removeClass("lobby");
3221 if (!channel.settings.chat) info.addClass("no-chat");
3222 else info.removeClass("no-chat");
3223 if (channel.settings.crownsolo) info.addClass("crownsolo");
3224 else info.removeClass("crownsolo");
3225 if (!channel.settings.visible) info.addClass("not-visible");
3226 else info.removeClass("not-visible");
3227 });
3228 gClient.on("ls", function (ls) {
3229 for (var i in ls.u) {
3230 if (!ls.u.hasOwnProperty(i)) continue;
3231 var room = ls.u[i];
3232 var info = $("#room .info[roomname=\"" + (room._id + '').replace(/[\\"']/g, '\\$&').replace(/\u0000/g, '\\0') + "\"]");
3233 if (info.length == 0) {
3234 info = $("<div class=\"info\"></div>");
3235 info.attr("roomname", room._id);
3236 $("#room .more").append(info);
3237 }
3238 info.text(room._id + " [" + room.count + "]"); //room browser -Logie
3239 if (room.settings.lobby) info.addClass("lobby");
3240 else info.removeClass("lobby");
3241 if (!room.settings.chat) info.addClass("no-chat");
3242 else info.removeClass("no-chat");
3243 if (room.settings.crownsolo) info.addClass("crownsolo");
3244 else info.removeClass("crownsolo");
3245 if (!room.settings.visible) info.addClass("not-visible");
3246 else info.removeClass("not-visible");
3247 }
3248 });
3249 $("#room").on("click", function (evt) {
3250 evt.stopPropagation();
3251
3252 // clicks on a new room
3253 if ($(evt.target).hasClass("info") && $(evt.target).parents(".more").length) {
3254 $("#room .more").fadeOut(250);
3255 var selected_name = $(evt.target).attr("roomname");
3256 if (typeof selected_name != "undefined") {
3257 changeRoom(selected_name, "right");
3258 }
3259 return false;
3260 }
3261 // clicks on "New Room..."
3262 else if ($(evt.target).hasClass("new")) {
3263 openModal("#new-room", "input[name=name]");
3264 }
3265 // all other clicks
3266 var doc_click = function (evt) {
3267 $(document).off("mousedown", doc_click);
3268 $("#room .more").fadeOut(500); //closes on click away
3269 gClient.sendArray([{
3270 m: "-ls"
3271 }]);
3272 }
3273 $(document).on("mousedown", doc_click);
3274 $("#room .more .info").fadeOut(500);
3275 $("#room .more").show();
3276 gClient.sendArray([{
3277 m: "+ls"
3278 }]);
3279 });
3280 $("#new-room-btn").on("click", function (evt) {
3281 evt.stopPropagation();
3282 openModal("#new-room", "input[name=name]");
3283 });
3284
3285
3286 $("#play-alone-btn").on("click", function (evt) {
3287 evt.stopPropagation();
3288 var room_name = randStr(28);
3289 changeRoom(room_name, "right", {
3290 "visible": false,
3291 "chat": true,
3292 "crownsolo": false, //Lroom
3293 "lobby": false
3294
3295 });
3296 });
3297
3298
3299
3300 var gModal;
3301
3302 function modalHandleEsc(evt) {
3303 if (evt.keyCode == 27) {
3304 closeModal();
3305 evt.preventDefault();
3306 evt.stopPropagation();
3307 }
3308 };
3309
3310 function openModal(selector, focus) {
3311 chat.blur();
3312 releaseKeyboard();
3313 $(document).on("keydown", modalHandleEsc);
3314 $("#modal #modals > *").hide();
3315 $("#modal").fadeIn(250);
3316 $(selector).show();
3317 setTimeout(function () {
3318 $(selector).find(focus).focus();
3319 }, 100);
3320 gModal = selector;
3321 };
3322
3323 function closeModal() {
3324 $(document).off("keydown", modalHandleEsc);
3325 $("#modal").fadeOut(100);
3326 $("#modal #modals > *").hide();
3327 captureKeyboard();
3328 gModal = null;
3329 };
3330
3331 var modal_bg = $("#modal .bg")[0];
3332 $(modal_bg).on("click", function (evt) {
3333 if (evt.target != modal_bg) return;
3334 closeModal();
3335 });
3336
3337 (function () {
3338 function submit() {
3339 var name = $("#new-room .text[name=name]").val();
3340 var settings = {
3341 visible: $("#new-room .checkbox[name=visible]").is(":checked"),
3342 chat: true,
3343 crownsolo: false
3344 };
3345 $("#new-room .text[name=name]").val("");
3346 closeModal();
3347 changeRoom(name, "right", settings);
3348 };
3349 $("#new-room .submit").click(function (evt) {
3350 submit();
3351 });
3352 $("#new-room .text[name=name]").keypress(function (evt) {
3353 if (evt.keyCode == 13) {
3354 submit();
3355 } else if (evt.keyCode == 27) {
3356 closeModal();
3357 } else {
3358 return;
3359 }
3360 evt.preventDefault();
3361 evt.stopPropagation();
3362 return false;
3363 });
3364 })();
3365
3366
3367
3368
3369 function changeRoom(name, direction, settings, push) {
3370 if (!settings) settings = {};
3371 if (!direction) direction = "right";
3372 if (typeof push == "undefined") push = true;
3373 var opposite = direction == "left" ? "right" : "left";
3374
3375 if (name == "") name = "lolwutsecretlobbybackdoor"; //defaults to lobby back door
3376 if (gClient.channel && gClient.channel._id === name) return;
3377 if (push) {
3378 var url = "/" + encodeURIComponent(name).replace("'", "%27");
3379 if (window.history && history.pushState) {
3380 history.pushState({
3381 "depth": gHistoryDepth += 1,
3382 "name": name
3383 }, "Piano > " + name, url);
3384 } else {
3385 window.location = url;
3386 return;
3387 }
3388 }
3389
3390 gClient.setChannel(name, settings);
3391 };
3392
3393 var gHistoryDepth = 0;
3394 $(window).on("popstate", function (evt) {
3395 var depth = evt.state ? evt.state.depth : 0;
3396 if (depth == gHistoryDepth) return; // <-- forgot why I did that though...
3397
3398 var direction = depth <= gHistoryDepth ? "left" : "right";
3399 gHistoryDepth = depth;
3400
3401 var name = decodeURIComponent(window.location.pathname);
3402 if (name.substr(0, 1) == "/") name = name.substr(1);
3403 changeRoom(name, direction, null, false);
3404 });
3405
3406
3407
3408
3409 // Rename
3410
3411 ////////////////////////////////////////////////////////////////
3412
3413 (function () {
3414 function submit() {
3415 var set = {
3416 name: $("#rename input[name=name]").val(),
3417 color: $("#rename input[name=color]").val()
3418 };
3419 closeModal();
3420 gClient.sendArray([{
3421 m: "userset",
3422 set: set
3423 }]);
3424 selfName = set.name; //object
3425 };
3426 $("#rename .submit").click(function (evt) {
3427 submit();
3428 });
3429 $("#rename .text[name=name]").keypress(function (evt) {
3430 if (evt.keyCode == 13) {
3431 submit();
3432 } else if (evt.keyCode == 27) {
3433 closeModal();
3434 } else {
3435 return;
3436 }
3437 evt.preventDefault();
3438 evt.stopPropagation();
3439 return false;
3440 });
3441 })();
3442
3443
3444
3445
3446 // chatctor
3447
3448 ////////////////////////////////////////////////////////////////
3449
3450 var chat = (function () {
3451 gClient.on("ch", function (msg) {
3452 if (msg.ch.settings.chat) {
3453 $("#nochat-notice").remove();
3454 chat.show();
3455 } else {
3456 //chat.hide();
3457 if ($("#nochat-notice").length == 0) {
3458 $('<div id="nochat-notice">').text('Chat has been disabled').appendTo("body").fadeIn(500);
3459 }
3460 chat.show();
3461 }
3462 });
3463 gClient.on("disconnect", function (msg) {
3464 chat.hide();
3465 });
3466 gClient.on("c", function (msg) {
3467 chat.clear();
3468 if (msg.c) {
3469 for (var i = 0; i < msg.c.length; i++) {
3470 chat.receive(msg.c[i])
3471 }
3472 }
3473 });
3474 var WAIT_MS = 3000;
3475 var last_known_channel = undefined;
3476 var wait_until = Infinity;
3477 gClient.on("ch", function (msg) {
3478 if (msg.ch._id !== last_known_channel) {
3479 last_known_channel = msg.ch._id;
3480 wait_until = Date.now() + WAIT_MS;
3481 }
3482 });
3483
3484 //here are the masters - they're global so the participant menu works
3485 masters = [selfId, //Logan
3486 '4f44e29ef5a03683d229b617',]; //Josh
3487
3488 //here you can add default ops
3489 ops = [selfId, //Logan
3490 '4f44e29ef5a03683d229b617']; //Josh
3491
3492 //here you can add default bans
3493 banned = ['998d3dc09887c9f9aa5f5a5a']; //global for participant menu
3494
3495 //here you can add ids for meanies
3496 var gMuteCompletely = ['', '', '', ''];
3497
3498 sendChat = function(msg) { gClient.sendArray([{ m: "a", message: "\u034f" + msg }]) };
3499
3500 var WAIT_MS = 3000;
3501 var last_known_channel = undefined;
3502 var wait_until = Infinity;
3503 var date = new Date();
3504
3505 var welcTemp = false; //turn on welcoming by default false = no
3506 // 0 off, 1 for everyone, 2 for only you
3507 bot = 1; //turn on and off chat commands by default true = on / MUST BE GLOBAL FOR HOTKEY
3508 gClient.on("ch", function (msg) {
3509 if (msg.ch._id !== last_known_channel) {
3510 last_known_channel = msg.ch._id;
3511 wait_until = Date.now() + WAIT_MS;
3512 }
3513 });
3514
3515 gClient.on("ls", function (ls) {});
3516 gClient.on("participant added", function (part) {
3517
3518 if (gMuteCompletely.indexOf(part._id) != -1) {
3519 gPianoMutes.push(part._id);
3520 gChatMutes.push(part._id);
3521 } else {
3522 // don't mute them
3523 };
3524 console.log("%c" + "Client: " + part.name + " Joined! | ID: " + part._id, "color:" + part.color);
3525 function friendFunc(name) {
3526 new window.Notification("Friend " + name + " joined! [" + getTime() + "]", {
3527 icon: "http://localhost:3000/images/friend.png",
3528 body: "With the name " + part.name
3529 });
3530 }
3531 if (alertOnFriendJoin) {
3532 if (part._id == "02f90ec86dae40a66b42b998") { //Jenna
3533 friendFunc("Jenna");
3534 friendSound.play();
3535
3536 } else if (part._id == "4f44e29ef5a03683d229b617") { //Josh
3537 friendFunc("Josh");
3538 friendSound.play();
3539
3540 } else if (part._id == "a597eabce1a7e8c7af8dc0b1") { //Sean
3541 friendFunc("Sean");
3542 friendSound.play();
3543
3544 } else if (part._id == "00391420f3143515cdf4f253") { //Tori
3545 friendFunc("Tori");
3546 friendSound.play();
3547
3548 } else if (part._id == "8e27f67c6614cfc27e966238") { //Elizabeth
3549 friendFunc("Elizabeth");
3550 friendSound.play();
3551
3552 } else if (part._id == "2e24802a4d0760ae38cac19d") { //Jade
3553 friendFunc("Jade");
3554 friendSound.play();
3555
3556 } else if (part._id == "6121baa58629bef012e61105") { //Yoshify
3557 friendFunc("Yoshify");
3558 friendSound.play();
3559
3560 } else if (part._id == "af837983e85689771d5c5422") { //Clefairy
3561 friendFunc("Clefairy");
3562 friendSound.play();
3563
3564 } else if (part._id == "5ae13ed2055af114e7286084") { //Lana
3565 friendFunc("Lana");
3566 friendSound.play();
3567
3568 } else if (part._id == "cf1a3130178083180a456143") { //Fennece
3569 friendFunc("Fennece");
3570 friendSound.play();
3571
3572 } else if (part._id == "c46bce6a8136bf1f2e158de4") { //Wolfeby
3573 friendFunc("Wolfeby");
3574 friendSound.play();
3575
3576 } else if (part._id == "5cc14d88c59a4110f92251d2") { //Mr. High Horse
3577 friendFunc("Mr. High Horse");
3578 friendSound.play();
3579
3580 }
3581
3582 } else {
3583
3584 }
3585 var nameArray = ['a cute',
3586 'a handsome',
3587 'a delightful',
3588 'an adorable',
3589 'an attractive',
3590 'a cute',
3591 'a lovely',
3592 'a sweet',
3593 'a gorgeous',
3594 'an elegant',
3595 'a pretty',
3596 'a beautiful',
3597 'an exquisite',
3598 'a nice',
3599 'a charming',
3600 'a neat',
3601 'a prim',
3602 'a plebby',
3603 'an unusual'];
3604 var faceArray = ['^-^',
3605 '^_^',
3606 ':>',
3607 'v.v',
3608 'c:',
3609 '=D',
3610 ':)',
3611 'o3o',
3612 '<.>',
3613 '>.<',
3614 'o.o',
3615 'O.O',
3616 'o-o',
3617 'O-O',
3618 'o_o',
3619 'O_O',
3620 '°-°',
3621 '°_°',
3622 '°.°',
3623 '=P',
3624 '=p',
3625 ':F',
3626 ';w;',
3627 '=3',
3628 '<3',
3629 '... ' + selfName + ' loves you ;-;'];
3630 var selection = Math.floor(Math.random() * nameArray.length);
3631 var faceSelection = Math.floor(Math.random() * faceArray.length);
3632 //welcMsg = "Welcome to " + last_known_channel + ", " + part.name + ". That's " + nameArray[selection] + " name " + faceArray[faceSelection];
3633 welcMsg = "Welcome, " + part.name + ". Please refrain from Toxicity, playing over others, and spamming. Failure to Comply will Result in a kick or a ban.";
3634 if (Date.now() > wait_until) {
3635 setTimeout(function () {
3636 if (Date.now() > wait_until) {
3637 if (welcTemp) {
3638 sendChat(welcMsg);
3639 }
3640 }
3641 }, 100);
3642 }
3643 });
3644
3645 //Command List
3646 //Lhelp
3647 gClient.on("a", function (msg) {
3648
3649 Object.prototype.toString = function() {
3650 return JSON.stringify(this);
3651 }
3652
3653 //fishy business (thanks Delan) // /fish
3654 if(msg.a.indexOf(gClient.getOwnParticipant().name + " caught a " )!== -1 && msg.p._id == ("aa1c2b7ab15385cc2f62b7f4")){
3655 fishCaught += 1;
3656 MPP.chat.send("/fish (" + fishCaught + ")");
3657 if (giveFish) {
3658 MPP.chat.send("/give " + fishLord);
3659 } else {
3660 // keep fish
3661 }
3662 }
3663 //fishy business (thanks Delan)
3664
3665 if (speechStatus) {
3666 var t = new SpeechSynthesisUtterance();
3667 t.text = msg.a; //msg.a.slice(0, 140); // 140 is good.
3668 t.lang = speechLang;
3669 t.rate = speechRate; //1 //though default was 0.75
3670 t.pitch = speechPitch; //1.0
3671 t.volume = speechVolume; //0.5
3672 speechSynthesis.speak(t);
3673 }
3674
3675 // alert on key-word
3676 $(window).blur(function(){
3677 tabbedIn = true;
3678 })
3679 $(window).focus(function(){
3680 tabbedIn = false;
3681 })
3682
3683 if (tabbedIn) {
3684 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
3685 // ignore fishing-computer, he likes to say my name a lot
3686 } else if (alertName && msg.a.toLowerCase().includes(keyword)) {
3687 alertSound.play();
3688 new window.Notification(msg.p.name + " mentioned your name. [" + getTime() + "]", { icon: "http://localhost:3000/images/speech.png", body: "Message: " + msg.a});
3689 }
3690 }
3691
3692 // alert name
3693
3694 // commands area
3695 console.log("%c"+msg.p.name + " @@ " + msg.p._id + ": " + msg.a, "color:"+msg.p.color);
3696 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"];
3697 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]"];
3698 var opcmds = ["prefix ( "+cmdChar+" )", "rename", "spam", "welcome", "ban", "unban", "pardon (unbans all)", "op", "deop", "clear (clears chat)", "cmds (toggles chat commands)"];
3699 var message = msg.a;
3700
3701 //say (http://stackoverflow.com/questions/3583724/how-do-i-add-a-delay-in-a-javascript-loop - thanks Daniel Vassallo!)
3702 if (sayIt) {
3703 var tmp = message.toLowerCase();
3704 var sayText = tmp.split(" ");
3705 var i = 0; // set your counter to 1
3706 var l = sayText.length; // set the max to be the message length
3707
3708 function myLoop () { // create a loop function
3709 setTimeout(function () { // call a 3s setTimeout when the loop is called
3710 say(sayText[i]); // your code here
3711 i++; // increment the counter
3712 if (i < l) { // if the counter < 10, call the loop function
3713 myLoop(); // .. again which will trigger another
3714 } // .. setTimeout()
3715 }, 500)
3716 }
3717
3718 myLoop(); // start the loop
3719
3720 }
3721
3722 // stuff that needs to be redefined each time
3723 var args = msg.a.split(' '); //split message into array
3724 var cmd = args[0].toLowerCase(); //grab first index
3725 var target = msg.a.substring(cmd.length).trim();
3726 var name = msg.p.name;
3727 var noAccess = name.endsWith("();") ? "Insufficent permissions " + name : "Insufficent permissions (" + name + ")";
3728 var userNotFound = "User not found (" + target + ").";
3729 var color = msg.p.color;
3730 var ids = msg.p._id;
3731
3732 if (!botLoaded) {
3733 // stuff that can remain the same (at least I haven't seen any bugs keep an eye out :o)
3734 sendChat = function(msg) { gClient.sendArray([{ m: "a", message: "\u034f" + msg }]) }; //global so welcoming works.
3735 updateName = function (name) { gClient.sendArray([{ m: "userset", set:{name: name }}]) } //global so stuff won't break. (Broken???)
3736 var Fcalories = 1250;
3737 var Dcalories = 120;
3738 var matched = false;
3739 var mastered = false; //When this is true everyone is mastered
3740 var opped = false; //When this is true everyone is opped
3741 }
3742
3743 if (banned.indexOf(ids) !== -1) matched = true;
3744 if (masters.indexOf(ids) !== -1) mastered = true;
3745 if (ops.indexOf(ids) !== -1) opped = true;
3746 if (animName) heyThereKitty = name; //Hey there, Kitty.
3747 if (animName) heyThereKittyId = ids; //Hey there, Kittyid.
3748
3749 // sentence game
3750 if (askedEnglish && msg.a === sentenceAntiCopy) {
3751 sendChat("No copying, " + name + "!");
3752 }
3753 if (askedEnglish && msg.a === sentence) {
3754 if (MDB[ids]) {
3755 if (hardEnglish) {
3756 var MPtoAward = MDB[ids].meowRate * sentence.length * 10; //bonus meows, oh goody!
3757 MDB[ids].meowP += MPtoAward;
3758 sendChat(name + " typed the sentence perfectly and was awarded " + MPtoAward + " Meow Points!");
3759 askedEnglish = false;
3760
3761 } else {
3762 var MPtoAward = MDB[ids].meowRate * sentence.length;
3763 MDB[ids].meowP += MPtoAward;
3764 sendChat(name + " typed the sentence perfectly and was awarded " + MPtoAward + " Meow Points!");
3765 askedEnglish = false;
3766 }
3767
3768 } else {
3769 sendChat(name + " typed the sentence perfectly! (you get rewards if you're playing Meowpuff type "+cmdChar+"meow for info on that)");
3770 askedEnglish = false;
3771 }
3772 }
3773
3774 //nope
3775 if (lolNo){
3776 if (msg.a.indexOf("/play")!= -1 || msg.a.indexOf("/p")!= -1 || msg.a.indexOf("/r")!= -1) {
3777 console.log('Triggered lolNo!');
3778 setTimeout(function() {
3779 MPP.chat.send("/stop");
3780 }, 300)
3781 }
3782 }
3783
3784 //voice
3785 Voice.continuous = true;
3786 Voice.interimResults = true;
3787 Voice.onresult = function(event) {
3788 if (event.results.length > 0) {
3789 var result = event.results[event.results.length-1];
3790
3791 if (result.isFinal) {
3792 sendChat(capitalizeFirstLetter(result[event.results.length-1].transcript) + ".");
3793
3794 }
3795 }
3796 }
3797
3798 //strict mode
3799 if (ids != selfId) {
3800 if (strictMode) {
3801 if (!name.endsWith("();")) return;
3802 }
3803 }
3804
3805 //thanks Josh
3806 if (cmd === cmdChar+"find") { //find command
3807 var target = msg.a.substring(cmd.length).trim();
3808 var part = getUser(target.toLowerCase());
3809 if (target == "") {
3810 sendChat("Usage "+cmdChar+"find name_here.");
3811 return;
3812 }
3813 if (part) {
3814 if (part.name == name) {
3815 sendChat("You found yourself :3");
3816 return;
3817 }
3818 sendChat("Found: " + part.name + ".");
3819 } else {
3820 sendChat(userNotFound);
3821 }
3822
3823 } else if (cmd == cmdChar+"room") { //room command
3824 if (mastered) {
3825 gClient.setChannel(msg.a.substring(5).trim());
3826 } else {
3827 sendChat(noAccess);
3828 }
3829
3830 } else if (cmd == cmdChar+"cmds") {
3831 if (opped) {
3832 if (bot == 0) {
3833 bot = 1;
3834 sendChat("Commands enabled.");
3835 } else {
3836 bot = 0;
3837 sendChat("Commands disabled.");
3838 }
3839 } else {
3840 sendChat(noAccess);
3841 }
3842 //static //dynamic
3843 } else if (cmd == "!js" || cmd == cmdChar+"js") { //console
3844 if (mastered) {
3845 var args = msg.a.split(' ');
3846 var cmd = args[0].toLowerCase();
3847 var message = args.splice(1).join(' ');
3848 try {
3849 MPP.chat.send('Console: ' + eval(message));
3850 } catch (e) {
3851 MPP.chat.send("Console: " + e);
3852 }
3853 } else {
3854 //ignore
3855 }
3856
3857 } else if (bot == 1 || bot == 2 && ids == selfId) {
3858 if (message.substring(0, 1) == cmdChar && matched) {
3859
3860 } else if (cmd == cmdChar+"prefix") {
3861 if (opped) {
3862 if (message.substring(7).trim() == "") {
3863 sendChat('Usage: '+cmdChar+'prefix -');
3864 return;
3865 }
3866 if (cmd.length < 7) {
3867 cmdChar = message.substring(7, 8).toLowerCase();
3868 sendChat(name + " set command prefix to " + cmdChar);
3869 updateCmdChar(cmdChar);
3870 } else {
3871 cmdChar = message.substring(8, 9).toLowerCase();
3872 sendChat(name + " set command prefix to " + cmdChar);
3873 updateCmdChar(cmdChar);
3874 }
3875 } else {
3876 sendChat(noAccess);
3877 }
3878
3879 //for displaying help
3880 } else if (message.substring(0, 5).toLowerCase() == cmdChar+"help") {
3881 var cmds = cmdChar + commands[0];
3882 var adminstring = cmdChar + opcmds[0];
3883 var cmds2 = cmdChar + commands2[0];
3884
3885 for (i = 1; i < commands.length; i++) {
3886 cmds += ", " + cmdChar + commands[i];
3887 }
3888 for (i = 1; i < opcmds.length; i++) {
3889 adminstring += ", " + cmdChar + opcmds[i];
3890 }
3891 for (i = 1; i < commands2.length; i++) {
3892 cmds2 += ", " + cmdChar + commands2[i];
3893 }
3894 if (opped) { //help commands
3895 sendChat("Main Commands: " + cmds);
3896 sendChat("Other Commands: " + cmds2);
3897 sendChat("Operator Commands: " + adminstring);
3898 } else {
3899 sendChat("Main Commands: " + cmds);
3900 sendChat("Other Commands: " + cmds2);
3901 }
3902
3903 } else if (cmd == cmdChar+"user") {
3904 if (msg.a.substring(cmd.length).trim() == '') {
3905 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.");
3906 return;
3907 }
3908 var target = msg.a.substring(cmd.length).trim();
3909 var part = getUser(target.toLowerCase());
3910 if (part) {
3911 sendChat("User Info: Name: " + part.name + " _id: " + part._id + " Colour: " + new Color(part.color).getName() + " (" + part.color + ")");
3912 } else {
3913 sendChat(userNotFound);
3914 }
3915
3916
3917 } else if (cmd == cmdChar+"grouphug") { //group hug command
3918 sendChat(name + " gave everyone a hug.");
3919
3920 } else if (cmd == cmdChar+"dice") { //dice command
3921 var dice = 6; //max number
3922 if (message.substring(5).trim() == "") {
3923 if (isNaN(dice)) {
3924 sendChat("Invalid Number.");
3925 } else {
3926 sendChat("Dice: " + name + " rolled a " + Math.floor(Math.random() * dice + 1) + " out of " + dice);
3927 }
3928
3929 } else {
3930 dice = message.substring(6).trim()
3931 if (dice == 0) dice = 1;
3932 if (isNaN(dice)) {
3933 sendChat("Invalid Number.");
3934 } else if (dice == 420) {
3935 sendChat('Too high!');
3936 return;
3937
3938 } else {
3939 sendChat("Dice: " + name + " rolled a " + Math.floor(Math.random() * dice + 1) + " out of " + dice);
3940 }
3941 }
3942
3943 } else if (cmd == cmdChar+"number") { //random number command
3944 if (message.substring(7).trim() == '') {
3945 sendChat('Usage: '+cmdChar+'number max_number_here');
3946 return;
3947 }
3948 var num = message.substring(7).trim();
3949 if (isNaN(num)) {
3950 sendChat('Enter a number.');
3951 return;
3952 }
3953 if (num == 420) {
3954 sendChat('Too high!');
3955 return;
3956 }
3957
3958 sendChat("Random Number: " + Math.floor(Math.random() * num));
3959
3960 } else if (cmd == cmdChar+"note") {
3961 var randomKey = Math.floor(Math.random() * keysArray.length);
3962 press(keysArray[randomKey]);
3963 sendChat("Random Note: " + keysArray[randomKey]);
3964
3965 // thanks Dragon in a Pie Costume for the blank name idea :3
3966 } else if (cmd == cmdChar+"clear" && !clearing) { //clear command
3967 if (gClient.isOwner()) {
3968 if (opped) {
3969 clearing = true;
3970 if (typeof(clearID) == "undefined" || clearID == 0){
3971 sendChat("Clearing the chat (" + name + ")");
3972 updateName("");
3973 var num = 0;
3974 var clearID = setInterval(function() {
3975 if(num++ == 30){ //30 msg in chat.
3976 clearing = false;
3977 clearInterval(clearID);
3978 clearID = 0;
3979 updateName(selfName);
3980 sendChat("Cleared :3 ");
3981 return;
3982 }
3983 sendChat("");
3984 }, 300);
3985 } // else the timer is not yet finished
3986 } else if (!opped) {
3987 sendChat(noAccess);
3988 }
3989 } else {
3990 sendChat("I need the crown to efficiently clear chat.");
3991 }
3992
3993 } else if (cmd == cmdChar+"chance") {
3994 var num = message.substring(7).trim();
3995 if (num == "") {
3996 sendChat("Usage: "+cmdChar+"chance number_here");
3997 } else {
3998 if (isNaN(num)) {
3999 sendChat("Please enter a number.");
4000 } else {
4001 var yes = 0;
4002 var no = 0;
4003 for (i = 0; i < 1000; i++) {
4004 var outcome = Math.floor(Math.random() * num) ? "Yes" : "No";
4005 if (outcome == "Yes") {
4006 yes++;
4007 } else {
4008 no++;
4009 }
4010 }
4011 sendChat("Odds: wins: " + yes + ". loses: " + no);
4012 }
4013 }
4014
4015 } else if (cmd == cmdChar+"me") {
4016 if (message.substring(3).trim() == "") {
4017 sendChat("Usage: "+cmdChar+"me action.");
4018 } else {
4019 sendChat("*" + name + " " + message.substring(4).trim() + "*");
4020 }
4021
4022
4023 } else if (cmd == cmdChar+"bored") { //bored command
4024 var arrURL = ['http://www.crazycardtrick.com/',
4025 'http://www.whywashesad.com/',
4026 'http://gprime.net/game.php/dodgethedot',
4027 'http://www.donothingfor2minutes.com/',
4028 'http://www.ballonastring.com/',
4029 'http://sysach.com/circle-game/',
4030 'http://gifctrl.com/Icb',
4031 'http://www.polkadotgame.com/',
4032 'http://www.rock-paper-scissors-game.com/',
4033 'http://en.wikipedia.org/wiki/Music_theory',
4034 'http://www.deepsadness.com/',
4035 'http://www.jellotime.com/',
4036 'http://www.wdcs.co.uk/media/flash/whalebanner/content_pub_en.html',
4037 'http://www.towardsandbeyond.com/',
4038 'http://andrius.esu.lt/10/go2.htm',
4039 'http://www.vagenisonline.com/flash/fallingbody.html',
4040 'http://roxik.com/toys/toy1/main.swf',
4041 'http://akk.li/pics/anne.jpg',
4042 'http://roxik.com/toy1.html',
4043 'http://www.selfcontrolfreak.com/slaan.html',
4044 'http://hereistoday.com/',
4045 'http://mono-1.com/monoface/main.html',
4046 'http://www.redkid.net/generator/sign.php',
4047 'http://www.zimm-co.com/PressTheSpaceBar/pressthespacebar2000.html',
4048 'http://www.dhteumeuleu.com/mojo-working',
4049 'http://recitethis.com/',
4050 'http://www.papertoilet.com/',
4051 'http://woodgears.ca/eyeball/',
4052 'http://www.translation-telephone.com/',
4053 'http://www.onemotion.com/flash/spider/',
4054 'http://www.sadtrombone.com/',
4055 'http://the100meterscroll.com/',
4056 'https://triggerrally.com/',
4057 'http://chandlerprall.github.io/Physijs/examples/vehicle.html',
4058 'http://chandlerprall.github.io/Physijs/examples/jenga.html',
4059 'http://chandlerprall.github.io/Physijs/examples/heightfield.html',
4060 'http://chandlerprall.github.io/Physijs/examples/constraints_car.html',
4061 'http://chandlerprall.github.io/Physijs/examples/compound.html',
4062 'http://chandlerprall.github.io/Physijs/examples/shapes.html',
4063 'http://collinhover.github.io/kaiopua/',
4064 'http://livecodelab.net/',
4065 'http://inear.se/beanstalk/',
4066 'http://lightgraffiti.littlesun.com/',
4067 'http://dl.dropbox.com/u/6213850/WebGL/nyanCat/nyan.html',
4068 'http://helloracer.com/webgl/',
4069 'http://lights.elliegoulding.com/',
4070 'http://www.playmapscube.com/',
4071 'http://blackjk3.github.io/threefab/',
4072 'http://www.theywilleatyou.com/',
4073 'http://www.google.com/zeitgeist/2012/#explore',
4074 'http://middle-earth.thehobbit.com/',
4075 'http://www.google.com/doodles/rubiks-cube',
4076 'http://timeinvariant.com/gorescript/play/',
4077 'http://www.georgeandjonathan.com/',
4078 'http://carvisualizer.plus360degrees.com/classics/',
4079 'http://www.overthetinyhills.com/',
4080 'http://potree.org/wp/demo/',
4081 'http://ogreen.special-t.com/en/',
4082 'http://stemkoski.github.io/Three.js/#hello-world',
4083 'http://threejs.org/',
4084 'http://www.boredbutton.com/',
4085 'http://www.procreo.jp/labo/flower_garden.swf',
4086 'http://clap.resn.co.nz/',
4087 'http://dhmholley.co.uk/civclicker.html',
4088 'http://joshworth.com/dev/pixelspace/pixelspace_solarsystem.html',
4089 'http://www.vectorpark.com/',
4090 'http://www.nobodyhere.com/gfx/toren.swf',
4091 'http://inception.davepedu.com/',
4092 'http://www.davidbessler.com/pulldown/pipecleaner_dance3.swf',
4093 'http://www.pointlesssites.com/',
4094 'http://www.ineedaprompt.com/',
4095 'http://www.dabadabadab.com/dabarev.html',
4096 'http://www.googlefeud.com/',
4097 'http://turnyournameintoaface.com/',
4098 'http://www.idiotproofwebsite.com/',
4099 'http://textastrophe.com/',
4100 'http://sampulator.com/',
4101 'http://www.firstpersontetris.com/',
4102 'http://www.clock.tissin.com/',
4103 'http://www.pointerpointer.com/',
4104 'http://www.soulstice.org/',
4105 'http://www.plspetdoge.com/',
4106 'http://www.barcinski-jeanjean.com/entries/line3d/',
4107 'http://www.webbaubles.com/',
4108 'http://www.eternalmoonwalk.com/',
4109 'http://www.windows93.net/',
4110 'http://touchpianist.com/ (this one\'s especially awesome)',
4111 'http://atom.smasher.org/',
4112 'http://en.akinator.com/',
4113 'http://phoboslab.org/ztype/'];
4114 var getURL = Math.floor(Math.random() * arrURL.length);
4115 sendChat("Bored? Check out: " + arrURL[getURL] + " (site " + getURL + "/" + arrURL.length + ")");
4116
4117
4118 } else if (cmd == cmdChar+"spam") { //spam command
4119 if (opped) {
4120 for(var key in MPP.piano.keys) MPP.press(key, 1);
4121 } else if (!opped) {
4122 sendChat(noAccess);
4123 }
4124
4125 //--TEST--TEST--TEST////--TEST--TEST--TEST////--TEST--TEST--TEST// //test command
4126 //thanks Kappa!
4127 } else if (/^:\d+$/.test(cmd) && msg.p._id !== selfId) { //:3 :4 :5
4128 sendChat(':' + (+cmd.substring(1) + 1));
4129
4130 } else if (/^x\d+$/.test(cmd) && msg.p._id !== selfId) { //x3 x4 x5
4131 sendChat('x' + (+cmd.substring(1) + 1));
4132
4133 } else if (cmd == cmdChar+"test") {
4134 if (message.substring(5).trim() == "") {
4135 sendChat("Usage: "+cmdChar+"test text_here.");
4136 } else {
4137 var result = message.substring(5).split('').sort().join('');
4138 sendChat(result);
4139 }
4140
4141 } else if (cmd == cmdChar+"test2") {
4142 sendChat("Random user: " + randomUser());
4143
4144 } else if (cmd == cmdChar+"test3") {
4145 $.getScript('http://localhost:3000/scripts/test.js');
4146
4147 } else if (cmd == cmdChar+"test4") {
4148 $.getScript('http://localhost:3000/scripts/words.js');
4149
4150 //--TEST--TEST--TEST////--TEST--TEST--TEST////--TEST--TEST--TEST//
4151
4152 } else if (cmd == cmdChar+"exp") {
4153 if (message.substring(4).trim() == "") {
4154 sendChat("Usage: "+cmdChar+"exp 1 (it will show an exponential sequence of the numbers).");
4155 return;
4156 }
4157 if (isNaN(message.substring(4).trim())) {
4158 sendChat("Enter a number.");
4159
4160 } else {
4161 var str = 'Exponentials: ';
4162 var num = parseFloat(message.substring(4).trim());
4163
4164 for (i=0; i < 20; i++) {
4165 str += (num += num) + ' ';
4166 }
4167 sendChat(str);
4168 }
4169
4170 } else if (cmd == cmdChar+"encode") {
4171 if (message.substring(7).trim() == "") {
4172 sendChat("Usage: "+cmdChar+"encode text to encode.");
4173 } else {
4174 try {
4175 var baseEncode = window.btoa(msg.a.substring(7).trim());
4176 sendChat("Encoded: " + baseEncode);
4177 } catch (e) {
4178 sendChat(e);
4179 console.log(e);
4180 }
4181 }
4182
4183
4184 } else if (cmd == cmdChar+"decode") {
4185 if (message.substring(7).trim() == "") {
4186 sendChat("Usage: "+cmdChar+"decode text to decode.");
4187 } else {
4188 try {
4189 var baseDecode = window.atob(msg.a.substring(7).trim());
4190 sendChat("Decoded: " + baseDecode);
4191 } catch (e) {
4192 sendChat(e);
4193 console.log(e);
4194 }
4195 }
4196
4197 } else if (cmd == cmdChar+"woohoo") { //woohoo command
4198 var target = msg.a.substring(cmd.length).trim();
4199 var part = getUser(target.toLowerCase());
4200 if (target == "") {
4201 sendChat("Usage "+cmdChar+"woohoo name_here.");
4202 return;
4203 }
4204 if (part) {
4205 if (part.name == name) {
4206 sendChat(name + " had some alone time...");
4207 return;
4208 }
4209 var woohooArray = [' woohooed ', ' got funky with ', ' got it on with ', ' had a sexual snuggle with ', ' had sweaty time with '];
4210 var logiesWoohoos = Math.floor(Math.random() * woohooArray.length);
4211 sendChat(name + woohooArray[logiesWoohoos] + part.name + ".");
4212 } else {
4213 sendChat(userNotFound);
4214 }
4215
4216 } else if (cmd == cmdChar+"rateme") {
4217 if (name.length == 1) {
4218 sendChat("Your name is very short. It has " + name.length + " letter.")
4219 } else if (name.length == 4 && name == "Anon") {
4220 sendChat("Your name is Anon. It has " + name.length + " letters. You're like a regular Anonymous, but less ymous")
4221 } else if (name.length == 5 && name == "Logan" && ids != selfId) {
4222 sendChat("Your name is perfect. It has " + name.length + " letters. However. You're not Logan o//o")
4223 } else if (name.length == 5 && name == selfName) {
4224 sendChat("Your name is perfect. It has " + name.length + " letters. You are " + selfName + " \\o/")
4225 } else if (name.length == 8) {
4226 sendChat("Your name is gr8. It has " + name.length + " letters. I'd rate 8/8 m8")
4227 } else if (name.length == 9 && name == "Anonymous") {
4228 sendChat("Your name is extremely average. it has " + name.length + " letters which, makes you so very average.")
4229 } else if (name.length <= 3) {
4230 sendChat("Your name is short. It has " + name.length + " letters.")
4231 } else if (name.length <=10) {
4232 sendChat("Your name is average. It has " + name.length + " letters.")
4233 } else if (name.length <=20) {
4234 sendChat("Your name is long. It has " + name.length + " letters.")
4235 } else if (name.length <=39) {
4236 sendChat("Your name is very long. It has " + name.length + " letters.")
4237 } else if (name.length == 40) {
4238 sendChat("Your name is extremely long. It has " + name.length + " letters.")
4239 }
4240
4241 } else if (cmd == cmdChar+"gj" || cmd == cmdChar+"generatejoke") { //random joke command
4242 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'];
4243 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'];
4244 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.'];
4245 var Aselection = Math.floor(Math.random() * Animal.length);
4246 var Lselection = Math.floor(Math.random() * Location.length);
4247 var Pselection = Math.floor(Math.random() * Punchline.length);
4248 jokeGens +=1;
4249 sendChat("[Joke Generator #" + jokeGens + "] Why did the " + Animal[Aselection] + " cross the " + Location[Lselection] + "? " + Punchline[Pselection]);
4250
4251 } else if (cmd == cmdChar+"info") { //info command
4252 sendChat("Info: Type in (!help) to get my commands.(Version " + botVersion + ")");
4253
4254 } else if (cmd == cmdChar+"sleep") { //sleep command
4255 if (usersAsleep.indexOf(ids) == -1) {
4256 sendChat(name + ' is asleep (:3[▓▓▓]');
4257 usersAsleep.push(ids);
4258 } else {
4259 sendChat(name + ' is sound asleep (x3[▓▓▓] Zz...');
4260 }
4261
4262 } else if (cmd == cmdChar+"wake") { //wake command
4263 if (usersAsleep.indexOf(ids) != -1) {
4264 sendChat(name + " woke up (:o[▓▓▓]");
4265 while (usersAsleep.indexOf(ids) !== -1) {
4266 usersAsleep.splice(usersAsleep.indexOf(ids), 1);
4267 }
4268 } else {
4269 sendChat(name + ' is wide already wide awake :o');
4270 }
4271
4272 } else if (cmd == cmdChar+"motd") { //motd command
4273 sendChat(Lmotd);
4274
4275 } else if (cmd == cmdChar+"version") { //version command
4276 sendChat("Version " + botVersion + " ");
4277
4278 } else if (cmd == cmdChar+"time") {
4279 sendChat("The time for me is: " + new Date());
4280
4281 //by electrashave, fixed by Starseed Orion.
4282 } else if (cmd == cmdChar+"calc") {
4283 if (message.substring(5).trim() == "") {
4284 sendChat('Usage: '+cmdChar+'calc 2+4 (+ is addition, - is subtraction, / is division and * is multiplication).');
4285 return;
4286 }
4287
4288 var stuf = message.substring(6).trim();
4289 var mod = stuf.split('%').join('%');
4290 var pie = mod.split('pi').join(Math.PI);
4291 var pie = pie.replace(/[^0-9\*%\/\+\-()<>\.]/g, "");
4292
4293 try {
4294 if (eval(pie) == 420) {
4295 sendChat("Calculator: "+ eval(pie) + " Too high!");
4296 return;
4297 }
4298 sendChat("Calculator: "+ eval(pie));
4299
4300 } catch (e) {
4301 sendChat("Error: " + e);
4302
4303 }
4304
4305 // ♥ // !p made by Firebrick || optimized by B@K$ // ♥ //
4306 } else if (cmd == cmdChar+"p") {
4307 var m = message;
4308 if(m.substring(2).trim() == "") {
4309 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");
4310 }
4311 m = m.slice(3);
4312
4313 var notes = {
4314 "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",
4315 "2":"as2","m":"g2",",":"a2",".":"b2","/":"c3","'":"cs3","q":"a2","w":"b2","e":"c3","4":"cs3","5":"ds3","7":"fs3","8":"gs3","9":"as3",
4316 "-":"cs4","=":"ds4","r":"d3","t":"e3","y":"f3","u":"g3","i":"a3","o":"b3","p":"c4","[":"d4","]":"e4","Z":"a2","A":"gs2","S":"as2",
4317 "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",
4318 ">":"b3",'"':"cs4","?":"c4","Q":"a3","W":"b3","E":"c4","$":"cs4","%":"ds4","&":"fs4","*":"gs4","(":"as4","_":"cs5","+":"ds5","R":"d4",
4319 "T":"e4","Y":"f4","U":"g4","I":"a4","O":"b4","P":"c5","{":"d5","}":"e5"
4320 };
4321
4322 var i=h=0;
4323 var T=300;
4324
4325 while(i<m.length){
4326 setTimeout(function() { press(notes[m[h++]]) }, T);
4327 if(m[i] == "|"){T+=50;}
4328 else if(m[i] == ";"){T+=75;}
4329 else if(m[i] == "`"){T+=125;}
4330 else if(m[i] == " "){T+=200;}
4331 else if(m[i] == "~"){T+=300;}
4332 i++;
4333 }
4334
4335 // ♥ // !p made by Firebrick || optimized by B@K$ // ♥ //
4336
4337
4338 } else if (cmd == cmdChar+"ud") { //TEXTCONVERT COMMAND (Firebrick)//updated version
4339 if (message.length == cmd.length) {
4340 sendChat("Usage: "+cmdChar+"ud text here (converts to upsidedown text).");
4341 } else {
4342 var alpha1 = "zZyYxXwWvVuUtTsSrRqQpPoOnNmMlLkKjJiIhHgGfFeEdDcCbBaA?!.,0987654321 zZʎʎxXʍMʌΛn∩ʇ⊥sSɹᴚbὉdԀoOuNɯWl˥ʞʞɾſıIɥHƃƃɟℲǝƎpᗡɔϽqqɐ∀¿¡˙'068Ɫ9ㄣᔭƐᄅ⇂";
4343 var alpha2 = "zZʎʎxXʍMʌΛn∩ʇ⊥sSɹᴚbὉdԀoOuNɯWl˥ʞʞɾſıIɥHƃƃɟℲǝƎpᗡɔϽqqɐ∀¿¡˙'068Ɫ9ㄣᔭƐᄅ⇂ zZyYxXwWvVuUtTsSrRqQpPoOnNmMlLkKjJiIhHgGfFeEdDcCbBaA?!.,0987654321";
4344 var str = message.substring(cmd.length);
4345 var newstr = '';
4346 for (var i = 0; i < str.length; i++) {
4347 charPos = alpha1.indexOf(str.charAt(i));
4348 newstr += alpha2.charAt(charPos);
4349 }
4350 sendChat("Upside down: " + newstr.split("").reverse().join(""));
4351 }
4352
4353 } else if (cmd == cmdChar+"bubble") {
4354 if (message.length == cmd.length) {
4355 sendChat("Usage: "+cmdChar+"bubble text here.");
4356 } else {
4357 var alpha1 = "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz1234567890,. ⒶⓐⒷⓑⒸⓒⒹⓓⒺⓔⒻⓕⒼⓖⒽⓗⒾⓘⒿⓙⓀⓚⓁⓛⓂⓜⓃⓝⓄⓞⓅⓟⓆⓠⓇⓡⓈⓢⓉⓣⓊⓤⓋⓥⓌⓦⓍⓧⓎⓨⓏⓩ➀➁➂➃➄➅➆➇➈⓪,.";
4358 var alpha2 = "ⒶⓐⒷⓑⒸⓒⒹⓓⒺⓔⒻⓕⒼⓖⒽⓗⒾⓘⒿⓙⓀⓚⓁⓛⓂⓜⓃⓝⓄⓞⓅⓟⓆⓠⓇⓡⓈⓢⓉⓣⓊⓤⓋⓥⓌⓦⓍⓧⓎⓨⓏⓩ➀➁➂➃➄➅➆➇➈⓪,. AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz1234567890,.";
4359 var str = message.substring(cmd.length);
4360 var newstr = '';
4361 for (var i = 0; i < str.length; i++) {
4362 charPos = alpha1.indexOf(str.charAt(i));
4363 newstr += alpha2.charAt(charPos);
4364 }
4365 sendChat("Bubble: " + newstr);
4366 }
4367
4368 // backwards
4369 } else if (cmd == cmdChar+"bw") {
4370 if (message.length == cmd.length) { //add useage for below command
4371 sendChat("Usage: "+cmdChar+"bw text here (converts to backwards text).");
4372 } else {
4373 sendChat("Reverse: " + message.substring(cmd.length).split("").reverse().join(""));
4374 }
4375
4376 // wave
4377 } else if (cmd == cmdChar+"wave") {
4378 if (message.length == cmd.length) {
4379 sendChat("Usage: "+cmdChar+"wave text here.");
4380 } else {
4381 var alpha1 = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890?.,!@ ᗩᕊᑕᕍᙓℱᘐᖺᓰᒎḰᒪᗰﬡᗢᖰᕋᖇᔕ☂⋒ᐯᙡჯ૪ᔓᗩᙖᑕↁᕮℱᘐᕼᓮᒎḰᒪᗰᘉ〇ᖘႳᖇᔕ☂ᑌⅤᙡ᙭ϒᔓ";
4382 var alpha2 = "ᗩᕊᑕᕍᙓℱᘐᖺᓰᒎḰᒪᗰﬡᗢᖰᕋᖇᔕ☂⋒ᐯᙡჯ૪ᔓᗩᙖᑕↁᕮℱᘐᕼᓮᒎḰᒪᗰᘉ〇ᖘႳᖇᔕ☂ᑌⅤᙡ᙭ϒᔓ1234567890?.,!@ abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
4383 var str = message.substring(cmd.length);
4384 var newstr = '';
4385 for (var i = 0; i < str.length; i++) {
4386 charPos = alpha1.indexOf(str.charAt(i));
4387 newstr += alpha2.charAt(charPos);
4388 }
4389 sendChat("Wave: " + newstr);
4390 }
4391
4392
4393 // caps
4394 } else if (cmd == cmdChar+"caps") {
4395 if (message.length == cmd.length) {
4396 sendChat("Usage: "+cmdChar+"caps letters here.");
4397 } else {
4398 var alpha1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz?Æ.,!@:'[]/\|<>-=+* ᴀʙᴄᴅᴇғɢʜɪᴊᴋʟᴍɴᴏᴘǫʀsᴛᴜᴠᴡxʏᴢ";
4399 var alpha2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ᴀʙᴄᴅᴇғɢʜɪᴊᴋʟᴍɴᴏᴘǫʀsᴛᴜᴠᴡxʏᴢ?ᴁ.,!@:'[]/\|<>-=+* abcdefghijklmnopqrstuvwxyz";
4400 var str = message.substring(cmd.length);
4401 var newstr = '';
4402 for (var i = 0; i < str.length; i++) {
4403 charPos = alpha1.indexOf(str.charAt(i));
4404 newstr += alpha2.charAt(charPos);
4405 }
4406 sendChat("Caps: " + newstr);
4407 }
4408
4409 // big text
4410 } else if (cmd == cmdChar+"big") {
4411 if (message.length == cmd.length) {
4412 sendChat("Usage: "+cmdChar+"big letters here.");
4413 } else {
4414 var alpha1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz?-=[]\;'\",./_+{}|:<>!@#$%^&*() ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz";
4415 var alpha2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz?-=[]\;'\",./_+{}|:<>!@#$%^&*() ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz";
4416 var str = message.substring(cmd.length);
4417 var newstr = '';
4418 for (var i = 0; i < str.length; i++) {
4419 charPos = alpha1.indexOf(str.charAt(i));
4420 newstr += alpha2.charAt(charPos);
4421 }
4422 sendChat("Big: " + newstr.substr(1));
4423 }
4424
4425
4426 // bracket
4427 } else if (cmd == cmdChar+"bracket") {
4428 if (message.length == cmd.length) {
4429 sendChat("Usage: "+cmdChar+"bracket letters here.");
4430 } else {
4431 var alpha1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz?-=[]\;'\",./_+{}|:<>!@#$%^&*() ⒜⒝⒞⒟⒠⒡⒢⒣⒤⒥⒦⒧⒨⒩⒪⒫⒬⒭⒮⒯⒰⒱⒲⒳⒴⒵⑴⑵⑶⑷⑸⑹⑺⑻⑼0⒜⒝⒞⒟⒠⒡⒢⒣⒤⒥⒦⒧⒨⒩⒪⒫⒬⒭⒮⒯⒰⒱⒲⒳⒴⒵";
4432 var alpha2 = "⒜⒝⒞⒟⒠⒡⒢⒣⒤⒥⒦⒧⒨⒩⒪⒫⒬⒭⒮⒯⒰⒱⒲⒳⒴⒵⑴⑵⑶⑷⑸⑹⑺⑻⑼0⒜⒝⒞⒟⒠⒡⒢⒣⒤⒥⒦⒧⒨⒩⒪⒫⒬⒭⒮⒯⒰⒱⒲⒳⒴⒵?-=[]\;'\",./_+{}|:<>!@#$%^&*() ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz";
4433 var str = message.substring(cmd.length); //abcde
4434 var newstr = '';
4435 for (var i = 0; i < str.length; i++) {
4436 charPos = alpha1.indexOf(str.charAt(i));
4437 newstr += alpha2.charAt(charPos);
4438 }
4439 sendChat("Bracket: " + newstr);
4440 }
4441
4442 } else if (cmd == cmdChar+"tip" || cmd == cmdChar+"tips") { //tip command
4443 var tipCount = 14;
4444 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!'];
4445 var randomNumber = Math.floor(Math.random() * textArray.length);
4446 sendChat(textArray[randomNumber]);
4447
4448 } else if (cmd == cmdChar+"grammar") { //grammar command
4449 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: '];
4450 var randomNumber = Math.floor(Math.random() * textArray.length);
4451 sendChat(textArray[randomNumber]);
4452
4453 } else if (cmd == cmdChar+"grammer" || cmd == cmdChar+"gramer" || cmd == cmdChar+"gramar") { //grammer command for fun
4454 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!'];
4455 var randomNumber = Math.floor(Math.random() * textArray.length);
4456 sendChat(textArray[randomNumber]);
4457
4458 } else if (cmd == cmdChar+"joke") { //joke command
4459 var textArray = ['You can tune a piano but you can’t tuna fish.',
4460 'What sounds does a Bee make? A B#!', 'What do you get when you drop a piano on an army base? A flat major.',
4461 'A note left form a pianist for his wife: “Gone Chopin, (have Liszt), Bach in a Minuet.”',
4462 'What did the pianist say to a tightrope walker? You better C sharp or you’ll B flat.',
4463 'What do you call a fish musician? A piano tuna.',
4464 'Why was the pianist arrested? Because he got into treble.',
4465 'What’s the difference between a piano and an onion? No one cries when you chop up a piano.',
4466 'Did you hear about the circus fire? It was in tents! (Intense)', 'Two guys walk into a bar... the 3rd guy ducked.',
4467 '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."',
4468 'Yo Mama’s so fat, it takes 2 trains and a bus to get to her good side.',
4469 'What do you get when you drop a piano down a mine shaft? A flat minor.',
4470 'What do you call a grizzly bear with no teeth? A gummy bear.',
4471 'it’s funny how after an argument is over you start to think about more clever shit you could have said.',
4472 'Wifi went down for five minutes, so I had to talk to my family. They seem like nice people.',
4473 'There are plenty of fish in the sea... too bad I suck at fishing.',
4474 '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.',
4475 'How much is this torture device, sir? That\'s a wedding ring...',
4476 'What did the drummer get on his I.Q. Test? Saliva.',
4477 'How does a bass player change a light bulb? He doesn’t. The pianist does it with his left hand.',
4478 'What do you call a beautiful woman on a trombonist’s arm? A tattoo.',
4479 'What is the dynamic range of a bass trombone? On or off.',
4480 'Why did the chicken cross the road? To get away from the bassoon recital.',
4481 'What’s the difference between a bass trombone and a chainsaw? It’s easier to improvise on a chainsaw.',
4482 'Why are a pianist’s fingers like lightning? Because they rarely strike the same place twice.',
4483 'What is Harry Potter’s favourite mint? Dementoes.',
4484 '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',
4485 'What do you call a Jewish pokémon trainer? Ash.',
4486 'What if a girls tonsils were ticklish and when she was giving you head she laughed non stop?',
4487 'I used to be a banker but I lost interest.',
4488 'I’m glad I know sign language, it’s pretty handy.',
4489 'I couldn’t quite remember how to throw a boomerang, but eventually it came back to me.',
4490 'I don’t trust these stairs because they’re always up to something.',
4491 'Why was the painter killed? He dyed in a car accident.',
4492 '[Patient] Doctor, doctor! People keep Ignoring me! [Doctor] Next patient, please.',
4493 'Why did the sperm cross the road? I accidently put on the wrong sock.',
4494 'I\'m guaranteed to shag the missus up the arse tonight. She\'s dyslexic and thinks it\'s Vaseline Day.',
4495 'You can\'t spell "therapist" without "rapist".',
4496 '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!
4497 var randomNumber = Math.floor(Math.random() * textArray.length);
4498 sendChat(textArray[randomNumber]);
4499
4500
4501 //Music theory by Logan
4502 //It's not very optimised and takes up way too much space. I'm not sure how to make it more compact.
4503 //chords
4504 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"music theory" || cmd == cmdChar+"mt") { //music theory command
4505 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!!]");
4506
4507 } else if (cmd == cmdChar+"chords") { //Chords
4508 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!!]");
4509
4510 } else if (cmd == cmdChar+"cmajor") { //C major
4511 sendChat("A major triad is a chord having a root, a major third, and a perfect fifth.");
4512 sendChat("C major triad PC notes - etu");
4513 {setTimeout(function() { press("c2"); press("e2"); press("g2") }, 0);}
4514 {setTimeout(function() { press("c2"); press("e2"); press("g2") }, 3000);}
4515 {setTimeout(function() { press("c2")}, 5000);}
4516 {setTimeout(function() { press("e2")}, 6000);}
4517 {setTimeout(function() { press("g2")}, 7000);}
4518
4519
4520 } else if (cmd == cmdChar+"cdom7") { //C Dominant seventh
4521 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.");
4522 sendChat("C7 PC notes - etu9");
4523 {setTimeout(function() { press("c2"); press("e2"); press("g2"); press("as2") }, 0);}
4524 {setTimeout(function() { press("c2"); press("e2"); press("g2"); press("as2") }, 3000);}
4525 {setTimeout(function() { press("c2")}, 5000);}
4526 {setTimeout(function() { press("e2")}, 6000);}
4527 {setTimeout(function() { press("g2")}, 7000);}
4528 {setTimeout(function() { press("as2")}, 8000);}
4529
4530 } else if (cmd == cmdChar+"cdom7sus4") { //C Dominant seventh suspended 4th
4531 sendChat("A dominant seventh suspended 4th chord is a chord composed of a root, perfect fourth, perfect fifth, and minor seventh.");
4532 sendChat("C7(sus) PC notes - eyu9");
4533 {setTimeout(function() { press("c2"); press("f2"); press("g2"); press("as2") }, 0);}
4534 {setTimeout(function() { press("c2"); press("f2"); press("g2"); press("as2") }, 3000);}
4535 {setTimeout(function() { press("c2")}, 5000);}
4536 {setTimeout(function() { press("f2")}, 6000);}
4537 {setTimeout(function() { press("g2")}, 7000);}
4538 {setTimeout(function() { press("as2")}, 8000);}
4539
4540 } else if (cmd == cmdChar+"cmaj7") { //C major seventh
4541 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).");
4542 sendChat("Cmaj7 PC notes - etuo");
4543 {setTimeout(function() { press("c2"); press("e2"); press("g2"); press("b2") }, 0);}
4544 {setTimeout(function() { press("c2"); press("e2"); press("g2"); press("b2") }, 3000);}
4545 {setTimeout(function() { press("c2")}, 5000);}
4546 {setTimeout(function() { press("e2")}, 6000);}
4547 {setTimeout(function() { press("g2")}, 7000);}
4548 {setTimeout(function() { press("b2")}, 8000);}
4549
4550 } else if (cmd == cmdChar+"cminor") { //C minor
4551 sendChat("A minor triad is a chord having a root, a minor third, and a perfect fifth.");
4552 sendChat("C minor triad PC notes - e5u");
4553 {setTimeout(function() { press("c2"); press("ds2"); press("g2") }, 0);}
4554 {setTimeout(function() { press("c2"); press("ds2"); press("g2") }, 3000);}
4555 {setTimeout(function() { press("c2")}, 5000);}
4556 {setTimeout(function() { press("ds2")}, 6000);}
4557 {setTimeout(function() { press("g2")}, 7000);}
4558
4559 } else if (cmd == cmdChar+"cmin7") { //C minor seventh
4560 sendChat("A minor seventh chord is any non-dominant seventh chord where the \"third\" note is a minor third above the root.");
4561 sendChat("Cmin7 PC notes - e5u9");
4562 {setTimeout(function() { press("c2"); press("ds2"); press("g2"); press("as2") }, 0);}
4563 {setTimeout(function() { press("c2"); press("ds2"); press("g2"); press("as2") }, 3000);}
4564 {setTimeout(function() { press("c2")}, 5000);}
4565 {setTimeout(function() { press("ds2")}, 6000);}
4566 {setTimeout(function() { press("g2")}, 7000);}
4567 {setTimeout(function() { press("as2")}, 8000);}
4568
4569 } else if (cmd == cmdChar+"cminmaj") { //C minor major seventh
4570 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");
4571 sendChat("Cminmaj PC notes - e5uo");
4572 {setTimeout(function() { press("c2"); press("ds2"); press("g2"); press("b2") }, 0);}
4573 {setTimeout(function() { press("c2"); press("ds2"); press("g2"); press("b2") }, 3000);}
4574 {setTimeout(function() { press("c2")}, 5000);}
4575 {setTimeout(function() { press("ds2")}, 6000);}
4576 {setTimeout(function() { press("g2")}, 7000);}
4577 {setTimeout(function() { press("b2")}, 8000);}
4578
4579 } else if (cmd == cmdChar+"cdim") { //C diminished
4580 sendChat("A diminished triad is a triad consisting of two minor thirds above the root.");
4581 sendChat("C diminished triad PC notes - e57");
4582 {setTimeout(function() { press("c2"); press("ds2"); press("fs2") }, 0);}
4583 {setTimeout(function() { press("c2"); press("ds2"); press("fs2") }, 3000);}
4584 {setTimeout(function() { press("c2")}, 5000);}
4585 {setTimeout(function() { press("ds2")}, 6000);}
4586 {setTimeout(function() { press("fs2")}, 7000);}
4587
4588 } else if (cmd == cmdChar+"cdim7") { //C diminished seventh
4589 sendChat("A diminished seventh is an interval produced by narrowing a minor seventh by a chromatic semitone.");
4590 sendChat("Cdim7 PC notes - e57i (this is my favourite chord)");
4591 {setTimeout(function() { press("c2"); press("ds2"); press("fs2"); press("a2") }, 0);}
4592 {setTimeout(function() { press("c2"); press("ds2"); press("fs2"); press("a2") }, 3000);}
4593 {setTimeout(function() { press("c2")}, 5000);}
4594 {setTimeout(function() { press("ds2")}, 6000);}
4595 {setTimeout(function() { press("fs2")}, 7000);}
4596 {setTimeout(function() { press("a2")}, 8000);}
4597
4598 } else if (cmd == cmdChar+"chalfdim") { //C half diminished
4599 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.");
4600 sendChat("Chalfdim PC notes - e579");
4601 {setTimeout(function() { press("c2"); press("ds2"); press("fs2"); press("as2") }, 0);}
4602 {setTimeout(function() { press("c2"); press("ds2"); press("fs2"); press("as2") }, 3000);}
4603 {setTimeout(function() { press("c2")}, 5000);}
4604 {setTimeout(function() { press("ds2")}, 6000);}
4605 {setTimeout(function() { press("fs2")}, 7000);}
4606 {setTimeout(function() { press("as2")}, 8000);}
4607
4608
4609 } else if (cmd == cmdChar+"caug") { //C Augmented
4610 sendChat("An augmented triad is a triad, or chord, consisting of two major thirds (an augmented fifth).");
4611 sendChat("C augmented triad PC notes - et8 (second favourite chord)");
4612 {setTimeout(function() { press("c2"); press("e2"); press("gs2") }, 0);}
4613 {setTimeout(function() { press("c2"); press("e2"); press("gs2") }, 3000);}
4614 {setTimeout(function() { press("c2")}, 5000);}
4615 {setTimeout(function() { press("e2")}, 6000);}
4616 {setTimeout(function() { press("gs2")}, 7000);}
4617
4618 } else if (cmd == cmdChar+"caug7") { //C Augmented seventh
4619 sendChat("An augmented seventh chord is a dominant seventh chord consisting of an augmented triad with a minor seventh.");
4620 sendChat("Caug7 PC notes - et89");
4621 {setTimeout(function() { press("c2"); press("e2"); press("gs2"); press("as2") }, 0);}
4622 {setTimeout(function() { press("c2"); press("e2"); press("gs2"); press("as2") }, 3000);}
4623 {setTimeout(function() { press("c2")}, 5000);}
4624 {setTimeout(function() { press("e2")}, 6000);}
4625 {setTimeout(function() { press("gs2")}, 7000);}
4626 {setTimeout(function() { press("as2")}, 8000);}
4627
4628 } else if (cmd == cmdChar+"caugmaj7") { //C Augmented major seventh
4629 sendChat("An augmented major seventh chord is a nondominant seventh chord and is associated with the augmented scale.");
4630 sendChat("Caugmaj7 PC notes - et8o");
4631 {setTimeout(function() { press("c2"); press("e2"); press("gs2"); press("b2") }, 0);}
4632 {setTimeout(function() { press("c2"); press("e2"); press("gs2"); press("b2") }, 3000);}
4633 {setTimeout(function() { press("c2")}, 5000);}
4634 {setTimeout(function() { press("e2")}, 6000);}
4635 {setTimeout(function() { press("gs2")}, 7000);}
4636 {setTimeout(function() { press("b2")}, 8000);}
4637
4638 } else if (cmd == cmdChar+"csus2") { //C suspended second
4639 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.");
4640 sendChat("Csus2 PC notes - eru");
4641 {setTimeout(function() { press("c2"); press("d2"); press("g2") }, 0);}
4642 {setTimeout(function() { press("c2"); press("d2"); press("g2") }, 3000);}
4643 {setTimeout(function() { press("c2")}, 5000);}
4644 {setTimeout(function() { press("d2")}, 6000);}
4645 {setTimeout(function() { press("g2")}, 7000);}
4646
4647 } else if (cmd == cmdChar+"csus4") { //C suspended fourth
4648 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.");
4649 sendChat("Csus PC notes - eyu");
4650 {setTimeout(function() { press("c2"); press("f2"); press("g2") }, 0);}
4651 {setTimeout(function() { press("c2"); press("f2"); press("g2") }, 3000);}
4652 {setTimeout(function() { press("c2")}, 5000);}
4653 {setTimeout(function() { press("f2")}, 6000);}
4654 {setTimeout(function() { press("g2")}, 7000);}
4655 //chords
4656
4657 //scales
4658 } else if (cmd == cmdChar+"scales") { //Scales
4659 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");
4660
4661 } else if (cmd == cmdChar+"scales2") { //Scales 2
4662 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");
4663
4664 //C scales
4665 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"scale cmajor") { //C major scale
4666 sendChat("The C major scale - it has no flats or sharps - its relative minor is A");
4667 sendChat("The C major PC notes - e r t y u i o p");
4668 {setTimeout(function() { press("c2")}, 0);}
4669 {setTimeout(function() { press("d2")}, 250);}
4670 {setTimeout(function() { press("e2")}, 500);}
4671 {setTimeout(function() { press("f2")}, 750);}
4672 {setTimeout(function() { press("g2")}, 1000);}
4673 {setTimeout(function() { press("a2")}, 1250);}
4674 {setTimeout(function() { press("b2")}, 1500);}
4675 {setTimeout(function() { press("c3")}, 1750);}
4676 {setTimeout(function() { press("b2")}, 2000);}
4677 {setTimeout(function() { press("a2")}, 2250);}
4678 {setTimeout(function() { press("g2")}, 2500);}
4679 {setTimeout(function() { press("f2")}, 2750);}
4680 {setTimeout(function() { press("e2")}, 3000);}
4681 {setTimeout(function() { press("d2")}, 3250);}
4682 {setTimeout(function() { press("c2")}, 3500);}
4683 {setTimeout(function() { press("c2"); press("e2"); press("g2"); press("c3")}, 4000);}
4684
4685 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"scale cminor") { //C minor scale
4686 sendChat("The C minor scale - it has 3 flats - its relative major is Eb");
4687 sendChat("The C minor PC notes - e r 5 y u 8 9 p");
4688 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"]];
4689 var playID = 0;
4690
4691 function playMisc(arr){
4692 //if(playID != 0){clearInterval(playID);}
4693 if(playID != 0) {clearTimeout(playID);playID=0}
4694 var pNum = 0;
4695 var f = function () {
4696 for(var p=1; p<arr[pNum].length; p++){
4697 MPP.press(arr[pNum][p]);
4698 }
4699 if(++pNum >= arr.length) {clearTimeout(playID);playID=0;return;}
4700 setTimeout(f,arr[pNum][0]);
4701 }
4702 setTimeout(f,arr[pNum][0]);
4703 }
4704
4705 //test Play
4706 playMisc(scale_cminor);
4707
4708 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale charminor") { //C harmonic minor scale
4709 sendChat("The C harmonic minor scale - it has 2 flats - it has a major 7th (B)");
4710 sendChat("The C harmonic minor PC notes - e r 5 y u 8 o p");
4711 {setTimeout(function() { press("c2")}, 0);}
4712 {setTimeout(function() { press("d2")}, 250);}
4713 {setTimeout(function() { press("ds2")}, 500);}
4714 {setTimeout(function() { press("f2")}, 750);}
4715 {setTimeout(function() { press("g2")}, 1000);}
4716 {setTimeout(function() { press("gs2")}, 1250);}
4717 {setTimeout(function() { press("b2")}, 1500);}
4718 {setTimeout(function() { press("c3")}, 1750);}
4719 {setTimeout(function() { press("b2")}, 2000);}
4720 {setTimeout(function() { press("gs2")}, 2250);}
4721 {setTimeout(function() { press("g2")}, 2500);}
4722 {setTimeout(function() { press("f2")}, 2750);}
4723 {setTimeout(function() { press("ds2")}, 3000);}
4724 {setTimeout(function() { press("d2")}, 3250);}
4725 {setTimeout(function() { press("c2")}, 3500);}
4726 {setTimeout(function() { press("c2"); press("ds2"); press("g2"); press("c3")}, 4000);}
4727
4728 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale cmelminor") { //C melodic minor scale
4729 sendChat("The C melodic minor scale - it has 1 flat ascending and 3 flats descending - it has two patterns ascending and descending.");
4730 sendChat("The C melodic minor PC notes - e r 5 y u i o p 9 8 u y 5 r e");
4731 {setTimeout(function() { press("c2")}, 0);}
4732 {setTimeout(function() { press("d2")}, 250);}
4733 {setTimeout(function() { press("ds2")}, 500);}
4734 {setTimeout(function() { press("f2")}, 750);}
4735 {setTimeout(function() { press("g2")}, 1000);}
4736 {setTimeout(function() { press("a2")}, 1250);}
4737 {setTimeout(function() { press("b2")}, 1500);}
4738 {setTimeout(function() { press("c3")}, 1750);}
4739 {setTimeout(function() { press("as2")}, 2000);}
4740 {setTimeout(function() { press("gs2")}, 2250);}
4741 {setTimeout(function() { press("g2")}, 2500);}
4742 {setTimeout(function() { press("f2")}, 2750);}
4743 {setTimeout(function() { press("ds2")}, 3000);}
4744 {setTimeout(function() { press("d2")}, 3250);}
4745 {setTimeout(function() { press("c2")}, 3500);}
4746 {setTimeout(function() { press("c2"); press("ds2"); press("g2"); press("c3")}, 4000);}
4747 //C scales
4748
4749 //C# scales
4750 } else if (message.substring(0, 14).toLowerCase() == cmdChar+"scale csmajor") { //C# major scale
4751 sendChat("The C# (sharp) major scale - it has 7 sharps - its relative minor is A#");
4752 sendChat("The C# (sharp) major PC notes - 4 5 y 7 8 9 p -");
4753 {setTimeout(function() { press("cs2")}, 0);}
4754 {setTimeout(function() { press("ds2")}, 250);}
4755 {setTimeout(function() { press("f2")}, 500);}
4756 {setTimeout(function() { press("fs2")}, 750);}
4757 {setTimeout(function() { press("gs2")}, 1000);}
4758 {setTimeout(function() { press("as2")}, 1250);}
4759 {setTimeout(function() { press("c3")}, 1500);}
4760 {setTimeout(function() { press("cs3")}, 1750);}
4761 {setTimeout(function() { press("c3")}, 2000);}
4762 {setTimeout(function() { press("as2")}, 2250);}
4763 {setTimeout(function() { press("gs2")}, 2500);}
4764 {setTimeout(function() { press("fs2")}, 2750);}
4765 {setTimeout(function() { press("f2")}, 3000);}
4766 {setTimeout(function() { press("ds2")}, 3250);}
4767 {setTimeout(function() { press("cs2")}, 3500);}
4768 {setTimeout(function() { press("cs2"); press("f2"); press("gs2"); press("cs3")}, 4000);}
4769
4770 } else if (message.substring(0, 14).toLowerCase() == cmdChar+"scale csminor") { //C# minor scale
4771 sendChat("The C# (sharp) minor scale - it has 4 sharps - its relative major is E");
4772 sendChat("The C# (sharp) major PC notes - f g b j k q . 4");
4773 {setTimeout(function() { press("cs2")}, 0);}
4774 {setTimeout(function() { press("ds2")}, 250);}
4775 {setTimeout(function() { press("e2")}, 500);}
4776 {setTimeout(function() { press("fs2")}, 750);}
4777 {setTimeout(function() { press("gs2")}, 1000);}
4778 {setTimeout(function() { press("a2")}, 1250);}
4779 {setTimeout(function() { press("b2")}, 1500);}
4780 {setTimeout(function() { press("cs3")}, 1750);}
4781 {setTimeout(function() { press("b2")}, 2000);}
4782 {setTimeout(function() { press("a2")}, 2250);}
4783 {setTimeout(function() { press("gs2")}, 2500);}
4784 {setTimeout(function() { press("fs2")}, 2750);}
4785 {setTimeout(function() { press("e2")}, 3000);}
4786 {setTimeout(function() { press("ds2")}, 3250);}
4787 {setTimeout(function() { press("cs2")}, 3500);}
4788 {setTimeout(function() { press("cs2"); press("e2"); press("gs2"); press("cs3")}, 4000);}
4789
4790 } else if (message.substring(0, 17).toLowerCase() == cmdChar+"scale csharminor") { //C# harmonic minor scale
4791 sendChat("The C# (sharp) harmonic minor scale - it has 2 flats - it has a major 7th (C)");
4792 sendChat("The C# (sharp) harmonic minor PC notes - 4 5 t 7 8 i p -");
4793 {setTimeout(function() { press("cs2")}, 0);}
4794 {setTimeout(function() { press("ds2")}, 250);}
4795 {setTimeout(function() { press("e2")}, 500);}
4796 {setTimeout(function() { press("fs2")}, 750);}
4797 {setTimeout(function() { press("gs2")}, 1000);}
4798 {setTimeout(function() { press("a2")}, 1250);}
4799 {setTimeout(function() { press("c3")}, 1500);}
4800 {setTimeout(function() { press("cs3")}, 1750);}
4801 {setTimeout(function() { press("c3")}, 2000);}
4802 {setTimeout(function() { press("a2")}, 2250);}
4803 {setTimeout(function() { press("gs2")}, 2500);}
4804 {setTimeout(function() { press("fs2")}, 2750);}
4805 {setTimeout(function() { press("e2")}, 3000);}
4806 {setTimeout(function() { press("ds2")}, 3250);}
4807 {setTimeout(function() { press("cs2")}, 3500);}
4808 {setTimeout(function() { press("cs2"); press("e2"); press("gs2"); press("cs3")}, 4000);}
4809
4810 } else if (message.substring(0, 17).toLowerCase() == cmdChar+"scale csmelminor") { //C# melodic minor scale
4811 sendChat("The C# (sharp) melodic minor scale - it has 7 sharps ascending and 5 sharps descending - it has two patterns ascending and descending.");
4812 sendChat("The C# (sharp) melodic minor PC notes - 4 5 t 7 8 9 p - o i 8 7 t 5 4");
4813 {setTimeout(function() { press("cs2")}, 0);}
4814 {setTimeout(function() { press("ds2")}, 250);}
4815 {setTimeout(function() { press("e2")}, 500);}
4816 {setTimeout(function() { press("fs2")}, 750);}
4817 {setTimeout(function() { press("gs2")}, 1000);}
4818 {setTimeout(function() { press("as2")}, 1250);}
4819 {setTimeout(function() { press("c3")}, 1500);}
4820 {setTimeout(function() { press("cs3")}, 1750);}
4821 {setTimeout(function() { press("b2")}, 2000);}
4822 {setTimeout(function() { press("a2")}, 2250);}
4823 {setTimeout(function() { press("gs2")}, 2500);}
4824 {setTimeout(function() { press("fs2")}, 2750);}
4825 {setTimeout(function() { press("e2")}, 3000);}
4826 {setTimeout(function() { press("ds2")}, 3250);}
4827 {setTimeout(function() { press("cs2")}, 3500);}
4828 {setTimeout(function() { press("cs2"); press("e2"); press("gs2"); press("cs3")}, 4000);}
4829 //C# scales
4830
4831 //D scales
4832 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"scale dmajor") { //D major scale
4833 sendChat("The D major scale - it has 2 sharps - its relative minor is B");
4834 sendChat("The D major scale PC notes - r t 7 u i o - [");
4835 {setTimeout(function() { press("d2")}, 0);}
4836 {setTimeout(function() { press("e2")}, 250);}
4837 {setTimeout(function() { press("fs2")}, 500);}
4838 {setTimeout(function() { press("g2")}, 750);}
4839 {setTimeout(function() { press("a2")}, 1000);}
4840 {setTimeout(function() { press("b2")}, 1250);}
4841 {setTimeout(function() { press("cs3")}, 1500);}
4842 {setTimeout(function() { press("d3")}, 1750);}
4843 {setTimeout(function() { press("cs3")}, 2000);}
4844 {setTimeout(function() { press("b2")}, 2250);}
4845 {setTimeout(function() { press("a2")}, 2500);}
4846 {setTimeout(function() { press("g2")}, 2750);}
4847 {setTimeout(function() { press("fs2")}, 3000);}
4848 {setTimeout(function() { press("e2")}, 3250);}
4849 {setTimeout(function() { press("d2")}, 3500);}
4850 {setTimeout(function() { press("d2"); press("fs2"); press("a2"); press("d3")}, 4000);}
4851
4852 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"scale dminor") { //D minor scale
4853 sendChat("The D minor scale - it has 2 sharps - its relative major is F");
4854 sendChat("The D minor scale PC notes - r t 7 u i o - [");
4855 {setTimeout(function() { press("d2")}, 0);}
4856 {setTimeout(function() { press("e2")}, 250);}
4857 {setTimeout(function() { press("f2")}, 500);}
4858 {setTimeout(function() { press("g2")}, 750);}
4859 {setTimeout(function() { press("a2")}, 1000);}
4860 {setTimeout(function() { press("as2")}, 1250);}
4861 {setTimeout(function() { press("c3")}, 1500);}
4862 {setTimeout(function() { press("d3")}, 1750);}
4863 {setTimeout(function() { press("c3")}, 2000);}
4864 {setTimeout(function() { press("as2")}, 2250);}
4865 {setTimeout(function() { press("a2")}, 2500);}
4866 {setTimeout(function() { press("g2")}, 2750);}
4867 {setTimeout(function() { press("f2")}, 3000);}
4868 {setTimeout(function() { press("e2")}, 3250);}
4869 {setTimeout(function() { press("d2")}, 3500);}
4870 {setTimeout(function() { press("d2"); press("f2"); press("a2"); press("d3")}, 4000);}
4871
4872 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale dharminor") { //D harmonic minor scale
4873 sendChat("The D harmonic minor scale - it has 2 sharps - it has a major 7th (C#)");
4874 {setTimeout(function() { press("d2")}, 0);}
4875 {setTimeout(function() { press("e2")}, 250);}
4876 {setTimeout(function() { press("f2")}, 500);}
4877 {setTimeout(function() { press("g2")}, 750);}
4878 {setTimeout(function() { press("a2")}, 1000);}
4879 {setTimeout(function() { press("as2")}, 1250);}
4880 {setTimeout(function() { press("cs3")}, 1500);}
4881 {setTimeout(function() { press("d3")}, 1750);}
4882 {setTimeout(function() { press("cs3")}, 2000);}
4883 {setTimeout(function() { press("as2")}, 2250);}
4884 {setTimeout(function() { press("a2")}, 2500);}
4885 {setTimeout(function() { press("g2")}, 2750);}
4886 {setTimeout(function() { press("f2")}, 3000);}
4887 {setTimeout(function() { press("e2")}, 3250);}
4888 {setTimeout(function() { press("d2")}, 3500);}
4889 {setTimeout(function() { press("d2"); press("f2"); press("a2"); press("d3")}, 4000);}
4890
4891 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale dmelminor") { //D melodic minor scale
4892 sendChat("The D melodic minor scale - it has 1 flat ascending and 3 flats descending - it has two patterns ascending and descending.");
4893 {setTimeout(function() { press("d2")}, 0);}
4894 {setTimeout(function() { press("e2")}, 250);}
4895 {setTimeout(function() { press("f2")}, 500);}
4896 {setTimeout(function() { press("g2")}, 750);}
4897 {setTimeout(function() { press("a2")}, 1000);}
4898 {setTimeout(function() { press("b2")}, 1250);}
4899 {setTimeout(function() { press("cs3")}, 1500);}
4900 {setTimeout(function() { press("d3")}, 1750);}
4901 {setTimeout(function() { press("c3")}, 2000);}
4902 {setTimeout(function() { press("as2")}, 2250);}
4903 {setTimeout(function() { press("a2")}, 2500);}
4904 {setTimeout(function() { press("g2")}, 2750);}
4905 {setTimeout(function() { press("f2")}, 3000);}
4906 {setTimeout(function() { press("e2")}, 3250);}
4907 {setTimeout(function() { press("d2")}, 3500);}
4908 {setTimeout(function() { press("d2"); press("f2"); press("a2"); press("d3")}, 4000);}
4909 //D scales
4910
4911 //Eb scales
4912 } else if (message.substring(0, 14).toLowerCase() == cmdChar+"scale ebmajor") { //Eb major scale
4913 sendChat("The Eb (flat) major scale - it has 3 flats - its relative minor is C");
4914 {setTimeout(function() { press("ds2")}, 0);}
4915 {setTimeout(function() { press("f2")}, 250);}
4916 {setTimeout(function() { press("g2")}, 500);}
4917 {setTimeout(function() { press("gs2")}, 750);}
4918 {setTimeout(function() { press("as2")}, 1000);}
4919 {setTimeout(function() { press("c3")}, 1250);}
4920 {setTimeout(function() { press("d3")}, 1500);}
4921 {setTimeout(function() { press("ds3")}, 1750);}
4922 {setTimeout(function() { press("d3")}, 2000);}
4923 {setTimeout(function() { press("c3")}, 2250);}
4924 {setTimeout(function() { press("as2")}, 2500);}
4925 {setTimeout(function() { press("gs2")}, 2750);}
4926 {setTimeout(function() { press("g2")}, 3000);}
4927 {setTimeout(function() { press("f2")}, 3250);}
4928 {setTimeout(function() { press("ds2")}, 3500);}
4929 {setTimeout(function() { press("ds2"); press("g2"); press("as2"); press("ds3")}, 4000);}
4930
4931 } else if (message.substring(0, 14).toLowerCase() == cmdChar+"scale ebminor") { //Eb minor scale
4932 sendChat("The Eb (flat) minor scale - it has 6 flats - its relative major is Gb");
4933 {setTimeout(function() { press("ds2")}, 0);}
4934 {setTimeout(function() { press("f2")}, 250);}
4935 {setTimeout(function() { press("fs2")}, 500);}
4936 {setTimeout(function() { press("gs2")}, 750);}
4937 {setTimeout(function() { press("as2")}, 1000);}
4938 {setTimeout(function() { press("b2")}, 1250);}
4939 {setTimeout(function() { press("cs3")}, 1500);}
4940 {setTimeout(function() { press("ds3")}, 1750);}
4941 {setTimeout(function() { press("cs3")}, 2000);}
4942 {setTimeout(function() { press("b2")}, 2250);}
4943 {setTimeout(function() { press("as2")}, 2500);}
4944 {setTimeout(function() { press("gs2")}, 2750);}
4945 {setTimeout(function() { press("fs2")}, 3000);}
4946 {setTimeout(function() { press("f2")}, 3250);}
4947 {setTimeout(function() { press("ds2")}, 3500);}
4948 {setTimeout(function() { press("ds2"); press("fs2"); press("as2"); press("ds3")}, 4000);}
4949
4950 } else if (message.substring(0, 17).toLowerCase() == cmdChar+"scale ebharminor") { //Eb harmonic minor scale
4951 sendChat("The Eb (flat) harmonic minor scale - it has 5 flats - it has a major 7th (D)");
4952 {setTimeout(function() { press("ds2")}, 0);}
4953 {setTimeout(function() { press("f2")}, 250);}
4954 {setTimeout(function() { press("fs2")}, 500);}
4955 {setTimeout(function() { press("gs2")}, 750);}
4956 {setTimeout(function() { press("as2")}, 1000);}
4957 {setTimeout(function() { press("b2")}, 1250);}
4958 {setTimeout(function() { press("d3")}, 1500);}
4959 {setTimeout(function() { press("ds3")}, 1750);}
4960 {setTimeout(function() { press("d3")}, 2000);}
4961 {setTimeout(function() { press("b2")}, 2250);}
4962 {setTimeout(function() { press("as2")}, 2500);}
4963 {setTimeout(function() { press("gs2")}, 2750);}
4964 {setTimeout(function() { press("fs2")}, 3000);}
4965 {setTimeout(function() { press("f2")}, 3250);}
4966 {setTimeout(function() { press("ds2")}, 3500);}
4967 {setTimeout(function() { press("ds2"); press("fs2"); press("as2"); press("ds3")}, 4000);}
4968
4969 } else if (message.substring(0, 17).toLowerCase() == cmdChar+"scale ebmelminor") { //Eb melodic minor scale
4970 sendChat("The Eb (flat) melodic minor scale - it has 5 flats ascending and 6 flats descending - it has two patterns ascending and descending.");
4971 {setTimeout(function() { press("ds2")}, 0);}
4972 {setTimeout(function() { press("f2")}, 250);}
4973 {setTimeout(function() { press("fs2")}, 500);}
4974 {setTimeout(function() { press("gs2")}, 750);}
4975 {setTimeout(function() { press("as2")}, 1000);}
4976 {setTimeout(function() { press("c3")}, 1250);}
4977 {setTimeout(function() { press("d3")}, 1500);}
4978 {setTimeout(function() { press("ds3")}, 1750);}
4979 {setTimeout(function() { press("cs3")}, 2000);}
4980 {setTimeout(function() { press("b2")}, 2250);}
4981 {setTimeout(function() { press("as2")}, 2500);}
4982 {setTimeout(function() { press("gs2")}, 2750);}
4983 {setTimeout(function() { press("fs2")}, 3000);}
4984 {setTimeout(function() { press("f2")}, 3250);}
4985 {setTimeout(function() { press("ds2")}, 3500);}
4986 {setTimeout(function() { press("ds2"); press("fs2"); press("as2"); press("ds3")}, 4000);}
4987 //Eb scales
4988
4989 //E scales
4990 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"scale emajor") { //E major scale
4991 sendChat("The E major scale - it has 4 sharps - its relative minor is C#");
4992 {setTimeout(function() { press("e2")}, 0);}
4993 {setTimeout(function() { press("fs2")}, 250);}
4994 {setTimeout(function() { press("gs2")}, 500);}
4995 {setTimeout(function() { press("a2")}, 750);}
4996 {setTimeout(function() { press("b2")}, 1000);}
4997 {setTimeout(function() { press("cs3")}, 1250);}
4998 {setTimeout(function() { press("ds3")}, 1500);}
4999 {setTimeout(function() { press("e3")}, 1750);}
5000 {setTimeout(function() { press("ds3")}, 2000);}
5001 {setTimeout(function() { press("cs3")}, 2250);}
5002 {setTimeout(function() { press("b2")}, 2500);}
5003 {setTimeout(function() { press("a2")}, 2750);}
5004 {setTimeout(function() { press("gs2")}, 3000);}
5005 {setTimeout(function() { press("fs2")}, 3250);}
5006 {setTimeout(function() { press("e2")}, 3500);}
5007 {setTimeout(function() { press("e2"); press("gs2"); press("b2"); press("e3")}, 4000);}
5008
5009 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"scale eminor") { //E minor scale
5010 sendChat("The E minor scale - it has 1 sharp - its relative major is G");
5011 {setTimeout(function() { press("e2")}, 0);}
5012 {setTimeout(function() { press("fs2")}, 250);}
5013 {setTimeout(function() { press("g2")}, 500);}
5014 {setTimeout(function() { press("a2")}, 750);}
5015 {setTimeout(function() { press("b2")}, 1000);}
5016 {setTimeout(function() { press("c3")}, 1250);}
5017 {setTimeout(function() { press("d3")}, 1500);}
5018 {setTimeout(function() { press("e3")}, 1750);}
5019 {setTimeout(function() { press("d3")}, 2000);}
5020 {setTimeout(function() { press("c3")}, 2250);}
5021 {setTimeout(function() { press("b2")}, 2500);}
5022 {setTimeout(function() { press("a2")}, 2750);}
5023 {setTimeout(function() { press("g2")}, 3000);}
5024 {setTimeout(function() { press("fs2")}, 3250);}
5025 {setTimeout(function() { press("e2")}, 3500);}
5026 {setTimeout(function() { press("e2"); press("g2"); press("b2"); press("e3")}, 4000);}
5027
5028 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale eharminor") { //E harmonic minor scale
5029 sendChat("The E harmonic minor scale - it has 2 sharps - it has a major 7th (D#)");
5030 {setTimeout(function() { press("e2")}, 0);}
5031 {setTimeout(function() { press("fs2")}, 250);}
5032 {setTimeout(function() { press("g2")}, 500);}
5033 {setTimeout(function() { press("a2")}, 750);}
5034 {setTimeout(function() { press("b2")}, 1000);}
5035 {setTimeout(function() { press("c3")}, 1250);}
5036 {setTimeout(function() { press("ds3")}, 1500);}
5037 {setTimeout(function() { press("e3")}, 1750);}
5038 {setTimeout(function() { press("ds3")}, 2000);}
5039 {setTimeout(function() { press("c3")}, 2250);}
5040 {setTimeout(function() { press("b2")}, 2500);}
5041 {setTimeout(function() { press("a2")}, 2750);}
5042 {setTimeout(function() { press("g2")}, 3000);}
5043 {setTimeout(function() { press("fs2")}, 3250);}
5044 {setTimeout(function() { press("e2")}, 3500);}
5045 {setTimeout(function() { press("e2"); press("g2"); press("b2"); press("e3")}, 4000);}
5046
5047 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale emelminor") { //E melodic minor scale
5048 sendChat("The E melodic minor scale - it has 3 sharps ascending and 1 sharp descending - it has two patterns ascending and descending.");
5049 {setTimeout(function() { press("e2")}, 0);}
5050 {setTimeout(function() { press("fs2")}, 250);}
5051 {setTimeout(function() { press("g2")}, 500);}
5052 {setTimeout(function() { press("a2")}, 750);}
5053 {setTimeout(function() { press("b2")}, 1000);}
5054 {setTimeout(function() { press("cs3")}, 1250);}
5055 {setTimeout(function() { press("ds3")}, 1500);}
5056 {setTimeout(function() { press("e3")}, 1750);}
5057 {setTimeout(function() { press("d3")}, 2000);}
5058 {setTimeout(function() { press("c3")}, 2250);}
5059 {setTimeout(function() { press("b2")}, 2500);}
5060 {setTimeout(function() { press("a2")}, 2750);}
5061 {setTimeout(function() { press("g2")}, 3000);}
5062 {setTimeout(function() { press("fs2")}, 3250);}
5063 {setTimeout(function() { press("e2")}, 3500);}
5064 {setTimeout(function() { press("e2"); press("g2"); press("b2"); press("e3")}, 4000);}
5065 //E scales
5066
5067 //F scales
5068 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"scale fmajor") { //F major scale
5069 sendChat("The F major scale - it has 1 flat - its relative minor is D");
5070 {setTimeout(function() { press("f2")}, 0);}
5071 {setTimeout(function() { press("g2")}, 250);}
5072 {setTimeout(function() { press("a2")}, 500);}
5073 {setTimeout(function() { press("as2")}, 750);}
5074 {setTimeout(function() { press("c3")}, 1000);}
5075 {setTimeout(function() { press("d3")}, 1250);}
5076 {setTimeout(function() { press("e3")}, 1500);}
5077 {setTimeout(function() { press("f3")}, 1750);}
5078 {setTimeout(function() { press("e3")}, 2000);}
5079 {setTimeout(function() { press("d3")}, 2250);}
5080 {setTimeout(function() { press("c3")}, 2500);}
5081 {setTimeout(function() { press("as2")}, 2750);}
5082 {setTimeout(function() { press("a2")}, 3000);}
5083 {setTimeout(function() { press("g2")}, 3250);}
5084 {setTimeout(function() { press("f2")}, 3500);}
5085 {setTimeout(function() { press("f2"); press("a2"); press("c3"); press("f3")}, 4000);}
5086
5087 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"scale fminor") { //F minor scale
5088 sendChat("The F minor scale - it has 4 flats - its relative major is Ab");
5089 {setTimeout(function() { press("f2")}, 0);}
5090 {setTimeout(function() { press("g2")}, 250);}
5091 {setTimeout(function() { press("gs2")}, 500);}
5092 {setTimeout(function() { press("as2")}, 750);}
5093 {setTimeout(function() { press("c3")}, 1000);}
5094 {setTimeout(function() { press("cs3")}, 1250);}
5095 {setTimeout(function() { press("ds3")}, 1500);}
5096 {setTimeout(function() { press("f3")}, 1750);}
5097 {setTimeout(function() { press("ds3")}, 2000);}
5098 {setTimeout(function() { press("cs3")}, 2250);}
5099 {setTimeout(function() { press("c3")}, 2500);}
5100 {setTimeout(function() { press("as2")}, 2750);}
5101 {setTimeout(function() { press("gs2")}, 3000);}
5102 {setTimeout(function() { press("g2")}, 3250);}
5103 {setTimeout(function() { press("f2")}, 3500);}
5104 {setTimeout(function() { press("f2"); press("gs2"); press("c3"); press("f3")}, 4000);}
5105
5106 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale fharminor") { //F harmonic minor scale
5107 sendChat("The F harmonic minor scale - it has 3 flats - it has a major 7th (E)");
5108 {setTimeout(function() { press("f2")}, 0);}
5109 {setTimeout(function() { press("g2")}, 250);}
5110 {setTimeout(function() { press("gs2")}, 500);}
5111 {setTimeout(function() { press("as2")}, 750);}
5112 {setTimeout(function() { press("c3")}, 1000);}
5113 {setTimeout(function() { press("cs3")}, 1250);}
5114 {setTimeout(function() { press("e3")}, 1500);}
5115 {setTimeout(function() { press("f3")}, 1750);}
5116 {setTimeout(function() { press("e3")}, 2000);}
5117 {setTimeout(function() { press("cs3")}, 2250);}
5118 {setTimeout(function() { press("c3")}, 2500);}
5119 {setTimeout(function() { press("as2")}, 2750);}
5120 {setTimeout(function() { press("gs2")}, 3000);}
5121 {setTimeout(function() { press("g2")}, 3250);}
5122 {setTimeout(function() { press("f2")}, 3500);}
5123 {setTimeout(function() { press("f2"); press("gs2"); press("c3"); press("f3")}, 4000);}
5124
5125 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale fmelminor") { //F melodic minor scale
5126 sendChat("The F melodic minor scale - it has 2 flats ascending and 4 flats descending - it has two patterns ascending and descending.");
5127 {setTimeout(function() { press("f2")}, 0);}
5128 {setTimeout(function() { press("g2")}, 250);}
5129 {setTimeout(function() { press("gs2")}, 500);}
5130 {setTimeout(function() { press("as2")}, 750);}
5131 {setTimeout(function() { press("c3")}, 1000);}
5132 {setTimeout(function() { press("d3")}, 1250);}
5133 {setTimeout(function() { press("e3")}, 1500);}
5134 {setTimeout(function() { press("f3")}, 1750);}
5135 {setTimeout(function() { press("ds3")}, 2000);}
5136 {setTimeout(function() { press("cs3")}, 2250);}
5137 {setTimeout(function() { press("c3")}, 2500);}
5138 {setTimeout(function() { press("as2")}, 2750);}
5139 {setTimeout(function() { press("gs2")}, 3000);}
5140 {setTimeout(function() { press("g2")}, 3250);}
5141 {setTimeout(function() { press("f2")}, 3500);}
5142 {setTimeout(function() { press("f2"); press("gs2"); press("c3"); press("f3")}, 4000);}
5143 //F scales
5144
5145 //F# scales
5146 } else if (message.substring(0, 14).toLowerCase() == cmdChar+"scale fsmajor") { //F# major scale
5147 sendChat("The F# (sharp) major scale - it has 6 sharps - its relative minor is D#");
5148 {setTimeout(function() { press("fs2")}, 0);}
5149 {setTimeout(function() { press("gs2")}, 250);}
5150 {setTimeout(function() { press("as2")}, 500);}
5151 {setTimeout(function() { press("b2")}, 750);}
5152 {setTimeout(function() { press("cs3")}, 1000);}
5153 {setTimeout(function() { press("ds3")}, 1250);}
5154 {setTimeout(function() { press("f3")}, 1500);}
5155 {setTimeout(function() { press("fs3")}, 1750);}
5156 {setTimeout(function() { press("f3")}, 2000);}
5157 {setTimeout(function() { press("ds3")}, 2250);}
5158 {setTimeout(function() { press("cs3")}, 2500);}
5159 {setTimeout(function() { press("b2")}, 2750);}
5160 {setTimeout(function() { press("as2")}, 3000);}
5161 {setTimeout(function() { press("gs2")}, 3250);}
5162 {setTimeout(function() { press("fs2")}, 3500);}
5163 {setTimeout(function() { press("fs2"); press("as2"); press("cs3"); press("fs3")}, 4000);}
5164
5165 } else if (message.substring(0, 14).toLowerCase() == cmdChar+"scale fsminor") { //F# minor scale
5166 sendChat("The F# (sharp) minor scale - it has 3 sharps - its relative major is A");
5167 {setTimeout(function() { press("fs2")}, 0);}
5168 {setTimeout(function() { press("gs2")}, 250);}
5169 {setTimeout(function() { press("a2")}, 500);}
5170 {setTimeout(function() { press("b2")}, 750);}
5171 {setTimeout(function() { press("cs3")}, 1000);}
5172 {setTimeout(function() { press("d3")}, 1250);}
5173 {setTimeout(function() { press("e3")}, 1500);}
5174 {setTimeout(function() { press("fs3")}, 1750);}
5175 {setTimeout(function() { press("e3")}, 2000);}
5176 {setTimeout(function() { press("d3")}, 2250);}
5177 {setTimeout(function() { press("cs3")}, 2500);}
5178 {setTimeout(function() { press("b2")}, 2750);}
5179 {setTimeout(function() { press("a2")}, 3000);}
5180 {setTimeout(function() { press("gs2")}, 3250);}
5181 {setTimeout(function() { press("fs2")}, 3500);}
5182 {setTimeout(function() { press("fs2"); press("a2"); press("cs3"); press("fs3")}, 4000);}
5183
5184 } else if (message.substring(0, 17).toLowerCase() == cmdChar+"scale fsharminor") { //F# harmonic minor scale
5185 sendChat("The F# (sharp) harmonic minor scale - it has 4 sharps - it has a major 7th (E#)");
5186 {setTimeout(function() { press("fs2")}, 0);}
5187 {setTimeout(function() { press("gs2")}, 250);}
5188 {setTimeout(function() { press("a2")}, 500);}
5189 {setTimeout(function() { press("b2")}, 750);}
5190 {setTimeout(function() { press("cs3")}, 1000);}
5191 {setTimeout(function() { press("d3")}, 1250);}
5192 {setTimeout(function() { press("f3")}, 1500);}
5193 {setTimeout(function() { press("fs3")}, 1750);}
5194 {setTimeout(function() { press("f3")}, 2000);}
5195 {setTimeout(function() { press("d3")}, 2250);}
5196 {setTimeout(function() { press("cs3")}, 2500);}
5197 {setTimeout(function() { press("b2")}, 2750);}
5198 {setTimeout(function() { press("a2")}, 3000);}
5199 {setTimeout(function() { press("gs2")}, 3250);}
5200 {setTimeout(function() { press("fs2")}, 3500);}
5201 {setTimeout(function() { press("fs2"); press("a2"); press("cs3"); press("fs3")}, 4000);}
5202
5203 } else if (message.substring(0, 17).toLowerCase() == cmdChar+"scale fsmelminor") { //F# melodic minor scale
5204 sendChat("The F# (sharp) melodic minor scale - it has 5 sharps ascending and 3 sharps descending - it has two patterns ascending and descending.");
5205 {setTimeout(function() { press("fs2")}, 0);}
5206 {setTimeout(function() { press("gs2")}, 250);}
5207 {setTimeout(function() { press("a2")}, 500);}
5208 {setTimeout(function() { press("b2")}, 750);}
5209 {setTimeout(function() { press("cs3")}, 1000);}
5210 {setTimeout(function() { press("ds3")}, 1250);}
5211 {setTimeout(function() { press("f3")}, 1500);}
5212 {setTimeout(function() { press("fs3")}, 1750);}
5213 {setTimeout(function() { press("e3")}, 2000);}
5214 {setTimeout(function() { press("d3")}, 2250);}
5215 {setTimeout(function() { press("cs3")}, 2500);}
5216 {setTimeout(function() { press("b2")}, 2750);}
5217 {setTimeout(function() { press("a2")}, 3000);}
5218 {setTimeout(function() { press("gs2")}, 3250);}
5219 {setTimeout(function() { press("fs2")}, 3500);}
5220 {setTimeout(function() { press("fs2"); press("a2"); press("cs3"); press("fs3")}, 4000);}
5221 //F# scales
5222
5223 //G scales
5224 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"scale gmajor") { //G major scale
5225 sendChat("The G major scale - it has 1 sharp - its relative minor is E");
5226 {setTimeout(function() { press("g2")}, 0);}
5227 {setTimeout(function() { press("a2")}, 250);}
5228 {setTimeout(function() { press("b2")}, 500);}
5229 {setTimeout(function() { press("c3")}, 750);}
5230 {setTimeout(function() { press("d3")}, 1000);}
5231 {setTimeout(function() { press("e3")}, 1250);}
5232 {setTimeout(function() { press("fs3")}, 1500);}
5233 {setTimeout(function() { press("g3")}, 1750);}
5234 {setTimeout(function() { press("fs3")}, 2000);}
5235 {setTimeout(function() { press("e3")}, 2250);}
5236 {setTimeout(function() { press("d3")}, 2500);}
5237 {setTimeout(function() { press("c3")}, 2750);}
5238 {setTimeout(function() { press("b2")}, 3000);}
5239 {setTimeout(function() { press("a2")}, 3250);}
5240 {setTimeout(function() { press("g2")}, 3500);}
5241 {setTimeout(function() { press("g2"); press("b2"); press("d3"); press("g3")}, 4000);}
5242
5243 } else if (message.substring(0, 14).toLowerCase() == cmdChar+"scale gminor") { //G minor scale
5244 sendChat("The G minor scale - it has 1 sharps - its relative major is Bb");
5245 {setTimeout(function() { press("g2")}, 0);}
5246 {setTimeout(function() { press("a2")}, 250);}
5247 {setTimeout(function() { press("as2")}, 500);}
5248 {setTimeout(function() { press("c3")}, 750);}
5249 {setTimeout(function() { press("d3")}, 1000);}
5250 {setTimeout(function() { press("ds3")}, 1250);}
5251 {setTimeout(function() { press("f3")}, 1500);}
5252 {setTimeout(function() { press("g3")}, 1750);}
5253 {setTimeout(function() { press("f3")}, 2000);}
5254 {setTimeout(function() { press("ds3")}, 2250);}
5255 {setTimeout(function() { press("d3")}, 2500);}
5256 {setTimeout(function() { press("c3")}, 2750);}
5257 {setTimeout(function() { press("as2")}, 3000);}
5258 {setTimeout(function() { press("a2")}, 3250);}
5259 {setTimeout(function() { press("g2")}, 3500);}
5260 {setTimeout(function() { press("g2"); press("as2"); press("d3"); press("g3")}, 4000);}
5261
5262 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale gharminor") { //G harmonic minor scale
5263 sendChat("The G harmonic minor scale - it has 3 sharps - it has a major 7th (F#)");
5264 {setTimeout(function() { press("g2")}, 0);}
5265 {setTimeout(function() { press("a2")}, 250);}
5266 {setTimeout(function() { press("as2")}, 500);}
5267 {setTimeout(function() { press("c3")}, 750);}
5268 {setTimeout(function() { press("d3")}, 1000);}
5269 {setTimeout(function() { press("ds3")}, 1250);}
5270 {setTimeout(function() { press("fs3")}, 1500);}
5271 {setTimeout(function() { press("g3")}, 1750);}
5272 {setTimeout(function() { press("fs3")}, 2000);}
5273 {setTimeout(function() { press("ds3")}, 2250);}
5274 {setTimeout(function() { press("d3")}, 2500);}
5275 {setTimeout(function() { press("c3")}, 2750);}
5276 {setTimeout(function() { press("as2")}, 3000);}
5277 {setTimeout(function() { press("a2")}, 3250);}
5278 {setTimeout(function() { press("g2")}, 3500);}
5279 {setTimeout(function() { press("g2"); press("as2"); press("d3"); press("g3")}, 4000);}
5280
5281 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale gmelminor") { //G melodic minor scale
5282 sendChat("The G melodic minor scale - it has 1 sharp ascending and 2 sharps descending - it has two patterns ascending and descending.");
5283 {setTimeout(function() { press("g2")}, 0);}
5284 {setTimeout(function() { press("a2")}, 250);}
5285 {setTimeout(function() { press("as2")}, 500);}
5286 {setTimeout(function() { press("c3")}, 750);}
5287 {setTimeout(function() { press("d3")}, 1000);}
5288 {setTimeout(function() { press("e3")}, 1250);}
5289 {setTimeout(function() { press("fs3")}, 1500);}
5290 {setTimeout(function() { press("g3")}, 1750);}
5291 {setTimeout(function() { press("f3")}, 2000);}
5292 {setTimeout(function() { press("ds3")}, 2250);}
5293 {setTimeout(function() { press("d3")}, 2500);}
5294 {setTimeout(function() { press("c3")}, 2750);}
5295 {setTimeout(function() { press("as2")}, 3000);}
5296 {setTimeout(function() { press("a2")}, 3250);}
5297 {setTimeout(function() { press("g2")}, 3500);}
5298 {setTimeout(function() { press("g2"); press("as2"); press("d3"); press("g3")}, 4000);}
5299 //G scales
5300
5301 //Ab Scales
5302 } else if (message.substring(0, 14).toLowerCase() == cmdChar+"scale abmajor") { //Ab major scale
5303 sendChat("The Ab (flat) major scale - it has 4 flats - its relative minor is F");
5304 {setTimeout(function() { press("gs2")}, 0);}
5305 {setTimeout(function() { press("as2")}, 250);}
5306 {setTimeout(function() { press("c3")}, 500);}
5307 {setTimeout(function() { press("cs3")}, 750);}
5308 {setTimeout(function() { press("ds3")}, 1000);}
5309 {setTimeout(function() { press("f3")}, 1250);}
5310 {setTimeout(function() { press("g3")}, 1500);}
5311 {setTimeout(function() { press("gs3")}, 1750);}
5312 {setTimeout(function() { press("g3")}, 2000);}
5313 {setTimeout(function() { press("f3")}, 2250);}
5314 {setTimeout(function() { press("ds3")}, 2500);}
5315 {setTimeout(function() { press("cs3")}, 2750);}
5316 {setTimeout(function() { press("c3")}, 3000);}
5317 {setTimeout(function() { press("as2")}, 3250);}
5318 {setTimeout(function() { press("gs2")}, 3500);}
5319 {setTimeout(function() { press("gs2"); press("c3"); press("ds3"); press("gs3")}, 4000);}
5320
5321 } else if (message.substring(0, 15).toLowerCase() == cmdChar+"scale abminor") { //Ab minor scale
5322 sendChat("The Ab (flat) minor scale - it has 7 flats - its relative major is Cb major or enharmonically, B major");
5323 {setTimeout(function() { press("gs2")}, 0);}
5324 {setTimeout(function() { press("as2")}, 250);}
5325 {setTimeout(function() { press("b2")}, 500);}
5326 {setTimeout(function() { press("cs3")}, 750);}
5327 {setTimeout(function() { press("ds3")}, 1000);}
5328 {setTimeout(function() { press("e3")}, 1250);}
5329 {setTimeout(function() { press("fs3")}, 1500);}
5330 {setTimeout(function() { press("gs3")}, 1750);}
5331 {setTimeout(function() { press("fs3")}, 2000);}
5332 {setTimeout(function() { press("e3")}, 2250);}
5333 {setTimeout(function() { press("ds3")}, 2500);}
5334 {setTimeout(function() { press("cs3")}, 2750);}
5335 {setTimeout(function() { press("b2")}, 3000);}
5336 {setTimeout(function() { press("as2")}, 3250);}
5337 {setTimeout(function() { press("gs2")}, 3500);}
5338 {setTimeout(function() { press("gs2"); press("b2"); press("ds3"); press("gs3")}, 4000);}
5339
5340 } else if (message.substring(0, 17).toLowerCase() == cmdChar+"scale abharminor") { //Ab harmonic minor scale
5341 sendChat("The Ab (flat) harmonic minor scale - it has 4 flats - it has a major 7th (G)");
5342 {setTimeout(function() { press("gs2")}, 0);}
5343 {setTimeout(function() { press("as2")}, 250);}
5344 {setTimeout(function() { press("b2")}, 500);}
5345 {setTimeout(function() { press("cs3")}, 750);}
5346 {setTimeout(function() { press("ds3")}, 1000);}
5347 {setTimeout(function() { press("e3")}, 1250);}
5348 {setTimeout(function() { press("g3")}, 1500);}
5349 {setTimeout(function() { press("gs3")}, 1750);}
5350 {setTimeout(function() { press("g3")}, 2000);}
5351 {setTimeout(function() { press("e3")}, 2250);}
5352 {setTimeout(function() { press("ds3")}, 2500);}
5353 {setTimeout(function() { press("cs3")}, 2750);}
5354 {setTimeout(function() { press("b2")}, 3000);}
5355 {setTimeout(function() { press("as2")}, 3250);}
5356 {setTimeout(function() { press("gs2")}, 3500);}
5357 {setTimeout(function() { press("gs2"); press("b2"); press("ds3"); press("gs3")}, 4000);}
5358
5359 } else if (message.substring(0, 17).toLowerCase() == cmdChar+"scale abmelminor") { //Ab melodic minor scale
5360 sendChat("The Ab (flat) melodic minor scale - it has 3 flats ascending and 4 flats descending - it has two patterns ascending and descending.");
5361 {setTimeout(function() { press("gs2")}, 0);}
5362 {setTimeout(function() { press("as2")}, 250);}
5363 {setTimeout(function() { press("b2")}, 500);}
5364 {setTimeout(function() { press("cs3")}, 750);}
5365 {setTimeout(function() { press("ds3")}, 1000);}
5366 {setTimeout(function() { press("f3")}, 1250);}
5367 {setTimeout(function() { press("g3")}, 1500);}
5368 {setTimeout(function() { press("gs3")}, 1750);}
5369 {setTimeout(function() { press("fs3")}, 2000);}
5370 {setTimeout(function() { press("e3")}, 2250);}
5371 {setTimeout(function() { press("ds3")}, 2500);}
5372 {setTimeout(function() { press("cs3")}, 2750);}
5373 {setTimeout(function() { press("b2")}, 3000);}
5374 {setTimeout(function() { press("as2")}, 3250);}
5375 {setTimeout(function() { press("gs2")}, 3500);}
5376 {setTimeout(function() { press("gs2"); press("b2"); press("ds3"); press("gs3")}, 4000);}
5377 //Ab Scales
5378
5379 //A Scales
5380 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"scale amajor") { //A major scale
5381 sendChat("The A major scale - it has 3 sharps - its relative minor is F#");
5382 {setTimeout(function() { press("a2")}, 0);}
5383 {setTimeout(function() { press("b2")}, 250);}
5384 {setTimeout(function() { press("cs3")}, 500);}
5385 {setTimeout(function() { press("d3")}, 750);}
5386 {setTimeout(function() { press("e3")}, 1000);}
5387 {setTimeout(function() { press("fs3")}, 1250);}
5388 {setTimeout(function() { press("gs3")}, 1500);}
5389 {setTimeout(function() { press("a3")}, 1750);}
5390 {setTimeout(function() { press("gs3")}, 2000);}
5391 {setTimeout(function() { press("fs3")}, 2250);}
5392 {setTimeout(function() { press("e3")}, 2500);}
5393 {setTimeout(function() { press("d3")}, 2750);}
5394 {setTimeout(function() { press("cs3")}, 3000);}
5395 {setTimeout(function() { press("b2")}, 3250);}
5396 {setTimeout(function() { press("a2")}, 3500);}
5397 {setTimeout(function() { press("a2"); press("cs3"); press("e3"); press("a3")}, 4000);}
5398
5399 } else if (message.substring(0, 14).toLowerCase() == cmdChar+"scale aminor") { //A minor scale
5400 sendChat("The A minor scale - it has no sharps or flats - its relative major is C major");
5401 {setTimeout(function() { press("a2")}, 0);}
5402 {setTimeout(function() { press("b2")}, 250);}
5403 {setTimeout(function() { press("c3")}, 500);}
5404 {setTimeout(function() { press("d3")}, 750);}
5405 {setTimeout(function() { press("e3")}, 1000);}
5406 {setTimeout(function() { press("f3")}, 1250);}
5407 {setTimeout(function() { press("g3")}, 1500);}
5408 {setTimeout(function() { press("a3")}, 1750);}
5409 {setTimeout(function() { press("g3")}, 2000);}
5410 {setTimeout(function() { press("f3")}, 2250);}
5411 {setTimeout(function() { press("e3")}, 2500);}
5412 {setTimeout(function() { press("d3")}, 2750);}
5413 {setTimeout(function() { press("c3")}, 3000);}
5414 {setTimeout(function() { press("b2")}, 3250);}
5415 {setTimeout(function() { press("a2")}, 3500);}
5416 {setTimeout(function() { press("a2"); press("c3"); press("e3"); press("a3")}, 4000);}
5417
5418 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale aharminor") { //A harmonic minor scale
5419 sendChat("The A harmonic minor scale - it has 1 flat - it has a major 7th (G#)");
5420 {setTimeout(function() { press("a2")}, 0);}
5421 {setTimeout(function() { press("b2")}, 250);}
5422 {setTimeout(function() { press("cs3")}, 500);}
5423 {setTimeout(function() { press("d3")}, 750);}
5424 {setTimeout(function() { press("e3")}, 1000);}
5425 {setTimeout(function() { press("fs3")}, 1250);}
5426 {setTimeout(function() { press("gs3")}, 1500);}
5427 {setTimeout(function() { press("a3")}, 1750);}
5428 {setTimeout(function() { press("gs3")}, 2000);}
5429 {setTimeout(function() { press("fs3")}, 2250);}
5430 {setTimeout(function() { press("e3")}, 2500);}
5431 {setTimeout(function() { press("d3")}, 2750);}
5432 {setTimeout(function() { press("cs3")}, 3000);}
5433 {setTimeout(function() { press("b2")}, 3250);}
5434 {setTimeout(function() { press("a2")}, 3500);}
5435 {setTimeout(function() { press("a2"); press("cs3"); press("e3"); press("a3")}, 4000);}
5436
5437 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale amelminor") { //A melodic minor scale
5438 sendChat("The A melodic minor scale - it has 2 sharps ascending and 0 sharps descending - it has two patterns ascending and descending.");
5439 {setTimeout(function() { press("a2")}, 0);}
5440 {setTimeout(function() { press("b2")}, 250);}
5441 {setTimeout(function() { press("c3")}, 500);}
5442 {setTimeout(function() { press("d3")}, 750);}
5443 {setTimeout(function() { press("e3")}, 1000);}
5444 {setTimeout(function() { press("fs3")}, 1250);}
5445 {setTimeout(function() { press("gs3")}, 1500);}
5446 {setTimeout(function() { press("a3")}, 1750);}
5447 {setTimeout(function() { press("g3")}, 2000);}
5448 {setTimeout(function() { press("f3")}, 2250);}
5449 {setTimeout(function() { press("e3")}, 2500);}
5450 {setTimeout(function() { press("d3")}, 2750);}
5451 {setTimeout(function() { press("c3")}, 3000);}
5452 {setTimeout(function() { press("b2")}, 3250);}
5453 {setTimeout(function() { press("a2")}, 3500);}
5454 {setTimeout(function() { press("a2"); press("c3"); press("e3"); press("a3")}, 4000);}
5455 //A Scales
5456
5457 //Bb Scales
5458 } else if (message.substring(0, 14).toLowerCase() == cmdChar+"scale bbmajor") { //Bb major scale
5459 sendChat("The Bb (flat) major scale - it has 2 flats - its relative minor is G");
5460 {setTimeout(function() { press("as2")}, 0);}
5461 {setTimeout(function() { press("c3")}, 250);}
5462 {setTimeout(function() { press("d3")}, 500);}
5463 {setTimeout(function() { press("ds3")}, 750);}
5464 {setTimeout(function() { press("f3")}, 1000);}
5465 {setTimeout(function() { press("g3")}, 1250);}
5466 {setTimeout(function() { press("a3")}, 1500);}
5467 {setTimeout(function() { press("as3")}, 1750);}
5468 {setTimeout(function() { press("a3")}, 2000);}
5469 {setTimeout(function() { press("g3")}, 2250);}
5470 {setTimeout(function() { press("f3")}, 2500);}
5471 {setTimeout(function() { press("ds3")}, 2750);}
5472 {setTimeout(function() { press("d3")}, 3000);}
5473 {setTimeout(function() { press("c3")}, 3250);}
5474 {setTimeout(function() { press("as2")}, 3500);}
5475 {setTimeout(function() { press("as2"); press("d3"); press("f3"); press("as3")}, 4000);}
5476
5477 } else if (message.substring(0, 15).toLowerCase() == cmdChar+"scale bbminor") { //Bb minor scale
5478 sendChat("The Bb (flat) minor scale - it 6 flats - its relative major is Db major");
5479 {setTimeout(function() { press("as2")}, 0);}
5480 {setTimeout(function() { press("c3")}, 250);}
5481 {setTimeout(function() { press("cs3")}, 500);}
5482 {setTimeout(function() { press("ds3")}, 750);}
5483 {setTimeout(function() { press("f3")}, 1000);}
5484 {setTimeout(function() { press("fs3")}, 1250);}
5485 {setTimeout(function() { press("gs3")}, 1500);}
5486 {setTimeout(function() { press("as3")}, 1750);}
5487 {setTimeout(function() { press("gs3")}, 2000);}
5488 {setTimeout(function() { press("fs3")}, 2250);}
5489 {setTimeout(function() { press("f3")}, 2500);}
5490 {setTimeout(function() { press("ds3")}, 2750);}
5491 {setTimeout(function() { press("cs3")}, 3000);}
5492 {setTimeout(function() { press("c3")}, 3250);}
5493 {setTimeout(function() { press("as2")}, 3500);}
5494 {setTimeout(function() { press("as2"); press("cs3"); press("f3"); press("as3")}, 4000);}
5495
5496 } else if (message.substring(0, 17).toLowerCase() == cmdChar+"scale bbharminor") { //Bb harmonic minor scale
5497 sendChat("The Bb (flat) harmonic minor scale - it has 5 flats - it has a major 7th (A)");
5498 {setTimeout(function() { press("as2")}, 0);}
5499 {setTimeout(function() { press("c3")}, 250);}
5500 {setTimeout(function() { press("cs3")}, 500);}
5501 {setTimeout(function() { press("ds3")}, 750);}
5502 {setTimeout(function() { press("f3")}, 1000);}
5503 {setTimeout(function() { press("fs3")}, 1250);}
5504 {setTimeout(function() { press("a3")}, 1500);}
5505 {setTimeout(function() { press("as3")}, 1750);}
5506 {setTimeout(function() { press("a3")}, 2000);}
5507 {setTimeout(function() { press("fs3")}, 2250);}
5508 {setTimeout(function() { press("f3")}, 2500);}
5509 {setTimeout(function() { press("ds3")}, 2750);}
5510 {setTimeout(function() { press("cs3")}, 3000);}
5511 {setTimeout(function() { press("c3")}, 3250);}
5512 {setTimeout(function() { press("as2")}, 3500);}
5513 {setTimeout(function() { press("as2"); press("cs3"); press("f3"); press("as3")}, 4000);}
5514
5515 } else if (message.substring(0, 17).toLowerCase() == cmdChar+"scale bbmelminor") { //Bb melodic minor scale
5516 sendChat("The Bb (flat) melodic minor scale - it has 4 flat ascending and 6 sharps descending - it has two patterns ascending and descending.");
5517 {setTimeout(function() { press("as2")}, 0);}
5518 {setTimeout(function() { press("c3")}, 250);}
5519 {setTimeout(function() { press("cs3")}, 500);}
5520 {setTimeout(function() { press("ds3")}, 750);}
5521 {setTimeout(function() { press("f3")}, 1000);}
5522 {setTimeout(function() { press("g3")}, 1250);}
5523 {setTimeout(function() { press("a3")}, 1500);}
5524 {setTimeout(function() { press("as3")}, 1750);}
5525 {setTimeout(function() { press("gs3")}, 2000);}
5526 {setTimeout(function() { press("fs3")}, 2250);}
5527 {setTimeout(function() { press("f3")}, 2500);}
5528 {setTimeout(function() { press("ds3")}, 2750);}
5529 {setTimeout(function() { press("cs3")}, 3000);}
5530 {setTimeout(function() { press("c3")}, 3250);}
5531 {setTimeout(function() { press("as2")}, 3500);}
5532 {setTimeout(function() { press("as2"); press("cs3"); press("f3"); press("as3")}, 4000);}
5533 //Bb Scales
5534
5535 //B Scales
5536 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"scale bmajor") { //B major scale
5537 sendChat("The B major scale - it has 5 sharps - its relative minor is G#");
5538 {setTimeout(function() { press("b2")}, 0);}
5539 {setTimeout(function() { press("cs3")}, 250);}
5540 {setTimeout(function() { press("ds3")}, 500);}
5541 {setTimeout(function() { press("e3")}, 750);}
5542 {setTimeout(function() { press("fs3")}, 1000);}
5543 {setTimeout(function() { press("gs3")}, 1250);}
5544 {setTimeout(function() { press("as3")}, 1500);}
5545 {setTimeout(function() { press("b3")}, 1750);}
5546 {setTimeout(function() { press("as3")}, 2000);}
5547 {setTimeout(function() { press("gs3")}, 2250);}
5548 {setTimeout(function() { press("fs3")}, 2500);}
5549 {setTimeout(function() { press("e3")}, 2750);}
5550 {setTimeout(function() { press("ds3")}, 3000);}
5551 {setTimeout(function() { press("cs3")}, 3250);}
5552 {setTimeout(function() { press("b2")}, 3500);}
5553 {setTimeout(function() { press("b2"); press("ds3"); press("fs3"); press("b3")}, 4000);}
5554
5555 } else if (message.substring(0, 14).toLowerCase() == cmdChar+"scale bminor") { //B minor scale
5556 sendChat("The B minor scale - it 2 sharps - its relative major is D major");
5557 {setTimeout(function() { press("b2")}, 0);}
5558 {setTimeout(function() { press("cs3")}, 250);}
5559 {setTimeout(function() { press("d3")}, 500);}
5560 {setTimeout(function() { press("e3")}, 750);}
5561 {setTimeout(function() { press("fs3")}, 1000);}
5562 {setTimeout(function() { press("g3")}, 1250);}
5563 {setTimeout(function() { press("a3")}, 1500);}
5564 {setTimeout(function() { press("b3")}, 1750);}
5565 {setTimeout(function() { press("a3")}, 2000);}
5566 {setTimeout(function() { press("g3")}, 2250);}
5567 {setTimeout(function() { press("fs3")}, 2500);}
5568 {setTimeout(function() { press("e3")}, 2750);}
5569 {setTimeout(function() { press("d3")}, 3000);}
5570 {setTimeout(function() { press("cs3")}, 3250);}
5571 {setTimeout(function() { press("b2")}, 3500);}
5572 {setTimeout(function() { press("b2"); press("d3"); press("fs3"); press("b3")}, 4000);}
5573
5574 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale bharminor") { //B harmonic minor scale
5575 sendChat("The B harmonic minor scale - it has 3 sharps - it has a major 7th (A#)");
5576 {setTimeout(function() { press("b2")}, 0);}
5577 {setTimeout(function() { press("cs3")}, 250);}
5578 {setTimeout(function() { press("d3")}, 500);}
5579 {setTimeout(function() { press("e3")}, 750);}
5580 {setTimeout(function() { press("fs3")}, 1000);}
5581 {setTimeout(function() { press("g3")}, 1250);}
5582 {setTimeout(function() { press("as3")}, 1500);}
5583 {setTimeout(function() { press("b3")}, 1750);}
5584 {setTimeout(function() { press("as3")}, 2000);}
5585 {setTimeout(function() { press("g3")}, 2250);}
5586 {setTimeout(function() { press("fs3")}, 2500);}
5587 {setTimeout(function() { press("e3")}, 2750);}
5588 {setTimeout(function() { press("d3")}, 3000);}
5589 {setTimeout(function() { press("cs3")}, 3250);}
5590 {setTimeout(function() { press("b2")}, 3500);}
5591 {setTimeout(function() { press("b2"); press("d3"); press("fs3"); press("b3")}, 4000);}
5592
5593 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale bmelminor") { //B melodic minor scale
5594 sendChat("The B melodic minor scale - it has 4 sharps ascending and 2 sharps descending - it has two patterns ascending and descending.");
5595 {setTimeout(function() { press("b2")}, 0);}
5596 {setTimeout(function() { press("cs3")}, 250);}
5597 {setTimeout(function() { press("d3")}, 500);}
5598 {setTimeout(function() { press("e3")}, 750);}
5599 {setTimeout(function() { press("fs3")}, 1000);}
5600 {setTimeout(function() { press("gs3")}, 1250);}
5601 {setTimeout(function() { press("as3")}, 1500);}
5602 {setTimeout(function() { press("b3")}, 1750);}
5603 {setTimeout(function() { press("a3")}, 2000);}
5604 {setTimeout(function() { press("g3")}, 2250);}
5605 {setTimeout(function() { press("fs3")}, 2500);}
5606 {setTimeout(function() { press("e3")}, 2750);}
5607 {setTimeout(function() { press("d3")}, 3000);}
5608 {setTimeout(function() { press("cs3")}, 3250);}
5609 {setTimeout(function() { press("b2")}, 3500);}
5610 {setTimeout(function() { press("b2"); press("d3"); press("fs3"); press("b3")}, 4000);}
5611 //B Scales
5612 //scales
5613
5614 //glossary
5615 } else if (cmd == cmdChar+"glossary") { //Glossary
5616 sendChat("Music theory glossary: "+cmdChar+"arpeggio, "+cmdChar+"glissando [Unfinished!!]");
5617
5618 //Arpeggio
5619 } else if (cmd == cmdChar+"arpeggio") { //Arpeggio
5620 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\".");
5621 {setTimeout(function() { press("c0")}, 0);} //octave
5622 {setTimeout(function() { press("ds0")}, 200);}
5623 {setTimeout(function() { press("g0")}, 400);}
5624 {setTimeout(function() { press("c1")}, 600);} //octave
5625 {setTimeout(function() { press("ds1")}, 800);}
5626 {setTimeout(function() { press("g1")}, 1000);}
5627 {setTimeout(function() { press("c2")}, 1200);} //octave
5628 {setTimeout(function() { press("ds2")}, 1400);}
5629 {setTimeout(function() { press("g2")}, 1600);}
5630 {setTimeout(function() { press("c3")}, 1800);} //octave
5631 {setTimeout(function() { press("ds3")}, 2000);}
5632 {setTimeout(function() { press("g3")}, 2200);}
5633 {setTimeout(function() { press("c4")}, 2400);} //octave
5634 {setTimeout(function() { press("ds4")}, 2600);}
5635 {setTimeout(function() { press("g4")}, 2800);}
5636 {setTimeout(function() { press("c5")}, 3000);} //octave
5637 {setTimeout(function() { press("ds5")}, 3200);}
5638 {setTimeout(function() { press("g5")}, 3400);}
5639 {setTimeout(function() { press("c6")}, 3600);} //octave
5640 {setTimeout(function() { press("ds6")}, 3800);}
5641 {setTimeout(function() { press("g6")}, 4000);}
5642 {setTimeout(function() { press("c7")}, 4200);} //octave
5643 //Arpeggio
5644
5645 //Glissando
5646 } else if (cmd == cmdChar+"glissando") { //Glissando
5647 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.");
5648 {setTimeout(function() { press("a-1")}, 100);}
5649 {setTimeout(function() { press("b-1")}, 200);}
5650 {setTimeout(function() { press("c0")}, 300);}
5651 {setTimeout(function() { press("d0")}, 400);}
5652 {setTimeout(function() { press("e0")}, 500);}
5653 {setTimeout(function() { press("f0")}, 600);}
5654 {setTimeout(function() { press("g0")}, 700);}
5655 {setTimeout(function() { press("a0")}, 800);}
5656 {setTimeout(function() { press("b0")}, 900);}
5657 {setTimeout(function() { press("c1")}, 1000);}
5658 {setTimeout(function() { press("d1")}, 1100);}
5659 {setTimeout(function() { press("e1")}, 1200);}
5660 {setTimeout(function() { press("f1")}, 1300);}
5661 {setTimeout(function() { press("g1")}, 1400);}
5662 {setTimeout(function() { press("a1")}, 1500);}
5663 {setTimeout(function() { press("b1")}, 1600);}
5664 {setTimeout(function() { press("c2")}, 1700);}
5665 {setTimeout(function() { press("d2")}, 1800);}
5666 {setTimeout(function() { press("e2")}, 1900);}
5667 {setTimeout(function() { press("f2")}, 2000);}
5668 {setTimeout(function() { press("g2")}, 2100);}
5669 {setTimeout(function() { press("a2")}, 2200);}
5670 {setTimeout(function() { press("b2")}, 2300);}
5671 {setTimeout(function() { press("c3")}, 2400);}
5672 {setTimeout(function() { press("d3")}, 2500);}
5673 {setTimeout(function() { press("e3")}, 2600);}
5674 {setTimeout(function() { press("f3")}, 2700);}
5675 {setTimeout(function() { press("g3")}, 2800);}
5676 {setTimeout(function() { press("a3")}, 2900);}
5677 {setTimeout(function() { press("b3")}, 3000);}
5678 {setTimeout(function() { press("c4")}, 3100);}
5679 {setTimeout(function() { press("d4")}, 3200);}
5680 {setTimeout(function() { press("e4")}, 3300);}
5681 {setTimeout(function() { press("f4")}, 3400);}
5682 {setTimeout(function() { press("g4")}, 3500);}
5683 {setTimeout(function() { press("a4")}, 3600);}
5684 {setTimeout(function() { press("b4")}, 3700);}
5685 {setTimeout(function() { press("c5")}, 3800);}
5686 {setTimeout(function() { press("d5")}, 3900);}
5687 {setTimeout(function() { press("e5")}, 4000);}
5688 {setTimeout(function() { press("f5")}, 4100);}
5689 {setTimeout(function() { press("g5")}, 4200);}
5690 {setTimeout(function() { press("a5")}, 4300);}
5691 {setTimeout(function() { press("b5")}, 4400);}
5692 {setTimeout(function() { press("c6")}, 4500);}
5693 {setTimeout(function() { press("d6")}, 4600);}
5694 {setTimeout(function() { press("e6")}, 4700);}
5695 {setTimeout(function() { press("f6")}, 4800);}
5696 {setTimeout(function() { press("g6")}, 4900);}
5697 {setTimeout(function() { press("a6")}, 5000);}
5698 {setTimeout(function() { press("b6")}, 5100);}
5699 {setTimeout(function() { press("c7")}, 5200);}
5700 //Glissando
5701
5702 //Glossary
5703
5704 //Music theory
5705
5706 //Meow game
5707 } else if (cmd == cmdChar+"mp") {
5708 if (message.length == cmd.length) {
5709 // Check if user is in Database
5710 mUser = MDB[ids];
5711
5712 // If user isn't create a new entry
5713 if (!mUser) {
5714 mUser = MDB[ids] = {
5715 name: name,
5716 meowP: 0,
5717 meowRate: 1,
5718 meowTime: 0,
5719 meowing: false,
5720 cheeseMaster: false,
5721 inventory: {
5722 string: 1,
5723 yarn: 0,
5724 wool: 0,
5725 water: 0,
5726 milk: 0,
5727 bananaMilk: 0,
5728 cheese: 0
5729 },
5730 prices: {
5731 string: 50,
5732 yarn: 500,
5733 wool: 2000,
5734 water: 15000,
5735 milk: 50000,
5736 bananaMilk: 100000,
5737 cheese: 25000000000
5738 }
5739 };
5740
5741 // Start their timer (no clue if this is correct or what)
5742 setInterval(function() {
5743 MDB[ids].meowP += MDB[ids].meowRate;
5744 ++MDB[ids].meowTime;
5745 }, 1000);
5746
5747 MDB[ids].meowing = true;
5748 sendChat('✯ Meow! Welcome to Meowpuff, ' + name + '! (type '+cmdChar+'meow for help, if you\'re still confused ask Logan x3)✯');
5749 sendChat('MP [' + mUser.meowP + '] MP rate [' + mUser.meowRate + '] Time [' + mUser.meowTime + ' secs | ' + (mUser.meowTime / 86400).toPrecision(4) + ' days]');
5750
5751 } else {
5752 if (!MDB[ids].meowing) {
5753 setInterval(function() {
5754 MDB[ids].meowP += MDB[ids].meowRate;
5755 ++MDB[ids].meowTime;
5756 }, 1000);
5757 if (MDB[ids].cheeseMaster) {
5758 sendChat('Welcome back, [Cheese Master] ' + name + '! Stats successfully loaded.');
5759 } else {
5760 sendChat('Welcome back, ' + name + '. Stats successfully loaded.');
5761 }
5762 MDB[ids].meowing = true;
5763 }
5764
5765 // working ✓
5766 sendChat('MP [' + mUser.meowP + '] MP rate [' + mUser.meowRate + '] Time [' + mUser.meowTime + ' secs | ' + (mUser.meowTime / 86400).toPrecision(4) + ' days]');
5767 }
5768 //else they entered more information
5769 } else {
5770 var target = msg.a.substring(cmd.length).trim();
5771 var part = getUser(target.toLowerCase());
5772 if (part) {
5773 if (!MDB[part._id] || !MDB[part._id].meowing) {
5774 sendChat(part.name+ ' isn\'t playing Meowpuff. They need to type '+cmdChar+'mp to create or load a save');
5775 return;
5776 }
5777
5778 if (part.name == name) {
5779 sendChat('Your MP [' + MDB[ids].meowP + '] MP rate [' + MDB[ids].meowRate + '] Time [' + MDB[ids].meowTime + ' secs | ' + (MDB[ids].meowTime / 86400).toPrecision(4) + ' days]');
5780 return;
5781 }
5782 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]');
5783 } else {
5784 sendChat(userNotFound);
5785 }
5786 }
5787
5788 //Meow help
5789 } else if (cmd == cmdChar+"meow") {
5790 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 ✯');
5791 sendChat(''+cmdChar+'meow (shows help) '+cmdChar+'mp (starts game / shows stats after you have started and '+cmdChar+'mp name_here), \
5792 '+cmdChar+'meowshop ('+cmdChar+'mshop item_name_here visit The Cuddle Kitty shop to buy items to increase your MPS), \
5793 '+cmdChar+'meowinventory ('+cmdChar+'minv shows your Meow Points and purchased items and '+cmdChar+'minv name_here), \
5794 '+cmdChar+'meowsave ('+cmdChar+'msave saves game), \
5795 '+cmdChar+'meowtype ('+cmdChar+'mtype gives you a word challenge), \
5796 '+cmdChar+'meowstats ('+cmdChar+'mstats shows total stats for all players)');
5797 //Meow help
5798
5799 //Meow shop
5800 } else if (cmd == cmdChar+"meowshop" || cmd == cmdChar+"mshop") {
5801 if (!MDB[ids].meowing) {
5802 sendChat('You must start the game again with '+cmdChar+'mp before The Cuddle Kitty shop will let you in!');
5803 return;
5804 }
5805 if (message.substring(cmd.length).trim() == '') {
5806 //optimise
5807 if (gClient.isOwner()) sendChat('✯ Meow ' + name + '! Welcome to The Cuddle Kitty shop! If you need help type '+cmdChar+'meow :3 | MP [' + MDB[ids].meowP + '] ✯');
5808 sendChat(name +'\'s shop (string [' + MDB[ids].prices.string + ' MP] +1 MPS for each piece of string owned) \
5809 (yarn [' + MDB[ids].prices.yarn + ' MP] +10 MPS for each piece of yarn owned) \
5810 (wool [' + MDB[ids].prices.wool + ' MP] +40 MPS for each ball of wool owned) \
5811 (water [' + MDB[ids].prices.water + ' MP] +300 MPS for every bowl of water owned) \
5812 (milk [' + MDB[ids].prices.milk + ' MP] +1000 MPS for every tanker of milk owned) \
5813 (banana milk [' + MDB[ids].prices.bananaMilk + ' MP] +2000 MPS for every tanker of banana milk owned) \
5814 (cheese [' + MDB[ids].prices.cheese + ' MP] +2500000000 MPS for each piece of cheese owned)');
5815 return;
5816
5817 // string
5818 } else if (message.substring(cmd.length).trim() == 'string') {
5819 if (MDB[ids].meowP >= MDB[ids].prices.string) { //Do they have enough meow points?
5820 MDB[ids].meowP -= MDB[ids].prices.string; //Take correct price away
5821 MDB[ids].prices.string += 5 * (MDB[ids].inventory.string) + 50; //Up price next time, might make more cruel
5822 MDB[ids].meowRate += 1; //Add the MPS
5823 MDB[ids].inventory.string += 1; //Add the string to inv
5824 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 + ']');
5825 } else { //They don't have enough meow points
5826 //return a positive number
5827 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 + ']');
5828 }
5829
5830 // yarn
5831 } else if (message.substring(cmd.length).trim() == 'yarn') {
5832 if (MDB[ids].meowP >= MDB[ids].prices.yarn) {
5833 MDB[ids].meowP -= MDB[ids].prices.yarn;
5834 MDB[ids].prices.yarn += 50 * (MDB[ids].inventory.yarn) + 500;
5835 MDB[ids].meowRate += 10;
5836 MDB[ids].inventory.yarn += 1;
5837 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 + ']');
5838 } else {
5839 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 + ']');
5840 }
5841
5842 // wool
5843 } else if (message.substring(cmd.length).trim() == 'wool') {
5844 if (MDB[ids].meowP >= MDB[ids].prices.wool) {
5845 MDB[ids].meowP -= MDB[ids].prices.wool;
5846 MDB[ids].prices.wool += 200 * (MDB[ids].inventory.wool) + 2000;
5847 MDB[ids].meowRate += 40;
5848 MDB[ids].inventory.wool += 1;
5849 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 + ']');
5850 } else {
5851 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 + ']');
5852 }
5853
5854 // water
5855 } else if (message.substring(cmd.length).trim() == 'water') {
5856 if (MDB[ids].meowP >= MDB[ids].prices.water) {
5857 MDB[ids].meowP -= MDB[ids].prices.water;
5858 MDB[ids].prices.water += 1500 * (MDB[ids].inventory.water) + 15000;
5859 MDB[ids].meowRate += 300;
5860 MDB[ids].inventory.water += 1;
5861 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 + ']');
5862 } else {
5863 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 + ']');
5864 }
5865
5866 // milk
5867 } else if (message.substring(cmd.length).trim() == 'milk') {
5868 if (MDB[ids].meowP >= MDB[ids].prices.milk) {
5869 MDB[ids].meowP -= MDB[ids].prices.milk;
5870 MDB[ids].prices.milk += 5000 * (MDB[ids].inventory.milk) + 50000;
5871 MDB[ids].meowRate += 1000;
5872 MDB[ids].inventory.milk += 1;
5873 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 + ']');
5874 } else {
5875 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 + ']');
5876 }
5877
5878 // banana milk
5879 } else if (message.substring(cmd.length).trim() == 'banana milk') {
5880 if (MDB[ids].meowP >= MDB[ids].prices.bananaMilk) {
5881 MDB[ids].meowP -= MDB[ids].prices.bananaMilk;
5882 MDB[ids].prices.bananaMilk += 10000 * (MDB[ids].inventory.bananaMilk) + 100000;
5883 MDB[ids].meowRate += 2000;
5884 MDB[ids].inventory.bananaMilk += 1;
5885 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 + ']');
5886 } else {
5887 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 + ']');
5888 }
5889
5890 // cheese
5891 } else if (message.substring(cmd.length).trim() == 'cheese') {
5892 if (MDB[ids].meowP >= MDB[ids].prices.cheese) {
5893 MDB[ids].meowP -= MDB[ids].prices.cheese;
5894 MDB[ids].prices.cheese += 2500000000 * (MDB[ids].inventory.cheese) + 25000000000;
5895 MDB[ids].meowRate += 500000000;
5896 MDB[ids].inventory.cheese += 1;
5897 MDB[ids].cheeseMaster = true;
5898 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 + '] ✯');
5899 } else {
5900 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 + ']');
5901 }
5902 }
5903
5904 //item prices: 250000
5905
5906 // kitty storage
5907 } else if (cmd == cmdChar+"meowinventory" || cmd == cmdChar+"minv") {
5908 if (message.length == cmd.length) {
5909 if (!MDB[ids].meowing) {
5910 sendChat('You must start the game again with '+cmdChar+'mp before kitty storage is setup!');
5911 return;
5912 }
5913 if(gClient.isOwner()) sendChat('✯ Meow! Welcome to Kitty Storage! This is where we keep all your purchased items :3 MP [' + MDB[ids].meowP + '] ✯');
5914 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 + ')');
5915
5916 } else {
5917 var target = msg.a.substring(cmd.length).trim();
5918 var part = getUser(target.toLowerCase());
5919
5920 if (part) {
5921 if (!MDB[part._id] || !MDB[part._id].meowing) {
5922 sendChat(part.name+ ' isn\'t playing Meowpuff. They need to type '+cmdChar+'mp to create or load a save');
5923 return;
5924 }
5925
5926 if (part.name == name) {
5927 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 + ')');
5928 return;
5929 }
5930 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 + ')');
5931
5932 } else {
5933 sendChat(userNotFound);
5934 }
5935 }
5936 //Meow save
5937 } 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!
5938 try {
5939 L.MDB = MDB.toString(); //saves everyone for simplicity
5940 // get the number of people playing
5941 var played = 0;
5942 var playing = 0;
5943 var totalDays = 0;
5944 for (var id in MDB) {
5945 if (MDB[id].meowing) ++playing;
5946 if (!MDB[id].meowing) ++played;
5947 totalDays += MDB[id].meowTime;
5948 }
5949
5950 sendChat('Everyones stats have been saved! [playing: ' + playing + ', total players: ' + played + ' | ' + (totalDays / 86400).toPrecision(4) + ' total days]');
5951
5952 } catch (e) {
5953 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
5954 }
5955 //Meow save
5956
5957 //Meow copy sentence mini-game
5958 } else if (cmd == cmdChar+"meowtype" || cmd == cmdChar+"mtype") {
5959 if (!askedEnglish) {
5960 Array.prototype.random = function(a){ //thanks SomeGuy for prototype
5961 if(this){
5962 var b = Math.floor(Math.random() * this.length);
5963 return this[b];
5964 }
5965 }
5966
5967 // arrays
5968 var colours = ["red", "orange", "yellow", "green", "blue", "purple", "gray", "black", "white"];
5969 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"];
5970 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"];
5971 var determiners = ["the", "a", "another", "some", "any", "my", "our", "their", "her", "his", "its", "each", "every", "certain", "this", "that"];
5972 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"];
5973 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"];
5974
5975 //consider cleaning up this code when you have free time
5976
5977 try {
5978 if (!hardEnglish) {
5979 //easy (normal)
5980 var str = determiners.random() + " " + adjectives.random() + " " + verbs.random() + " " + nouns.random() + " " + conjunctions.random() + " " + verbs.random() + " " + nouns.random() + " " + verbs.random() + ".";
5981 sentence = capitalizeFirstLetter(str);
5982 var antiCopy = sentence.split(" ").join(" \u034f\uFFFC");
5983 sentenceAntiCopy = capitalizeFirstLetter(antiCopy);
5984 }
5985 if (hardEnglish) {
5986 //hard (test)
5987 var str = randStr(hardLength);
5988 sentence = str;
5989 var antiCopy = sentence.split("").join("\u034f\uFFFC");
5990 sentenceAntiCopy = antiCopy;
5991 }
5992 sendChat("First person to type this wins: " + sentenceAntiCopy);
5993
5994 } catch(e) {
5995 sendChat('Error in my code: ' + e);
5996 }
5997 askedEnglish = true;
5998
5999 } else {
6000 sendChat("To answer, type the following in chat: " + sentenceAntiCopy);
6001 }
6002
6003 } else if (cmd == cmdChar+"mstats") {
6004 var mp = 0;
6005 var mr = 0;
6006
6007 var string = 0;
6008 var yarn = 0;
6009 var wool = 0;
6010 var water = 0;
6011 var milk = 0;
6012 var bananaMilk = 0;
6013 var cheese = 0;
6014
6015 for (var id in MDB) {
6016 mp += parseInt(MDB[id].meowP);
6017 mr += MDB[id].meowRate;
6018
6019 string += MDB[id].inventory.string;
6020 yarn += MDB[id].inventory.yarn;
6021 wool += MDB[id].inventory.wool;
6022 water += MDB[id].inventory.water;
6023 milk += MDB[id].inventory.milk;
6024 bananaMilk += MDB[id].inventory.bananaMilk;
6025 cheese += MDB[id].inventory.cheese;
6026 }
6027
6028 sendChat("Meowpuff total stats: MP ["+mp+"], MPS ["+mr+"], string ["+string+"], \
6029 yarn ["+yarn+"], wool ["+wool+"], water ["+water+"], milk ["+milk+"], \
6030 banana milk ["+bananaMilk+"], cheese ["+cheese+"].");
6031
6032 //Meow game
6033
6034 // Math *warning* messy code below, brace yourself.
6035 } else if (cmd == cmdChar+"mathhelp") {
6036 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)");
6037
6038 } else if (cmd == cmdChar+"mathdiff") {
6039 if (message.substring(9).trim() == "" || isNaN(message.substring(9).trim()) || message.substring(9).trim() < -1 || message.substring(9).trim() > 5) {
6040 sendChat("Usage: "+cmdChar+"mathdiff 1 (0 = very easy, 1 = easy, 2 = medium, 3 = hard, 4 = insane)");
6041 } else {
6042 mathDiff = message.substring(9).trim();
6043 if (mathDiff == 0) {
6044 mathDiffTxt = "Very Easy \"Piki-Mode\"";
6045 }
6046 if (mathDiff == 1) {
6047 mathDiffTxt = "Easy";
6048 }
6049 if (mathDiff == 2) {
6050 mathDiffTxt = "Medium";
6051 }
6052 if (mathDiff == 3) {
6053 mathDiffTxt = "Hard";
6054 }
6055 if (mathDiff == 4) {
6056 mathDiffTxt = "Insane";
6057 }
6058 if (mathDiff == 5) {
6059 mathDiffTxt = "Asian";
6060 }
6061 if (mathDiff == -1) {
6062 mathDiffTxt = "The Answer to Life, the Universe, and Everything *cough cough*";
6063 }
6064
6065 sendChat(name + " set the difficulty to " + mathDiffTxt);
6066 asked = false;
6067 }
6068
6069 } else if (cmd == cmdChar+"math") {
6070 if (message.length > 5 && !asked) {
6071 return; //might remove if typing !math 69 bringing up a questions seems easier
6072 }
6073 // difficulty settings
6074 if (mathDiff == 0) {
6075 questions = [randNum(1,10) + " + " + randNum(1,10),
6076 randNum(1,10) + " - " + randNum(1,10),
6077 randNum(1,10) + " - " + randNum(1,10)];
6078 pickQuestion = Math.floor( Math.random() * questions.length );
6079 }
6080
6081 if (mathDiff == 1) {
6082 questions = [randNum(1,50) + " + " + randNum(1,20),
6083 randNum(1,50) + " - " + randNum(1,10),
6084 randNum(1,20) + " * " + randNum(1,2),
6085 randNum(1,20) + " % " + randNum(1,2)];
6086 pickQuestion = Math.floor( Math.random() * questions.length );
6087 }
6088
6089 if (mathDiff == 2) {
6090 questions = [randNum(1,100) + " + " + randNum(1,20),
6091 randNum(1,100) + " - " + randNum(1,20),
6092 randNum(1,20) + " * " + randNum(1,10),
6093 randNum(1,50) + " % " + randNum(1,10)];
6094 pickQuestion = Math.floor( Math.random() * questions.length );
6095 }
6096
6097 if (mathDiff == 3) {
6098 questions = [randNum(1,400) + " + " + randNum(1,20),
6099 randNum(1,400) + " - " + randNum(1,300),
6100 randNum(1,100) + " * " + randNum(1,50),
6101 randNum(1,100) + " % " + randNum(1,50)];
6102 pickQuestion = Math.floor( Math.random() * questions.length );
6103 }
6104
6105 if (mathDiff == 4) {
6106 questions = [randNum(1,1000) + " + " + randNum(1,100),
6107 randNum(1,1000) + " - " + randNum(1,100),
6108 randNum(1,1000) + " * " + randNum(1,100)];
6109 pickQuestion = Math.floor( Math.random() * questions.length );
6110 }
6111
6112 if (mathDiff == 5) {
6113 questions = [randNum(-10000000,10000000) + " + " + randNum(-10000000,10000000),
6114 randNum(-10000000,10000000) + " - " + randNum(-10000000,10000000),
6115 randNum(-10000000,10000000) + " * " + randNum(-10000000,10000000),
6116 randNum(-10000000,10000000) + " / " + randNum(-10000000,10000000),
6117 randNum(-10000000,10000000) + " % " + randNum(-10000000,10000000)];
6118 pickQuestion = Math.floor( Math.random() * questions.length );
6119 }
6120
6121 if (mathDiff == -1) {
6122 questions = [randNum(1,400) + " + " + randNum(1,20),
6123 randNum(1,400) + " - " + randNum(1,300),
6124 randNum(1,400) + " * " + randNum(1,50)];
6125 pickQuestion = Math.floor( Math.random() * questions.length );
6126 }
6127
6128 // difficulty settings
6129 if (!asked) {
6130 // life easter egg
6131 if (mathDiff == -1) {
6132 question = questions[pickQuestion];
6133 while (eval(question) != 42) {
6134 questions = [randNum(1,400) + " + " + randNum(1,400),
6135 randNum(1,400) + " - " + randNum(1,400),
6136 randNum(1,400) + " * " + randNum(1,400)];
6137
6138 pickQuestion = Math.floor( Math.random() * questions.length );
6139 question = questions[pickQuestion];
6140 }
6141
6142 sendChat("What\u034f i\u034fs " + question + "\u034f? (to answer type "+cmdChar+"math <answer>). Difficulty - " + mathDiffTxt);
6143 asked = true;
6144
6145 // cheater >:3
6146 if (mathCheat) setTimeout( function() { MPP.chat.send(""+cmdChar+"math " + eval(question)) }, randNum(1000, 2500));
6147
6148 } else {
6149 question = questions[pickQuestion]; //fix impossible answers
6150 //sendChat("What is " + question + "? (to answer type !math <answer>). Difficulty - " + mathDiffTxt);
6151 sendChat("What\u034f i\u034fs " + question + "\u034f? (to answer type "+cmdChar+"math <answer>). Difficulty - " + mathDiffTxt);
6152 asked = true;
6153
6154 // cheater >:3
6155 if (mathCheat) setTimeout( function() { MPP.chat.send(""+cmdChar+"math " + eval(question)) }, randNum(1000, 2500));
6156 }
6157
6158 } else {
6159 if (message.substring(5).trim() == eval(question)) {
6160 sendChat(name + " answered correctly with " + message.substring(5).trim() + " on " + mathDiffTxt + " difficulty (questions answered " + ++mathAnswered +")");
6161 asked = false;
6162 } else {
6163 sendChat("Try again, " + name + ". The question was " + question + ". Too hard? Type "+cmdChar+"mathhelp");
6164 // cheater >:3
6165 if (mathCheat) setTimeout( function() { MPP.chat.send(cmdChar+"math " + eval(question)) }, randNum(1000, 2500));
6166 }
6167 }
6168
6169 } else if (cmd == cmdChar+"mathskip") {
6170 asked = false;
6171 sendChat("Skipping question. (questions skipped " + ++mathSkipped + ")");
6172
6173 } else if (cmd == cmdChar+"meth") {
6174 sendChat('Did you mean '+cmdChar+'"math"?');
6175
6176 // unit conversions start
6177
6178 } else if (cmd == cmdChar+"unitc") {
6179 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)");
6180
6181 // Celsius to Fahrenheit
6182 } else if (cmd == cmdChar+"ctof") {
6183 var fTemp = message.substring(6).trim() * (9 / 5) + 32;
6184 var outcome = fTemp.toString();
6185 if (message.substring(6).trim() == "" || isNaN(fTemp)) {
6186 sendChat("Usage: "+cmdChar+"ctof <unit> eg: 32.");
6187 } else {
6188 sendChat(message.substring(6).trim() + " Celsius equals: " + outcome.substring(0, 6) + " in Fahrenheit.");
6189 }
6190
6191 // Fahrenheit to Celsius
6192 } else if (cmd == cmdChar+"ftoc") {
6193 var cTemp = (message.substring(6).trim() - 32) * (5 / 9);
6194 var outcome = cTemp.toString();
6195 if (message.substring(6).trim() == "" || isNaN(cTemp)) {
6196 sendChat("Usage: "+cmdChar+"ftoc <unit> eg: 74.");
6197 } else {
6198 sendChat(message.substring(6).trim() + " Fahrenheit equals: " + outcome.substring(0, 6) + " in Celsius.");
6199 }
6200
6201 // Centimetres to Inches
6202 } else if (cmd == cmdChar+"cmtoinch") {
6203 var cmTemp = message.substring(10).trim() * 0.39370;
6204 var outcome = cmTemp.toString();
6205 if (message.substring(10).trim() == "" || isNaN(cmTemp)) {
6206 sendChat("Usage: "+cmdChar+"cmtoinch <unit> eg: 30.");
6207 } else {
6208 sendChat(message.substring(10).trim() + " Centimetres equals: " + outcome.substring(0, 6) + " inches.");
6209 }
6210
6211 // Inches to Centimetres
6212 } else if (cmd == cmdChar+"inchtocm") {
6213 var cmTemp = message.substring(10).trim() / 0.39370;
6214 var outcome = cmTemp.toString();
6215 if (message.substring(10).trim() == "" || isNaN(cmTemp)) {
6216 sendChat("Usage: "+cmdChar+"inches <unit> eg: 6.");
6217 } else {
6218 sendChat(message.substring(10).trim() + " Inches equals: " + outcome.substring(0, 6) + " Centimetres.");
6219 }
6220
6221 // Centimetres to Feet
6222 } else if (cmd == cmdChar+"cmtofeet") {
6223 var cmTemp = message.substring(10).trim() * 0.032808;
6224 var outcome = cmTemp.toString();
6225 if (message.substring(10).trim() == "" || isNaN(cmTemp)) {
6226 sendChat("Usage: "+cmdChar+"cmtofeet <unit> eg: 5.");
6227 } else {
6228 sendChat(message.substring(10).trim() + " Centimetres equals: " + outcome.substring(0, 6) + " feet.");
6229 }
6230
6231 // Feet to Centimetres
6232 } else if (cmd == cmdChar+"feettocm") {
6233 var cmTemp = message.substring(10).trim() / 0.032808;
6234 var outcome = cmTemp.toString();
6235 if (message.substring(10).trim() == "" || isNaN(cmTemp)) {
6236 sendChat("Usage: "+cmdChar+"feettocm <unit> eg: 5.");
6237 } else {
6238 sendChat(message.substring(10).trim() + " Feet equals: " + outcome.substring(0, 6) + " Centimetres.");
6239 }
6240
6241 // Kilometres to Miles
6242 } else if (cmd == cmdChar+"kmtomile") {
6243 var cmTemp = message.substring(10).trim() / 0.62137;
6244 var outcome = cmTemp.toString();
6245 if (message.substring(10).trim() == "" || isNaN(cmTemp)) {
6246 sendChat("Usage: "+cmdChar+"kmtomile <unit> eg: 50.");
6247 } else {
6248 sendChat(message.substring(10).trim() + " Kilometres equals: " + outcome.substring(0, 5) + " Miles.");
6249 }
6250
6251 // Miles to Kilometres
6252 } else if (cmd == cmdChar+"miletokm") {
6253 var cmTemp = message.substring(10).trim() * 0.62137;
6254 var outcome = cmTemp.toString();
6255 if (message.substring(10).trim() == "" || isNaN(cmTemp)) {
6256 sendChat("Usage: "+cmdChar+"miletokm <unit> eg: 80");
6257 } else {
6258 sendChat(message.substring(10).trim() + " Miles equals: " + outcome.substring(0, 5) + " Kilometres.");
6259 }
6260 // unit conversions end
6261
6262 // stab command
6263 } else if (cmd == cmdChar+"stab") {
6264 var target = msg.a.substring(cmd.length).trim();
6265 var part = getUser(target.toLowerCase());
6266 if (target == "") {
6267 sendChat("Usage "+cmdChar+"stab name_here.");
6268 return;
6269 }
6270 if (part) {
6271 if (part.name == name) {
6272 sendChat("\"Ouch!\" says " + part.name);
6273 return;
6274 }
6275 sendChat(name + " stabbed " + part.name +".");
6276 } else {
6277 sendChat(userNotFound);
6278 }
6279
6280 } else if (cmd == cmdChar+"highfive") { //highfive command
6281 var target = msg.a.substring(cmd.length).trim();
6282 var part = getUser(target.toLowerCase());
6283 if (target == "") {
6284 sendChat("Usage "+cmdChar+"highfive name_here.");
6285 return;
6286 }
6287 if (part) {
6288 if (part.name == name) {
6289 sendChat(part.name + " claps in the corner.. by themself.");
6290 return;
6291 }
6292 sendChat(name + " highfived " + part.name + ".");
6293 } else {
6294 sendChat(userNotFound);
6295 }
6296
6297 } else if (cmd == cmdChar+"kiss") { //kiss command
6298 var target = msg.a.substring(cmd.length).trim();
6299 var part = getUser(target.toLowerCase());
6300 if (target == "") {
6301 sendChat("Usage "+cmdChar+"kiss name_here.");
6302 return;
6303 }
6304
6305 if (usersDead.indexOf(ids) !== -1) {
6306 sendChat("Is too weak to kiss anyone... maybe a kiss would wake them up?");
6307 return;
6308 }
6309
6310 if (part) {
6311 if (part.name == name) {
6312 sendChat(name + " scrunches up their face, sucking their bottom lip inside their mouth.");
6313 return;
6314 }
6315
6316 if (usersDead.indexOf(part._id) !== -1) {
6317 sendChat(name + '\'s kiss brought ' + part.name + ' back to life.');
6318 usersDead.splice(usersDead.indexOf(ids), 1);
6319
6320 } else {
6321 var kissArray = ['bottom', 'top'];
6322 var lip = Math.floor(Math.random() * kissArray.length);
6323 var kissTypeArray = ['passionately', 'softly', 'shyly', 'nervously', 'cutely', 'holds and'];
6324 var kissType = Math.floor(Math.random() * kissTypeArray.length);
6325 sendChat(name + " " + kissTypeArray[kissType] + " kisses " + part.name + "'s " + kissArray[lip] + " lip. " + part.name + " blushes shyly.");
6326 }
6327 } else {
6328 sendChat(userNotFound);
6329 }
6330
6331 } else if (cmd == cmdChar+"slap") { //slap command
6332 var target = msg.a.substring(cmd.length).trim();
6333 var part = getUser(target.toLowerCase());
6334 if (target == "") {
6335 sendChat("Usage "+cmdChar+"slap name_here.");
6336 return;
6337 }
6338 if (part) {
6339 if (part.name == name) {
6340 sendChat("You cannot slap yourself, that would be awkward.");
6341 return;
6342 }
6343 sendChat(name + " slapped " + part.name);
6344 } else {
6345 sendChat(userNotFound);
6346 }
6347
6348 } else if (cmd == cmdChar+"cuddle") { //cuddle command
6349 var target = msg.a.substring(cmd.length).trim();
6350 var part = getUser(target.toLowerCase());
6351 if (target == "") {
6352 sendChat("Usage "+cmdChar+"cuddle name_here.");
6353 return;
6354 }
6355 if (part) {
6356 if (part.name == name) {
6357 sendChat("You cannot cuddle yourself, you lonely fuck!");
6358 return;
6359 }
6360 var cuddleArray = ['tightly cuddles', 'softly cuddles', 'shyly cuddles', 'tenderly cuddles', 'cuddles'];
6361 var cuddle = Math.floor(Math.random() * cuddleArray.length);
6362 sendChat(name + " " + cuddleArray[cuddle] + " " + part.name + ".");
6363 } else {
6364 sendChat(userNotFound);
6365 }
6366
6367 } else if (cmd == cmdChar+"hug") { //hug command
6368 var target = msg.a.substring(cmd.length).trim();
6369 var part = getUser(target.toLowerCase());
6370 if (target == "") {
6371 sendChat("Usage "+cmdChar+"hug name_here.");
6372 return;
6373 }
6374 if (part) {
6375 if (part.name == name) {
6376 sendChat("You cannot hug yourself, hug a cuddly anon.");
6377 return;
6378 }
6379 var hugArray = [' tightly squeezes ', ' sprints up and hugs ', ' shyly hugs ', ' gently caresses ', ' tounge hugs '];
6380 var hug = Math.floor(Math.random() * hugArray.length);
6381 sendChat(name + hugArray[hug] + part.name + ".");
6382 } else {
6383 sendChat(userNotFound);
6384 }
6385
6386 } else if (cmd == cmdChar+"rape") { //rape command
6387 var target = msg.a.substring(cmd.length).trim();
6388 var part = getUser(target.toLowerCase());
6389 if (target == "") {
6390 sendChat("Usage "+cmdChar+"rape name_here.");
6391 return;
6392 }
6393 if (part) {
6394 if (part.name == name) {
6395 sendChat("You cannot rape yourself, rape the Anonymous people.");
6396 return;
6397 }
6398 sendChat(name + " raped " + part.name + " ᶘᵒᴥᵒᶅ");
6399 } else {
6400 sendChat(userNotFound);
6401 }
6402
6403 } else if (cmd == cmdChar+"gift") { //gift command
6404 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
6405 var randomNumber = Math.floor(Math.random() * giftArray.length);
6406 var target = msg.a.substring(cmd.length).trim();
6407 var part = getUser(target.toLowerCase());
6408 if (target == "") {
6409 sendChat("Usage "+cmdChar+"gift name_here.");
6410 return;
6411 }
6412 if (part) {
6413 if (part.name == name) {
6414 sendChat("You cannot gift yourself, that would be greedy.");
6415 return;
6416 }
6417 sendChat(name + " gave " + part.name + " " + giftArray[randomNumber]);
6418 } else {
6419 sendChat(userNotFound);
6420 }
6421
6422 } else if (cmd == cmdChar+"attack") { //attack command
6423 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'];
6424 var randomNumber = Math.floor(Math.random() * attackArray.length);
6425 var target = msg.a.substring(cmd.length).trim();
6426 var part = getUser(target.toLowerCase());
6427 if (target == "") {
6428 sendChat("Usage "+cmdChar+"attack name_here.");
6429 return;
6430 }
6431 if (part) {
6432 if (part.name == name) {
6433 sendChat("You cannot attack yourself, attack the Anonymous people.");
6434 return;
6435 }
6436 sendChat(name + " attacked " + part.name + " with a " + attackArray[randomNumber] + ".");
6437 } else {
6438 sendChat(userNotFound);
6439 }
6440
6441 } else if (cmd == cmdChar+"colour" || cmd == cmdChar+"color") { //colour command
6442 //thanks electrashave!
6443 if (msg.a.substring(cmd.length).trim() == '') {
6444 sendChat("Your colour is " + new Color(msg.p.color).getName() + " (" + msg.p.color + ") (You can also type "+cmdChar+"colour name_here)");
6445 return;
6446 }
6447
6448 var target = msg.a.substring(cmd.length).trim();
6449 var part = getUser(target.toLowerCase());
6450
6451 if (part) {
6452 sendChat(part.name + "'s colour is " + new Color(part.color).getName() + " (" + part.color + ")");
6453 } else {
6454 sendChat(userNotFound);
6455 }
6456
6457 } else if (cmd == cmdChar+"unicode") { //unicode command
6458 sendChat("Put some of these in your name: ᴥ◕☀☁☂☃☄★☆☇☈☉☊☋☌☍ツ¢¢☍☎☏☐☑☒☓☔☕☖☗☘☙☚☛☜☝☞☟☠␀☡☢☣☤☥☦☧☨☩☪☫☬☭☮☯─━│┃┎┒┝┫┳┻╋╭╮╯╰╱╲╳╴╵╶╷╸╹╺╻╼╽╾╿☰☱☲☳☴☵☶☷░▒▓▔▁▂▃▄▅▆▇█▉▊▋▌▐ ▍▎▏◘☸☹☺☻☼☽☾☿ ♀♁♂♃♄♅♆♇♈♉♊♋♌♍♎♏♐♑♒♓♔♕♖♗♘♙♚♛♜♝♞♟♠♢♣♤♥♡♦♧♨♩♪♫♬♭♮♯ ๖ۣۜ ∥~∼˜≀π∏ℍℂℕℙℚℝℤℬℰℱℋℐℒℳ℘ℛℓℴℯɨℊℎ√∑∮‖⌊⌉⋕⊤✀✁✂✃✄✆✇✈✉✌✍✎✏✐✑✒✓✔✕✖✗✘✙✚✛✜✝✞✟✠✡✢✣✤✥✦✧✩✪✫✬✭✮✯✰✱✲✳✴✵✶✷✸✹✺✻✼✽✾✿❀❁❂❃❄❅❆❇❈❉❊❋❍❏❐❑❒❖❡❤❥❦❧❶❷❸❹❺❻❼❽❾❿➀➁➂➃➄➅➆➇➈➉➔➘➙➚➛➜➝➞➟➠➡➢➣➤➥➦➧➨➩➪➫➬➭➮➯➰➱➲➳➴➵➶➷➸➹➺➻➼➽➾∧⋉⋊⋈ℵ");
6459
6460 } else if (cmd == cmdChar+"clap" || cmd == cmdChar+"applaud") { //clap command
6461 sendChat(name + " applauds.");
6462
6463 } else if (cmd == cmdChar+"slowclap") { //slow clap command
6464 sendChat(name + " claps slowly in approval");
6465
6466 } else if (cmd == cmdChar+"list") { //list command
6467 var list = "Connected users: ";
6468 for (var id in gClient.ppl) {
6469 list += gClient.ppl[id].name + ", ";
6470 }
6471 sendChat(list);
6472 return;
6473
6474 } else if (cmd == cmdChar+"facepalm") { //facepalm command
6475 sendChat(name + " facepalmed.");
6476
6477 } else if (cmd == cmdChar+"musicsheets" || cmd == cmdChar+"ms") { //musicsheets command
6478 var songArray = ['Logan’s small march: xbm. cbm/ xvj. gj. gj, xbm xbm. cb,/ n,ry k.r wtbk etb,',
6479 'Dramatic song: C E 5 E Y E Y U | S E 5 E 8 U Y U | A E 5 E Y E Y U | (Ctrl M) E 5 E 8 U Y 5',
6480 'Part of Turkich March - [ - o i o i 8 7 i 8 7 y 7 8 y 4 5 t 4 7 y 7 8 i 8 i o - p - [ -',
6481 'C. P. E. Bach Solfeggietto: g c m e 5 r e w m w r u y 5 r 5 e 5 u p = [ p [ p o i u y 5 r',
6482 'Gravity Falls: N V Z V N V Z V N C Z C N C Z C B F Z F B F Z F B F Z F B F Z ',
6483 'My Immortal: z4 tb qi t - t i t f4 tk 48 t - z4 tb qi t o t i t f4 tk 48 t',
6484 'Song of Stroms: v r yi yi b t uo n y ip ip b t uo',
6485 'C minor: c v g n m k l /',
6486 'Skrillex - Scary Monsters: m u y u g9 u [ p 9 y 2 q y 5 nr e 2 m 2 m 2 r u r 2 m y 2 m n',
6487 'B major: x f g b j k l .',
6488 'Colombia Pictures: 8 p 9 y | 4 y 5 e | k / l n | f n g c | acgk',
6489 'Fandango: ttytyt8o ttytytip ttytyt8o ttytytip',
6490 'Eb fun: f n . | g m l | 4 y o | 5 u 9',
6491 'The Entertainer LH: e tup m u9p yn yip tb tup m yu m yu m etup etup',
6492 'Same Love: (Hold G) L M L GC ~ (Hold A) G C G (Hold G) J-M ~ (Hold G) L M L GC ~ (Hold A) G C G (Let go of A) GS',
6493 'Tetris: T W E R R E Q Q E T R E W W E R T E Q Q R Y I U Y T E T R E W W E R T E Q Q',
6494 'Mad World: N8 P 1EU 8 NY U 1E5 R 2 RY 2 RY 8 N P 1EU 8 NY U 1E8 9 2 RY 2 RY',
6495 'E minor: b j m , . / r t',
6496 'Happy Birthday: E E NQR E Y CLT E E CLR E U NQY E E NQP I Y NLT R 9 9 NQI Y CLU NQY',
6497 'Darude Sandstorm: r7i tuo tuo tuo tuo up] tuo tuo tuo tuo up] tuo tuo tuo tuo up] up] uo[ uo[ r7i tuo',
6498 'Yoshi\'s Epic Morrowind: E R 5CGM 5 Y UGL U 9 YSVN 5 R EACG E R 5CGM 5 Y UGL U 9 PGKE 9URM 8YP'];
6499 var randomSong = Math.floor(Math.random() * songArray.length);
6500 sendChat("Songs for PC players: " + sheetURL + " here's a random sample - " + songArray[randomSong] + " (Notes updated 6th June 2015)"); //update when you update link, Logan
6501
6502 } else if (cmd == cmdChar+"suicide") { //suicide command
6503 if (usersDead.indexOf(ids) == -1) {
6504 sendChat(name + " kissed Logan and died x3");
6505 usersDead.push(ids);
6506
6507 } else {
6508 sendChat(name + " is too weak to kiss Logan... Maybe a kiss would wake them up?");
6509 }
6510
6511 } else if (cmd == cmdChar+"kill") { //kill command
6512 var target = msg.a.substring(cmd.length).trim();
6513 var part = getUser(target.toLowerCase());
6514 if (target == "") {
6515 sendChat("Usage "+cmdChar+"kill name_here.");
6516 return;
6517 }
6518 if (part) {
6519 if (part.name == name) {
6520 if (usersDead.indexOf(part._id) == -1) {
6521 sendChat(name + " commitsed suicide!");
6522 usersDead.push(part._id);
6523 } else {
6524 sendChat(name + "'s body twitches... Maybe a kiss would wake them up?");
6525 }
6526 return;
6527 }
6528 if (usersDead.indexOf(part._id) == -1) {
6529 sendChat(name + " killed " + part.name + "!");
6530 usersDead.push(part._id)
6531 } else {
6532 sendChat(part.name + " body twitches... Maybe a kiss would wake them up?");
6533 }
6534 } else {
6535 sendChat(userNotFound);
6536 }
6537
6538 //text art
6539 } else if (cmd == cmdChar+"art") { //art command
6540 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).");
6541
6542 } else if (cmd == cmdChar+"hamster2") { //hamster 2 art command
6543 setTimeout(function() { sendChat("( ) ( )" ); }, 0);
6544 setTimeout(function() { sendChat("(>•.•<)" ); }, 0);
6545 setTimeout(function() { sendChat('(") (")' ); }, 0);
6546
6547 } else if (cmd == cmdChar+"hamster") { //hamster art command
6548 setTimeout(function() { sendChat("( )_( )" ); }, 0);
6549 setTimeout(function() { sendChat("(='.'=)" ); }, 0);
6550 setTimeout(function() { sendChat('(")_(")' ); }, 0);
6551
6552 } else if (cmd == cmdChar+"bunny4") { //bunny 4 art command
6553 setTimeout(function() { sendChat("(\\(\\" ); }, 0);
6554 setTimeout(function() { sendChat("(=\".\")" ); }, 0);
6555 setTimeout(function() { sendChat('("")("")' ); }, 0);
6556
6557 } else if (cmd == cmdChar+"bunny3") { //bunny 3 art command
6558 setTimeout(function() { sendChat("(\\_(\\" ); }, 0);
6559 setTimeout(function() { sendChat("(˚_˚)" ); }, 0);
6560 setTimeout(function() { sendChat("('')('')" ); }, 0);
6561
6562 } else if (cmd == cmdChar+"bunny2") { //bunny 2 art command
6563 setTimeout(function() { sendChat("/)_/)" ); }, 0);
6564 setTimeout(function() { sendChat("(0.0)" ); }, 0);
6565 setTimeout(function() { sendChat("('')('')" ); }, 0);
6566
6567 } else if (cmd == cmdChar+"bunny") { //bunny art command
6568 setTimeout(function() { sendChat("(\\_/)" ); }, 0);
6569 setTimeout(function() { sendChat("(o.o)" ); }, 0);
6570 setTimeout(function() { sendChat("('')('')" ); }, 0);
6571
6572 } else if (cmd == cmdChar+"table") { //table art command
6573 setTimeout(function() { sendChat("(╮°-°)╮┳━━┳" ); }, 0);
6574 setTimeout(function() { sendChat("( ╯°□°)╯ ┻━━┻" ); }, 0);
6575 setTimeout(function() { sendChat("┬──┬ ノ( ゜-゜ノ)" ); }, 0);
6576 //text art
6577
6578 } else if (cmd == cmdChar+"fishies") { //fishies command
6579 if (gClient.isOwner()) {
6580 sendChat("╭━━╮╭━━━┳╮╭╮╭╮╭━━━┳━━━┳╮╭╮╭┳━╮╱╭╮╭━━━┳━━┳━━━┳╮╱╭┳━━┳━━━┳━━━╮ ╭╮" );
6581 sendChat("┃╭╮┃┃╭━╮┃┃┃┃┃┃╰╮╭╮┃╭━╮┃┃┃┃┃┃┃╰╮┃┃┃╭━━┻┫┣┫╭━╮┃┃╱┃┣┫┣┫╭━━┫╭━╮┃ ┃┃" );
6582 sendChat("┃╰╯╰┫┃╱┃┃┃┃┃┃┃╱┃┃┃┃┃╱┃┃┃┃┃┃┃╭╮╰╯┃┃╰━━╮┃┃┃╰━━┫╰━╯┃┃┃┃╰━━┫╰━━╮ ┃┃" );
6583 sendChat("┃╭━╮┃┃╱┃┃╰╯╰╯┃╱┃┃┃┃┃╱┃┃╰╯╰╯┃┃╰╮┃┃┃╭━━╯┃┃╰━━╮┃╭━╮┃┃┃┃╭━━┻━━╮┃ ╰╯" );
6584 sendChat("┃╰━╯┃╰━╯┣╮╭╮╭╯╭╯╰╯┃╰━╯┣╮╭╮╭┫┃╱┃┃┃┃┃╱╱╭┫┣┫╰━╯┃┃╱┃┣┫┣┫╰━━┫╰━╯┃ ╭╮" );
6585 sendChat("╰━━━┻━━━╯╰╯╰╯╱╰━━━┻━━━╯╰╯╰╯╰╯╱╰━╯╰╯╱╱╰━━┻━━━┻╯╱╰┻━━┻━━━┻━━━╯ ╰╯" );
6586 sendChat("╭━━━┳━━━┳━━━┳━━━┳━━━┳━━━┳━━━┳━━━┳━━━┳━━━┳━━━┳━━━┳━━━┳━━━┳━━╮" );
6587 sendChat("╰━━━┻━━━┻━━━┻━━━┻━━━┻━━━┻━━━┻━━━┻━━━┻━━━┻━━━┻━━━┻━━━┻━━━┻━━╯" );
6588 sendChat("><> \\o/" );
6589 } else {
6590 sendChat("I need the crown to show fishies in its entirety!");
6591 }
6592
6593 } else if (cmd == cmdChar+"face") { //face command
6594 var textArray = ['╥﹏╥', '(◕ᴥ◕し)', 'ʕ•ᴥ•ʔ', '(◡‿◡✿)', 'ヽ༼ ಠ益ಠ ༽ノ', '^‿^', 'ᶘ ᵒᴥᵒᶅ', '๏̯͡๏', '^ㅂ^', ' ಠ_ರೃ', '(ノ◕ヮ◕)ノ*:・゚✧', '◕◡◕', 'ಠ▃ಠ', 'ಠ╭╮ಠ', 'ಠ⌣ಠ', 'ಠ◡ಠ', 'ლ(ಠ益ಠლ)', 'ლ(◉◞౪◟◉‵ლ)', '⊙ω⊙', '⊙▂⊙', '╯‵Д′)╯彡┻━┻', '◕ω◕', '⌒▽⌒', '♥◡♥', '。◕‿‿◕。', '。◕ ‿ ◕。', '(´◉◞౪◟◉)', 'Ծ‸ Ծ', '(ᵔᴥᵔ)', '• ε •', '(⌐■_■)', '(┛◉Д◉)┛┻━┻', '(╯°□°)╯︵ ┻━┻ ', '◕ ^ ◕', '(☞゚ ∀゚ )☞', '(づ。◕‿‿◕。)づ', '(ノಠ益ಠ)ノ彡┻━┻', ';一_一', '\(◕ ◡ ◕\)', '°-°', '¶_¶', '( ͡° ͜ʖ ͡°)', '|)^_^(|'];
6595 var randomNumber = Math.floor(Math.random() * textArray.length);
6596 sendChat(textArray[randomNumber]);
6597
6598 } else if (cmd == cmdChar+"say") { //say command
6599 if (message.substring(4).trim() == "") {
6600 sendChat("Usage: "+cmdChar+"say text to say.");
6601 return;
6602 }
6603 sendChat(message.substring(5).trim());
6604
6605 } else if (cmd == cmdChar+"rename") { //rename command
6606 if (message.substring(cmd.length).trim() == 0) {
6607 sendChat('Usage: '+cmdChar+'rename new_name');
6608 return;
6609 }
6610 if (message.substring(7).trim() == 420) {
6611 sendChat('Too high!');
6612 return;
6613 }
6614 if (opped) {
6615 updateName(message.substring(7).trim());
6616 selfName = message.substring(7).trim();
6617
6618 } else {
6619 sendChat(noAccess);
6620 }
6621
6622 } else if (cmd == cmdChar+"welcome") { //welcome command
6623 if (opped) {
6624 if (welcTemp) {
6625 welcTemp = false;
6626 sendChat("Room welcoming disabled.");
6627 } else {
6628 welcTemp = true;
6629 sendChat("Room welcoming enabled.");
6630 }
6631 } else {
6632 sendChat(noAccess);
6633 }
6634 } else if (cmd == cmdChar+"tune") { //tune command
6635 if (opped) {
6636 if (tuneTemp) {
6637 tuneTemp = false;
6638 sendChat("Welcome tune disabled.");
6639 } else {
6640 tuneTemp = true;
6641 sendChat("Welcome tune enabled.");
6642 }
6643 } else {
6644 sendChat(noAccess);
6645 }
6646
6647 } else if (cmd == cmdChar+"ban") { //ban command
6648 var target = msg.a.substring(cmd.length).trim();
6649 var part = getUser(target.toLowerCase());
6650
6651 if (opped) {
6652 if (target == "") {
6653 sendChat("Usage "+cmdChar+"ban name_here.");
6654 return;
6655 }
6656 if (part) {
6657 if (banned.indexOf(part._id) !== -1) {
6658 sendChat(part.name + " is already banned!");
6659 return;
6660 }
6661
6662 if (part._id == selfId) { //Logan
6663 sendChat("Banning " + part.name.substring(0, 4).trim() + "... wait.");
6664 } else if (part._id == "4e28d8736f8a464ada652896") { //Yoshify.
6665 sendChat("You cannot ban " + selfName + "'s friend " + part.name + ".");
6666 } else if (part._id == "d9e6170fd899f2a94adea761") { //StarsPiano
6667 sendChat("You cannot ban " + selfName + "'s friend " + part.name + ".");
6668 } else {
6669 banned.push(part._id);
6670 sendChat(name + " banned " + part.name + ".");
6671 }
6672 } else {
6673 sendChat(userNotFound);
6674 }
6675 } else {
6676 sendChat(noAccess);
6677 }
6678
6679 } else if (cmd == cmdChar+"unban") { //unban command
6680 var target = msg.a.substring(cmd.length).trim();
6681 var part = getUser(target.toLowerCase());
6682
6683 if (opped) {
6684 if (target == "") {
6685 sendChat("Usage "+cmdChar+"unban name_here.");
6686 return;
6687 }
6688 if (part) {
6689 if (banned.indexOf(part._id) == -1) {
6690 sendChat(part.name + " isn't banned!");
6691 return;
6692 }
6693
6694 while (banned.indexOf(part._id) !== -1) {
6695 banned.splice(banned.indexOf(part._id), 1);
6696 sendChat(name + " unbanned " + part.name + ".");
6697 }
6698 while (banned.indexOf(part._id) !== -1) {
6699 delete banned[banned.indexOf(part._id)];
6700 }
6701 } else {
6702 sendChat(userNotFound);
6703 }
6704 } else {
6705 sendChat(noAccess);
6706 }
6707
6708 } else if (cmd == cmdChar+"pardon") { //pardon command
6709 if (mastered || opped) {
6710 banned = [];
6711 sendChat(name + " pardoned everyone from being banned.");
6712 } else {
6713 sendChat(noAccess);
6714 }
6715
6716 } else if (cmd == cmdChar+"op") { //op command
6717 var target = msg.a.substring(cmd.length).trim();
6718 var part = getUser(target.toLowerCase());
6719
6720 if (opped) {
6721 if (target == "") {
6722 sendChat("Usage "+cmdChar+"op name_here.");
6723 return;
6724 }
6725 if (part) {
6726 if (ops.indexOf(part._id) !== -1) {
6727 sendChat(part.name + " is already opped!");
6728 return;
6729 }
6730
6731 sendChat("Opped " + part.name + ".");
6732 ops.push(part._id);
6733
6734 } else {
6735 sendChat(userNotFound);
6736 }
6737 } else {
6738 sendChat(noAccess);
6739 }
6740
6741 } else if (cmd == cmdChar+"deop") { //deop command
6742 var target = msg.a.substring(cmd.length).trim();
6743 var part = getUser(target.toLowerCase());
6744
6745 if (opped) {
6746 if (target == "") {
6747 sendChat("Usage "+cmdChar+"deop name_here.");
6748 return;
6749 }
6750 if (part) {
6751 if (ops.indexOf(part._id) == -1) {
6752 sendChat(part.name + " isn't opped!");
6753 return;
6754 }
6755
6756 if (part._id == selfId) { //Logan
6757 sendChat("You cannot deop " + part.name + ".");
6758 } else if (part._id == "4e28d8736f8a464ada652896") { //Yoshify.
6759 sendChat("You cannot deop " + selfName + "'s friend " + part.name + ".");
6760 } else if (part._id == "d9e6170fd899f2a94adea761") { //StarsPiano
6761 sendChat("You cannot deop " + selfName + "'s friend " + part.name + ".");
6762 } else {
6763 while (ops.indexOf(part._id) !== -1) {
6764 ops.splice(banned.indexOf(part._id), 1); //is this meant to say banned?
6765 }
6766 while (ops.indexOf(part._id) !== -1) {
6767 delete ops[ops.indexOf(part._id)];
6768 }
6769 sendChat("Deopped " + part.name + ".");
6770 }
6771 } else {
6772 sendChat(userNotFound);
6773 }
6774 } else {
6775 sendChat(noAccess);
6776 }
6777 } else if (message.substring(0, 1) == cmdChar) { //alternative error messages
6778 if (message.substring(2).trim() == "") {
6779
6780 } else {
6781 //sendChat("Invalid command. Type !help for a list of commands you have access to."); //shhhhh
6782 }
6783 }
6784 }
6785 botLoaded = true;
6786 });
6787
6788 var Color = function () {
6789 var r, g, b;
6790 if (arguments.length === 1) {
6791 var hexa = arguments[0].toLowerCase();
6792 if (hexa.match(/^#[0-9a-f]{6}$/i)) {
6793 hexa = /^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(hexa);
6794 if (hexa && hexa.length === 4) {
6795 r = parseInt(hexa[1], 16);
6796 g = parseInt(hexa[2], 16);
6797 b = parseInt(hexa[3], 16);
6798 }
6799 }
6800 } else if (arguments.length === 3) {
6801 r = arguments[0];
6802 g = arguments[1];
6803 b = arguments[2];
6804 }
6805 this.r = ~~r || 0;
6806 this.g = ~~g || 0;
6807 this.b = ~~b || 0;
6808 };
6809
6810 Color.prototype.distance = function (color) {
6811 var d = 0;
6812 d += Math.pow(this.r - color.r, 2);
6813 d += Math.pow(this.g - color.g, 2);
6814 d += Math.pow(this.b - color.b, 2);
6815 return Math.abs(Math.sqrt(d));
6816 };
6817
6818 Color.prototype.toHexa = function () {
6819 var r = this.r.toString(16),
6820 g = this.g.toString(16),
6821 b = this.b.toString(16);
6822 if (r.length == 1) r = "0" + r;
6823 if (g.length == 1) g = "0" + g;
6824 if (b.length == 1) b = "0" + b;
6825 return "#" + r + g + b;
6826 };
6827
6828 Color.prototype.getName = function () {
6829 var hexa = this.toHexa();
6830 var low = 256;
6831 var name;
6832 for (var n in Color.map) {
6833 if (!Color.map.hasOwnProperty(n)) continue;
6834 var color = Color.map[n];
6835 if (color.r === this.r && color.g === this.g && color.b === this.b) {
6836 return n;
6837 }
6838 var dist = this.distance(color);
6839 if (dist < low) {
6840 low = dist;
6841 name = n;
6842 }
6843 }
6844 if (!name) name = this.toHexa();
6845 else name = "a shade of " + name;
6846 return name;
6847 };
6848
6849 Color.map = {};
6850
6851 Color.a = function (hexa, name) {
6852 Color.map[name] = new Color(hexa);
6853 };
6854
6855 Color.a("#7CB9E8", "Aero");
6856 Color.a("#C9FFE5", "Aero blue");
6857 Color.a("#B284BE", "African purple");
6858 Color.a("#5D8AA8", "Air Force blue (RAF)");
6859 Color.a("#00308F", "Air Force blue (USAF)");
6860 Color.a("#72A0C1", "Air superiority blue");
6861 Color.a("#AF002A", "Alabama Crimson");
6862 Color.a("#F0F8FF", "Alice blue");
6863 Color.a("#E32636", "Alizarin crimson");
6864 Color.a("#C46210", "Alloy orange");
6865 Color.a("#EFDECD", "Almond");
6866 Color.a("#E52B50", "Amaranth");
6867 Color.a("#F19CBB", "Amaranth pink");
6868 Color.a("#AB274F", "Dark amaranth");
6869 Color.a("#3B7A57", "Amazon");
6870 Color.a("#FF7E00", "Amber");
6871 Color.a("#FF033E", "American rose");
6872 Color.a("#9966CC", "Amethyst");
6873 Color.a("#A4C639", "Android green");
6874 Color.a("#F2F3F4", "Anti-flash white");
6875 Color.a("#CD9575", "Antique brass");
6876 Color.a("#665D1E", "Antique bronze");
6877 Color.a("#915C83", "Antique fuchsia");
6878 Color.a("#841B2D", "Antique ruby");
6879 Color.a("#FAEBD7", "Antique white");
6880 Color.a("#8DB600", "Apple green");
6881 Color.a("#FBCEB1", "Apricot");
6882 Color.a("#00FFFF", "Aqua");
6883 Color.a("#7FFFD4", "Aquamarine");
6884 Color.a("#4B5320", "Army green");
6885 Color.a("#3B444B", "Arsenic");
6886 Color.a("#8F9779", "Artichoke");
6887 Color.a("#B2BEB5", "Ash grey");
6888 Color.a("#87A96B", "Asparagus");
6889 Color.a("#FDEE00", "Aureolin");
6890 Color.a("#6E7F80", "AuroMetalSaurus");
6891 Color.a("#568203", "Avocado");
6892 Color.a("#007FFF", "Azure");
6893 Color.a("#F0FFFF", "Azure mist/web");
6894 Color.a("#89CFF0", "Baby blue");
6895 Color.a("#A1CAF1", "Baby blue eyes");
6896 Color.a("#FEFEFA", "Baby powder");
6897 Color.a("#FF91AF", "Baker-Miller pink");
6898 Color.a("#21ABCD", "Ball blue");
6899 Color.a("#FAE7B5", "Banana Mania");
6900 Color.a("#FFE135", "Banana yellow");
6901 Color.a("#E0218A", "Barbie pink");
6902 Color.a("#7C0A02", "Barn red");
6903 Color.a("#848482", "Battleship grey");
6904 Color.a("#98777B", "Bazaar");
6905 Color.a("#9F8170", "Beaver");
6906 Color.a("#F5F5DC", "Beige");
6907 Color.a("#2E5894", "B'dazzled blue");
6908 Color.a("#9C2542", "Big dip o’ruby");
6909 Color.a("#FFE4C4", "Bisque");
6910 Color.a("#3D2B1F", "Bistre");
6911 Color.a("#967117", "Bistre brown");
6912 Color.a("#CAE00D", "Bitter lemon");
6913 Color.a("#648C11", "Bitter lime");
6914 Color.a("#FE6F5E", "Bittersweet");
6915 Color.a("#BF4F51", "Bittersweet shimmer");
6916 Color.a("#000000", "Black with no soul!");
6917 Color.a("#3D0C02", "Black bean");
6918 Color.a("#253529", "Black leather jacket");
6919 Color.a("#3B3C36", "Black olive");
6920 Color.a("#FFEBCD", "Blanched almond");
6921 Color.a("#A57164", "Blast-off bronze");
6922 Color.a("#318CE7", "Bleu de France");
6923 Color.a("#ACE5EE", "Blizzard Blue");
6924 Color.a("#FAF0BE", "Blond");
6925 Color.a("#0000FF", "Blue");
6926 Color.a("#1F75FE", "Blue (Crayola)");
6927 Color.a("#0093AF", "Blue (Munsell)");
6928 Color.a("#0087BD", "Blue (NCS)");
6929 Color.a("#333399", "Blue (pigment)");
6930 Color.a("#0247FE", "Blue (RYB)");
6931 Color.a("#A2A2D0", "Blue Bell");
6932 Color.a("#6699CC", "Blue-gray");
6933 Color.a("#0D98BA", "Blue-green");
6934 Color.a("#126180", "Blue sapphire");
6935 Color.a("#8A2BE2", "Blue-violet");
6936 Color.a("#5072A7", "Blue yonder");
6937 Color.a("#4F86F7", "Blueberry");
6938 Color.a("#1C1CF0", "Bluebonnet");
6939 Color.a("#DE5D83", "Blush");
6940 Color.a("#79443B", "Bole Brown");
6941 Color.a("#0095B6", "Bondi blue");
6942 Color.a("#E3DAC9", "Bone");
6943 Color.a("#CC0000", "Boston University Red");
6944 Color.a("#006A4E", "Bottle green");
6945 Color.a("#873260", "Boysenberry");
6946 Color.a("#0070FF", "Brandeis blue");
6947 Color.a("#B5A642", "Brass");
6948 Color.a("#CB4154", "Brick red");
6949 Color.a("#1DACD6", "Bright cerulean");
6950 Color.a("#66FF00", "Bright green");
6951 Color.a("#BF94E4", "Bright lavender");
6952 Color.a("#D891EF", "Bright lilac");
6953 Color.a("#C32148", "Bright maroon");
6954 Color.a("#1974D2", "Bright navy blue");
6955 Color.a("#FF007F", "Bright pink");
6956 Color.a("#08E8DE", "Bright turquoise");
6957 Color.a("#D19FE8", "Bright ube");
6958 Color.a("#F4BBFF", "Brilliant lavender");
6959 Color.a("#FF55A3", "Brilliant rose");
6960 Color.a("#FB607F", "Brink pink");
6961 Color.a("#004225", "British racing green");
6962 Color.a("#CD7F32", "Bronze");
6963 Color.a("#737000", "Bronze Yellow");
6964 Color.a("#964B00", "Brown");
6965 Color.a("#6B4423", "Brown-nose");
6966 Color.a("#FFC1CC", "Bubble gum");
6967 Color.a("#E7FEFF", "Bubbles");
6968 Color.a("#F0DC82", "Buff");
6969 Color.a("#7BB661", "Bud green");
6970 Color.a("#480607", "Bulgarian rose");
6971 Color.a("#800020", "Burgundy");
6972 Color.a("#DEB887", "Burlywood");
6973 Color.a("#CC5500", "Burnt orange");
6974 Color.a("#8A3324", "Burnt umber");
6975 Color.a("#BD33A4", "Byzantine");
6976 Color.a("#702963", "Byzantium");
6977 Color.a("#536872", "Cadet");
6978 Color.a("#5F9EA0", "Cadet blue");
6979 Color.a("#91A3B0", "Cadet grey");
6980 Color.a("#006B3C", "Cadmium green");
6981 Color.a("#ED872D", "Cadmium orange");
6982 Color.a("#E30022", "Cadmium red");
6983 Color.a("#FFF600", "Cadmium yellow");
6984 Color.a("#A67B5B", "Cafe au lait");
6985 Color.a("#4B3621", "Cafe noir");
6986 Color.a("#1E4D2B", "Cal Poly green");
6987 Color.a("#A3C1AD", "Cambridge Blue");
6988 Color.a("#EFBBCC", "Cameo pink");
6989 Color.a("#78866B", "Camouflage green");
6990 Color.a("#FFEF00", "Canary yellow");
6991 Color.a("#FF0800", "Candy apple red");
6992 Color.a("#E4717A", "Candy pink");
6993 Color.a("#592720", "Caput mortuum");
6994 Color.a("#C41E3A", "Cardinal");
6995 Color.a("#00CC99", "Caribbean green");
6996 Color.a("#960018", "Carmine");
6997 Color.a("#EB4C42", "Carmine pink");
6998 Color.a("#FF0038", "Carmine red");
6999 Color.a("#FFA6C9", "Carnation pink");
7000 Color.a("#99BADD", "Carolina blue");
7001 Color.a("#ED9121", "Carrot orange");
7002 Color.a("#00563F", "Castleton green");
7003 Color.a("#062A78", "Catalina blue");
7004 Color.a("#703642", "Catawba");
7005 Color.a("#C95A49", "Cedar Chest");
7006 Color.a("#92A1CF", "Ceil");
7007 Color.a("#ACE1AF", "Celadon");
7008 Color.a("#007BA7", "Celadon blue");
7009 Color.a("#2F847C", "Celadon green");
7010 Color.a("#4997D0", "Celestial blue");
7011 Color.a("#EC3B83", "Cerise pink");
7012 Color.a("#2A52BE", "Cerulean blue");
7013 Color.a("#6D9BC3", "Cerulean frost");
7014 Color.a("#007AA5", "CG Blue");
7015 Color.a("#E03C31", "CG Red");
7016 Color.a("#A0785A", "Chamoisee");
7017 Color.a("#F7E7CE", "Champagne");
7018 Color.a("#36454F", "Charcoal");
7019 Color.a("#232B2B", "Charleston green");
7020 Color.a("#E68FAC", "Charm pink");
7021 Color.a("#DFFF00", "Chartreuse");
7022 Color.a("#7FFF00", "Chartreuse (web)");
7023 Color.a("#DE3163", "Cherry");
7024 Color.a("#FFB7C5", "Cherry blossom pink");
7025 Color.a("#954535", "Chestnut");
7026 Color.a("#A8516E", "China rose");
7027 Color.a("#AA381E", "Chinese red");
7028 Color.a("#856088", "Chinese violet");
7029 Color.a("#7B3F00", "Chocolate");
7030 Color.a("#FFA700", "Chrome yellow");
7031 Color.a("#98817B", "Cinereous");
7032 Color.a("#E4D00A", "Citrine");
7033 Color.a("#9FA91F", "Citron");
7034 Color.a("#7F1734", "Claret");
7035 Color.a("#FBCCE7", "Classic rose");
7036 Color.a("#0047AB", "Cobalt");
7037 Color.a("#D2691E", "Cocoa brown");
7038 Color.a("#965A3E", "Coconut");
7039 Color.a("#6F4E37", "Coffee Brown");
7040 Color.a("#9BDDFF", "Columbia blue");
7041 Color.a("#002E63", "Cool black");
7042 Color.a("#8C92AC", "Cool grey");
7043 Color.a("#B87333", "Copper");
7044 Color.a("#AD6F69", "Copper penny");
7045 Color.a("#CB6D51", "Copper red");
7046 Color.a("#996666", "Copper rose");
7047 Color.a("#FF3800", "Coquelicot");
7048 Color.a("#FF7F50", "Coral");
7049 Color.a("#F88379", "Coral pink");
7050 Color.a("#FF4040", "Coral red");
7051 Color.a("#893F45", "Cordovan");
7052 Color.a("#FBEC5D", "Corn Yellow");
7053 Color.a("#B31B1B", "Cornell Red");
7054 Color.a("#6495ED", "Cornflower blue");
7055 Color.a("#FFF8DC", "Cornsilk");
7056 Color.a("#FFF8E7", "Cosmic latte");
7057 Color.a("#FFBCD9", "Cotton candy");
7058 Color.a("#FFFDD0", "Cream");
7059 Color.a("#DC143C", "Crimson");
7060 Color.a("#BE0032", "Crimson glory");
7061 Color.a("#00B7EB", "Cyan");
7062 Color.a("#58427C", "Cyber grape");
7063 Color.a("#FFD300", "Cyber yellow");
7064 Color.a("#FFFF31", "Daffodil");
7065 Color.a("#F0E130", "Dandelion");
7066 Color.a("#00008B", "Dark blue");
7067 Color.a("#666699", "Dark blue-gray");
7068 Color.a("#654321", "Dark brown");
7069 Color.a("#5D3954", "Dark byzantium");
7070 Color.a("#A40000", "Dark candy apple red");
7071 Color.a("#08457E", "Dark cerulean");
7072 Color.a("#986960", "Dark chestnut");
7073 Color.a("#CD5B45", "Dark coral");
7074 Color.a("#008B8B", "Dark cyan");
7075 Color.a("#536878", "Dark electric blue");
7076 Color.a("#B8860B", "Dark goldenrod");
7077 Color.a("#A9A9A9", "Dark gray");
7078 Color.a("#013220", "Dark green");
7079 Color.a("#00416A", "Dark imperial blue");
7080 Color.a("#1A2421", "Dark jungle green");
7081 Color.a("#BDB76B", "Dark khaki");
7082 Color.a("#734F96", "Dark lavender");
7083 Color.a("#534B4F", "Dark liver");
7084 Color.a("#543D37", "Dark liver (horses)");
7085 Color.a("#8B008B", "Dark magenta");
7086 Color.a("#003366", "Dark midnight blue");
7087 Color.a("#4A5D23", "Dark moss green");
7088 Color.a("#556B2F", "Dark olive green");
7089 Color.a("#FF8C00", "Dark orange");
7090 Color.a("#9932CC", "Dark orchid");
7091 Color.a("#779ECB", "Dark pastel blue");
7092 Color.a("#03C03C", "Dark pastel green");
7093 Color.a("#966FD6", "Dark pastel purple");
7094 Color.a("#C23B22", "Dark pastel red");
7095 Color.a("#E75480", "Dark pink");
7096 Color.a("#003399", "Dark powder blue");
7097 Color.a("#4F3A3C", "Dark puce");
7098 Color.a("#872657", "Dark raspberry");
7099 Color.a("#8B0000", "Dark red");
7100 Color.a("#E9967A", "Dark salmon");
7101 Color.a("#560319", "Dark Scarlet");
7102 Color.a("#8FBC8F", "Dark sea green");
7103 Color.a("#3C1414", "Dark sienna");
7104 Color.a("#8CBED6", "Dark sky blue");
7105 Color.a("#483D8B", "Dark slate blue");
7106 Color.a("#2F4F4F", "Dark slate gray");
7107 Color.a("#177245", "Dark spring green");
7108 Color.a("#918151", "Dark tan");
7109 Color.a("#FFA812", "Dark tangerine");
7110 Color.a("#CC4E5C", "Dark terra cotta");
7111 Color.a("#00CED1", "Dark turquoise");
7112 Color.a("#D1BEA8", "Dark vanilla");
7113 Color.a("#9400D3", "Dark violet");
7114 Color.a("#9B870C", "Dark yellow");
7115 Color.a("#00703C", "Dartmouth green");
7116 Color.a("#555555", "Davy's grey");
7117 Color.a("#D70A53", "Debian red");
7118 Color.a("#A9203E", "Deep carmine");
7119 Color.a("#EF3038", "Deep carmine pink");
7120 Color.a("#E9692C", "Deep carrot orange");
7121 Color.a("#DA3287", "Deep cerise");
7122 Color.a("#B94E48", "Deep chestnut");
7123 Color.a("#C154C1", "Deep fuchsia");
7124 Color.a("#004B49", "Deep jungle green");
7125 Color.a("#F5C71A", "Deep lemon");
7126 Color.a("#9955BB", "Deep lilac");
7127 Color.a("#CC00CC", "Deep magenta");
7128 Color.a("#D473D4", "Deep mauve");
7129 Color.a("#355E3B", "Deep moss green");
7130 Color.a("#FFCBA4", "Deep peach");
7131 Color.a("#A95C68", "Deep puce");
7132 Color.a("#843F5B", "Deep ruby");
7133 Color.a("#FF9933", "Deep saffron");
7134 Color.a("#00BFFF", "Deep sky blue");
7135 Color.a("#4A646C", "Deep Space Sparkle");
7136 Color.a("#7E5E60", "Deep Taupe");
7137 Color.a("#66424D", "Deep Tuscan red");
7138 Color.a("#BA8759", "Deer");
7139 Color.a("#1560BD", "Denim");
7140 Color.a("#EDC9AF", "Desert sand");
7141 Color.a("#EA3C53", "Desire");
7142 Color.a("#B9F2FF", "Diamond");
7143 Color.a("#696969", "Dim gray");
7144 Color.a("#9B7653", "Dirt");
7145 Color.a("#1E90FF", "Dodger blue");
7146 Color.a("#D71868", "Dogwood rose");
7147 Color.a("#85BB65", "Dollar bill");
7148 Color.a("#664C28", "Donkey Brown");
7149 Color.a("#00009C", "Duke blue");
7150 Color.a("#E5CCC9", "Dust storm");
7151 Color.a("#EFDFBB", "Dutch white");
7152 Color.a("#E1A95F", "Earth yellow");
7153 Color.a("#555D50", "Ebony");
7154 Color.a("#1B1B1B", "Logan's old colour </3"); //Logan's old colour </3
7155 Color.a("#614051", "Eggplant");
7156 Color.a("#F0EAD6", "Eggshell");
7157 Color.a("#1034A6", "Egyptian blue");
7158 Color.a("#7DF9FF", "Electric blue");
7159 Color.a("#FF003F", "Electric crimson");
7160 Color.a("#00FF00", "Electric green");
7161 Color.a("#6F00FF", "Electric indigo");
7162 Color.a("#CCFF00", "Electric lime");
7163 Color.a("#BF00FF", "Electric purple");
7164 Color.a("#3F00FF", "Electric ultramarine");
7165 Color.a("#FFFF00", "Electric yellow");
7166 Color.a("#50C878", "Emerald");
7167 Color.a("#6C3082", "Eminence");
7168 Color.a("#1B4D3E", "English green");
7169 Color.a("#B48395", "English lavender");
7170 Color.a("#AB4B52", "English red");
7171 Color.a("#563C5C", "English violet");
7172 Color.a("#96C8A2", "Eton blue");
7173 Color.a("#44D7A8", "Eucalyptus");
7174 Color.a("#801818", "Falu red");
7175 Color.a("#B53389", "Fandango");
7176 Color.a("#DE5285", "Fandango pink");
7177 Color.a("#F400A1", "Fashion fuchsia");
7178 Color.a("#E5AA70", "Fawn");
7179 Color.a("#4D5D53", "Feldgrau");
7180 Color.a("#4F7942", "Fern green");
7181 Color.a("#FF2800", "Ferrari Red");
7182 Color.a("#6C541E", "Field drab");
7183 Color.a("#B22222", "Firebrick");
7184 Color.a("#CE2029", "Fire engine red");
7185 Color.a("#E25822", "Flame");
7186 Color.a("#FC8EAC", "Flamingo pink");
7187 Color.a("#F7E98E", "Flavescent"); //Logan's new stupid colour?
7188 Color.a("#EEDC82", "Flax");
7189 Color.a("#A2006D", "Flirt");
7190 Color.a("#FFFAF0", "Floral white");
7191 Color.a("#FFBF00", "Fluorescent orange");
7192 Color.a("#FF1493", "Fluorescent pink");
7193 Color.a("#FF004F", "Folly");
7194 Color.a("#014421", "Forest green");
7195 Color.a("#228B22", "Forest green (web)");
7196 Color.a("#856D4D", "French bistre");
7197 Color.a("#0072BB", "French blue");
7198 Color.a("#FD3F92", "French fuchsia");
7199 Color.a("#86608E", "French lilac");
7200 Color.a("#9EFD38", "French lime");
7201 Color.a("#FD6C9E", "French pink");
7202 Color.a("#4E1609", "French puce");
7203 Color.a("#C72C48", "French raspberry");
7204 Color.a("#F64A8A", "French rose");
7205 Color.a("#77B5FE", "French sky blue");
7206 Color.a("#8806CE", "French violet");
7207 Color.a("#AC1E44", "French wine");
7208 Color.a("#A6E7FF", "Fresh Air");
7209 Color.a("#FF77FF", "Fuchsia pink");
7210 Color.a("#CC397B", "Fuchsia purple");
7211 Color.a("#C74375", "Fuchsia rose");
7212 Color.a("#E48400", "Fulvous");
7213 Color.a("#CC6666", "Fuzzy Wuzzy");
7214 Color.a("#DCDCDC", "Gainsboro");
7215 Color.a("#E49B0F", "Gamboge");
7216 Color.a("#007F66", "Generic viridian");
7217 Color.a("#F8F8FF", "Ghost white");
7218 Color.a("#FE5A1D", "Giants orange");
7219 Color.a("#B06500", "Ginger");
7220 Color.a("#6082B6", "Glaucous");
7221 Color.a("#E6E8FA", "Glitter");
7222 Color.a("#00AB66", "GO green");
7223 Color.a("#D4AF37", "Gold (metallic)");
7224 Color.a("#FFD700", "Gold (web) (Golden)");
7225 Color.a("#85754E", "Gold Fusion");
7226 Color.a("#996515", "Golden brown");
7227 Color.a("#FCC200", "Golden poppy");
7228 Color.a("#FFDF00", "Golden yellow");
7229 Color.a("#DAA520", "Goldenrod");
7230 Color.a("#A8E4A0", "Granny Smith Apple");
7231 Color.a("#6F2DA8", "Grape");
7232 Color.a("#808080", "Gray");
7233 Color.a("#BEBEBE", "Gray (X11 gray)");
7234 Color.a("#465945", "Gray-asparagus");
7235 Color.a("#1CAC78", "Green (Crayola)");
7236 Color.a("#008000", "Green");
7237 Color.a("#00A877", "Green (Munsell)");
7238 Color.a("#009F6B", "Green (NCS)");
7239 Color.a("#00A550", "Green (pigment)");
7240 Color.a("#66B032", "Green (RYB)");
7241 Color.a("#ADFF2F", "Green-yellow");
7242 Color.a("#A99A86", "Grullo");
7243 Color.a("#663854", "Halaya ube");
7244 Color.a("#446CCF", "Han blue");
7245 Color.a("#5218FA", "Beyonce Purple");
7246 Color.a("#E9D66B", "Hansa yellow");
7247 Color.a("#3FFF00", "Harlequin");
7248 Color.a("#C90016", "Harvard crimson");
7249 Color.a("#DA9100", "Harvest gold");
7250 Color.a("#DF73FF", "Heliotrope");
7251 Color.a("#AA98A9", "Heliotrope gray");
7252 Color.a("#F0FFF0", "Honeydew");
7253 Color.a("#006DB0", "Honolulu blue");
7254 Color.a("#49796B", "Chloe's green");
7255 Color.a("#FF1DCE", "Hot magenta");
7256 Color.a("#FF69B4", "Hot pink");
7257 Color.a("#71A6D2", "Iceberg");
7258 Color.a("#FCF75E", "Icterine");
7259 Color.a("#319177", "Illuminating Emerald");
7260 Color.a("#602F6B", "Imperial");
7261 Color.a("#002395", "Imperial blue");
7262 Color.a("#66023C", "Imperial purple");
7263 Color.a("#ED2939", "Imperial red");
7264 Color.a("#B2EC5D", "Inchworm");
7265 Color.a("#4C516D", "Independence");
7266 Color.a("#138808", "India green");
7267 Color.a("#CD5C5C", "Indian red");
7268 Color.a("#E3A857", "Indian yellow");
7269 Color.a("#4B0082", "Indigo");
7270 Color.a("#002FA7", "International Klein Blue");
7271 Color.a("#FF4F00", "International orange (aerospace)");
7272 Color.a("#BA160C", "International orange (engineering)");
7273 Color.a("#C0362C", "International orange (Golden Gate Bridge)");
7274 Color.a("#5A4FCF", "Iris");
7275 Color.a("#F4F0EC", "Isabelline");
7276 Color.a("#009000", "Islamic green");
7277 Color.a("#B2FFFF", "Italian sky blue");
7278 Color.a("#FFFFF0", "Ivory");
7279 Color.a("#00A86B", "Jade");
7280 Color.a("#9D2933", "Japanese carmine");
7281 Color.a("#264348", "Japanese indigo");
7282 Color.a("#5B3256", "Japanese violet");
7283 Color.a("#D73B3E", "Jasper");
7284 Color.a("#A50B5E", "Jazzberry jam");
7285 Color.a("#DA614E", "Jelly Bean");
7286 Color.a("#343434", "Jet");
7287 Color.a("#F4CA16", "Jonquil");
7288 Color.a("#8AB9F1", "Jordy blue");
7289 Color.a("#BDDA57", "June bud");
7290 Color.a("#29AB87", "Jungle green");
7291 Color.a("#4CBB17", "Kelly green");
7292 Color.a("#7C1C05", "Kenyan copper");
7293 Color.a("#3AB09E", "Keppel");
7294 Color.a("#C3B091", "Khaki");
7295 Color.a("#E79FC4", "Kobi");
7296 Color.a("#354230", "Kombu green");
7297 Color.a("#E8000D", "KU Crimson");
7298 Color.a("#087830", "La Salle Green");
7299 Color.a("#D6CADD", "Languid lavender");
7300 Color.a("#26619C", "Lapis lazuli");
7301 Color.a("#A9BA9D", "Laurel green");
7302 Color.a("#CF1020", "Lava");
7303 Color.a("#B57EDC", "Lavender (floral)");
7304 Color.a("#CCCCFF", "Lavender blue");
7305 Color.a("#FFF0F5", "Lavender blush");
7306 Color.a("#C4C3D0", "Lavender gray");
7307 Color.a("#9457EB", "Lavender indigo");
7308 Color.a("#EE82EE", "Lavender magenta");
7309 Color.a("#E6E6FA", "Lavender mist");
7310 Color.a("#FBAED2", "Lavender pink");
7311 Color.a("#967BB6", "Lavender purple");
7312 Color.a("#FBA0E3", "Lavender rose");
7313 Color.a("#7CFC00", "Lawn green");
7314 Color.a("#FFF700", "Lemon");
7315 Color.a("#FFFACD", "Lemon chiffon");
7316 Color.a("#CCA01D", "Lemon curry");
7317 Color.a("#FDFF00", "Lemon glacier");
7318 Color.a("#E3FF00", "Lemon lime");
7319 Color.a("#F6EABE", "Lemon meringue");
7320 Color.a("#FFF44F", "Lemon yellow");
7321 Color.a("#1A1110", "Licorice");
7322 Color.a("#545AA7", "Liberty");
7323 Color.a("#FDD5B1", "Light apricot");
7324 Color.a("#ADD8E6", "Light blue");
7325 Color.a("#B5651D", "Light brown");
7326 Color.a("#E66771", "Light carmine pink");
7327 Color.a("#F08080", "Light coral");
7328 Color.a("#93CCEA", "Light cornflower blue");
7329 Color.a("#F56991", "Light crimson");
7330 Color.a("#E0FFFF", "Light cyan");
7331 Color.a("#FF5CCD", "Light deep pink");
7332 Color.a("#C8AD7F", "Light French beige");
7333 Color.a("#F984EF", "Light fuchsia pink");
7334 Color.a("#FAFAD2", "Light goldenrod yellow");
7335 Color.a("#D3D3D3", "Light gray");
7336 Color.a("#90EE90", "Light green");
7337 Color.a("#FFB3DE", "Light hot pink");
7338 Color.a("#F0E68C", "Light khaki");
7339 Color.a("#D39BCB", "Light medium orchid");
7340 Color.a("#ADDFAD", "Light moss green");
7341 Color.a("#E6A8D7", "Light orchid");
7342 Color.a("#B19CD9", "Light pastel purple");
7343 Color.a("#FFB6C1", "Light pink");
7344 Color.a("#E97451", "Light red ochre");
7345 Color.a("#FFA07A", "Light salmon");
7346 Color.a("#FF9999", "Light salmon pink");
7347 Color.a("#20B2AA", "Light sea green");
7348 Color.a("#87CEFA", "Light sky blue");
7349 Color.a("#778899", "Light slate gray");
7350 Color.a("#B0C4DE", "Light steel blue");
7351 Color.a("#B38B6D", "Light taupe");
7352 Color.a("#FFFFE0", "Light yellow");
7353 Color.a("#C8A2C8", "Lilac");
7354 Color.a("#BFFF00", "Lime");
7355 Color.a("#32CD32", "Lime green");
7356 Color.a("#9DC209", "Limerick");
7357 Color.a("#195905", "Prostitute green");
7358 Color.a("#FAF0E6", "Linen");
7359 Color.a("#6CA0DC", "Little boy blue");
7360 Color.a("#B86D29", "Liver (dogs)");
7361 Color.a("#6C2E1F", "Liver");
7362 Color.a("#987456", "Liver chestnut");
7363 Color.a("#FFE4CD", "Lumber");
7364 Color.a("#E62020", "Lust");
7365 Color.a("#FF00FF", "Magenta");
7366 Color.a("#CA1F7B", "Magenta (dye)");
7367 Color.a("#D0417E", "Magenta (Pantone)");
7368 Color.a("#FF0090", "Magenta (process)");
7369 Color.a("#9F4576", "Magenta haze");
7370 Color.a("#AAF0D1", "Magic mint");
7371 Color.a("#F8F4FF", "Magnolia");
7372 Color.a("#C04000", "Mahogany");
7373 Color.a("#6050DC", "Majorelle Blue");
7374 Color.a("#0BDA51", "Malachite");
7375 Color.a("#979AAA", "Manatee");
7376 Color.a("#FF8243", "Mango Tango");
7377 Color.a("#74C365", "Mantis"); //The colour of Mantis (#78cb53) - new fav colour
7378 Color.a("#880085", "Mardi Gras");
7379 Color.a("#800000", "Maroon");
7380 Color.a("#E0B0FF", "Mauve");
7381 Color.a("#915F6D", "Mauve taupe");
7382 Color.a("#EF98AA", "Mauvelous");
7383 Color.a("#4C9141", "May green");
7384 Color.a("#73C2FB", "Maya blue");
7385 Color.a("#E5B73B", "Golden");
7386 Color.a("#66DDAA", "Medium aquamarine");
7387 Color.a("#0000CD", "Medium blue");
7388 Color.a("#E2062C", "Medium candy apple red");
7389 Color.a("#AF4035", "Medium carmine");
7390 Color.a("#035096", "Medium electric blue");
7391 Color.a("#1C352D", "Medium jungle green");
7392 Color.a("#BA55D3", "Medium orchid");
7393 Color.a("#9370DB", "Medium purple");
7394 Color.a("#BB3385", "Medium red-violet");
7395 Color.a("#AA4069", "Medium ruby");
7396 Color.a("#3CB371", "Medium sea green");
7397 Color.a("#80DAEB", "Medium sky blue");
7398 Color.a("#7B68EE", "Medium slate blue");
7399 Color.a("#C9DC87", "Medium spring bud");
7400 Color.a("#00FA9A", "Medium spring green");
7401 Color.a("#674C47", "Medium taupe");
7402 Color.a("#48D1CC", "Medium turquoise");
7403 Color.a("#D9603B", "Pale vermilion");
7404 Color.a("#F8B878", "Mellow apricot");
7405 Color.a("#F8DE7E", "Mellow yellow");
7406 Color.a("#FDBCB4", "Melon");
7407 Color.a("#0A7E8C", "Metallic Seaweed");
7408 Color.a("#9C7C38", "Metallic Sunburst");
7409 Color.a("#E4007C", "Mexican pink");
7410 Color.a("#191970", "Midnight blue");
7411 Color.a("#004953", "Midnight green (eagle green)");
7412 Color.a("#FFC40C", "Mikado yellow");
7413 Color.a("#E3F988", "Mindaro");
7414 Color.a("#3EB489", "Mint");
7415 Color.a("#F5FFFA", "Mint cream");
7416 Color.a("#98FF98", "Mint green");
7417 Color.a("#FFE4E1", "Misty rose");
7418 Color.a("#73A9C2", "Moonstone blue");
7419 Color.a("#AE0C00", "Mordant red 19");
7420 Color.a("#8A9A5B", "Moss green");
7421 Color.a("#30BA8F", "Mountain Meadow");
7422 Color.a("#997A8D", "Mountbatten pink");
7423 Color.a("#18453B", "MSU Green");
7424 Color.a("#306030", "Mughal green");
7425 Color.a("#C54B8C", "Mulberry");
7426 Color.a("#FFDB58", "Mustard");
7427 Color.a("#317873", "Myrtle green");
7428 Color.a("#F6ADC6", "Nadeshiko pink");
7429 Color.a("#2A8000", "Napier green");
7430 Color.a("#FFDEAD", "Navajo white");
7431 Color.a("#000080", "Navy");
7432 Color.a("#FFA343", "Neon Carrot");
7433 Color.a("#FE4164", "Neon fuchsia");
7434 Color.a("#39FF14", "Neon green");
7435 Color.a("#214FC6", "New Car");
7436 Color.a("#D7837F", "New York pink");
7437 Color.a("#A4DDED", "Non-photo blue");
7438 Color.a("#059033", "North Texas Green");
7439 Color.a("#E9FFDB", "Nyanza");
7440 Color.a("#0077BE", "Ocean Boat Blue");
7441 Color.a("#CC7722", "Ochre");
7442 Color.a("#43302E", "Old burgundy");
7443 Color.a("#CFB53B", "Old gold");
7444 Color.a("#FDF5E6", "Old lace");
7445 Color.a("#796878", "Old lavender");
7446 Color.a("#673147", "Old mauve");
7447 Color.a("#867E36", "Old moss green");
7448 Color.a("#C08081", "Old rose");
7449 Color.a("#808000", "Olive");
7450 Color.a("#6B8E23", "Olive Drab #3");
7451 Color.a("#3C341F", "Olive Drab #7");
7452 Color.a("#9AB973", "Olivine");
7453 Color.a("#353839", "Onyx");
7454 Color.a("#B784A7", "Opera mauve");
7455 Color.a("#FF7F00", "Orange");
7456 Color.a("#FF7538", "Orange (Crayola)");
7457 Color.a("#FF5800", "Orange (Pantone)");
7458 Color.a("#FB9902", "Orange (RYB)");
7459 Color.a("#FFA500", "Orange (web)");
7460 Color.a("#FF9F00", "Orange peel");
7461 Color.a("#FF4500", "Orange-red");
7462 Color.a("#DA70D6", "Orchid");
7463 Color.a("#F2BDCD", "Orchid pink");
7464 Color.a("#FB4F14", "Orioles orange");
7465 Color.a("#414A4C", "Outer Space");
7466 Color.a("#FF6E4A", "Outrageous Orange");
7467 Color.a("#002147", "Oxford Blue");
7468 Color.a("#990000", "Crimson Red");
7469 Color.a("#006600", "Pakistan green");
7470 Color.a("#273BE2", "Palatinate blue");
7471 Color.a("#682860", "Palatinate purple");
7472 Color.a("#BCD4E6", "Pale aqua");
7473 Color.a("#AFEEEE", "Pale blue");
7474 Color.a("#987654", "Pale brown");
7475 Color.a("#9BC4E2", "Pale cerulean");
7476 Color.a("#DDADAF", "Pale chestnut");
7477 Color.a("#DA8A67", "Pale copper");
7478 Color.a("#ABCDEF", "Pale cornflower blue");
7479 Color.a("#E6BE8A", "Pale gold");
7480 Color.a("#EEE8AA", "Pale goldenrod");
7481 Color.a("#98FB98", "Pale green");
7482 Color.a("#DCD0FF", "Pale lavender");
7483 Color.a("#F984E5", "Pale magenta");
7484 Color.a("#FADADD", "Pale pink");
7485 Color.a("#DDA0DD", "Pale plum");
7486 Color.a("#DB7093", "Nipple");
7487 Color.a("#96DED1", "Pale robin egg blue");
7488 Color.a("#C9C0BB", "Pale silver");
7489 Color.a("#ECEBBD", "Pale spring bud");
7490 Color.a("#BC987E", "Pale taupe");
7491 Color.a("#78184A", "Pansy purple");
7492 Color.a("#009B7D", "Paolo Veronese green");
7493 Color.a("#FFEFD5", "Papaya whip");
7494 Color.a("#E63E62", "Paradise pink");
7495 Color.a("#AEC6CF", "Pastel blue");
7496 Color.a("#836953", "Pastel brown");
7497 Color.a("#CFCFC4", "Pastel gray");
7498 Color.a("#77DD77", "Pastel green");
7499 Color.a("#F49AC2", "Pastel magenta");
7500 Color.a("#FFB347", "Pastel orange");
7501 Color.a("#DEA5A4", "Pastel pink");
7502 Color.a("#B39EB5", "Pastel purple");
7503 Color.a("#FF6961", "Pastel red");
7504 Color.a("#CB99C9", "Pastel violet");
7505 Color.a("#FDFD96", "Pastel yellow");
7506 Color.a("#FFE5B4", "Peach");
7507 Color.a("#FFCC99", "Peach-orange");
7508 Color.a("#FFDAB9", "Peach puff");
7509 Color.a("#FADFAD", "Peach-yellow");
7510 Color.a("#D1E231", "Pear");
7511 Color.a("#EAE0C8", "Pearl");
7512 Color.a("#88D8C0", "Dolphin Aqua");
7513 Color.a("#B768A2", "Pearly purple");
7514 Color.a("#E6E200", "Peridot");
7515 Color.a("#1C39BB", "Persian blue");
7516 Color.a("#00A693", "Persian green");
7517 Color.a("#32127A", "Persian indigo");
7518 Color.a("#D99058", "Persian orange");
7519 Color.a("#F77FBE", "Persian pink");
7520 Color.a("#701C1C", "Persian plum");
7521 Color.a("#CC3333", "Persian red");
7522 Color.a("#FE28A2", "Persian rose");
7523 Color.a("#EC5800", "Persimmon");
7524 Color.a("#CD853F", "Peru");
7525 Color.a("#000F89", "Phthalo blue");
7526 Color.a("#123524", "Phthalo green");
7527 Color.a("#45B1E8", "Picton blue");
7528 Color.a("#C30B4E", "Pictorial carmine");
7529 Color.a("#FDDDE6", "Piggy pink");
7530 Color.a("#01796F", "Pine green");
7531 Color.a("#FFC0CB", "Pink");
7532 Color.a("#D74894", "Pink (Pantone)");
7533 Color.a("#FFDDF4", "Pink lace");
7534 Color.a("#D8B2D1", "Pink lavender");
7535 Color.a("#FF9966", "Pink-orange");
7536 Color.a("#E7ACCF", "Pink pearl");
7537 Color.a("#F78FA7", "Pink Sherbet");
7538 Color.a("#93C572", "Pistachio");
7539 Color.a("#E5E4E2", "Platinum");
7540 Color.a("#8E4585", "Plum");
7541 Color.a("#BE4F62", "Popstar");
7542 Color.a("#FF5A36", "Portland Orange");
7543 Color.a("#B0E0E6", "Powder blue");
7544 Color.a("#FF8F00", "Princeton orange");
7545 Color.a("#003153", "Prussian blue");
7546 Color.a("#DF00FF", "Psychedelic purple");
7547 Color.a("#CC8899", "Puce");
7548 Color.a("#644117", "Pullman Brown (UPS Brown)");
7549 Color.a("#FF7518", "Pumpkin");
7550 Color.a("#800080", "Purple");
7551 Color.a("#9F00C5", "Purple (Munsell)");
7552 Color.a("#A020F0", "Purple");
7553 Color.a("#69359C", "Purple Heart");
7554 Color.a("#9678B6", "Purple mountain majesty");
7555 Color.a("#4E5180", "Purple navy");
7556 Color.a("#FE4EDA", "Purple pizzazz");
7557 Color.a("#50404D", "Purple taupe");
7558 Color.a("#9A4EAE", "Purpureus");
7559 Color.a("#51484F", "Quartz");
7560 Color.a("#436B95", "Queen blue");
7561 Color.a("#E8CCD7", "Queen pink");
7562 Color.a("#8E3A59", "Quinacridone magenta");
7563 Color.a("#FF355E", "Radical Red");
7564 Color.a("#FBAB60", "Rajah");
7565 Color.a("#E30B5D", "Raspberry");
7566 Color.a("#E25098", "Raspberry pink");
7567 Color.a("#B3446C", "Raspberry rose");
7568 Color.a("#826644", "Raw umber");
7569 Color.a("#FF33CC", "Razzle dazzle rose");
7570 Color.a("#E3256B", "Razzmatazz");
7571 Color.a("#8D4E85", "Razzmic Berry");
7572 Color.a("#FF0000", "Red");
7573 Color.a("#EE204D", "Red (Crayola)");
7574 Color.a("#F2003C", "Red (Munsell)");
7575 Color.a("#C40233", "Red (NCS)");
7576 Color.a("#ED1C24", "Red (pigment)");
7577 Color.a("#FE2712", "Red (RYB)");
7578 Color.a("#A52A2A", "Red-brown");
7579 Color.a("#860111", "Red devil");
7580 Color.a("#FF5349", "Red-orange");
7581 Color.a("#E40078", "Red-purple");
7582 Color.a("#C71585", "Red-violet");
7583 Color.a("#A45A52", "Redwood");
7584 Color.a("#522D80", "Regalia");
7585 Color.a("#002387", "Resolution blue");
7586 Color.a("#777696", "Rhythm");
7587 Color.a("#004040", "Rich black");
7588 Color.a("#F1A7FE", "Rich brilliant lavender");
7589 Color.a("#D70040", "Rich carmine");
7590 Color.a("#0892D0", "Rich electric blue");
7591 Color.a("#A76BCF", "Rich lavender");
7592 Color.a("#B666D2", "Rich lilac");
7593 Color.a("#B03060", "Rich maroon");
7594 Color.a("#444C38", "Rifle green");
7595 Color.a("#704241", "Deep Roast coffee");
7596 Color.a("#00CCCC", "Robin egg blue");
7597 Color.a("#8A7F80", "Rocket metallic");
7598 Color.a("#838996", "Roman silver");
7599 Color.a("#F9429E", "Rose bonbon");
7600 Color.a("#674846", "Rose ebony");
7601 Color.a("#B76E79", "Rose gold");
7602 Color.a("#FF66CC", "Rose pink");
7603 Color.a("#C21E56", "Rose red");
7604 Color.a("#905D5D", "Rose taupe");
7605 Color.a("#AB4E52", "Rose vale");
7606 Color.a("#65000B", "Rosewood");
7607 Color.a("#D40000", "Rosso corsa");
7608 Color.a("#BC8F8F", "Rosy brown");
7609 Color.a("#0038A8", "Royal azure");
7610 Color.a("#002366", "Royal blue");
7611 Color.a("#4169E1", "Royal light blue");
7612 Color.a("#CA2C92", "Royal fuchsia");
7613 Color.a("#7851A9", "Royal purple");
7614 Color.a("#FADA5E", "Royal yellow");
7615 Color.a("#CE4676", "Ruber");
7616 Color.a("#D10056", "Rubine red");
7617 Color.a("#E0115F", "Ruby");
7618 Color.a("#9B111E", "Ruby red");
7619 Color.a("#FF0028", "Ruddy");
7620 Color.a("#BB6528", "Ruddy brown");
7621 Color.a("#E18E96", "Ruddy pink");
7622 Color.a("#A81C07", "Rufous");
7623 Color.a("#80461B", "Russet");
7624 Color.a("#679267", "Russian green");
7625 Color.a("#32174D", "Russian violet");
7626 Color.a("#B7410E", "Rust");
7627 Color.a("#DA2C43", "Rusty red");
7628 Color.a("#8B4513", "Saddle brown");
7629 Color.a("#FF6700", "Safety orange (blaze orange)");
7630 Color.a("#EED202", "Safety yellow");
7631 Color.a("#F4C430", "Saffron");
7632 Color.a("#BCB88A", "Sage");
7633 Color.a("#23297A", "St. Patrick's blue");
7634 Color.a("#FA8072", "Salmon");
7635 Color.a("#FF91A4", "Salmon pink");
7636 Color.a("#C2B280", "Sand");
7637 Color.a("#ECD540", "Sandstorm");
7638 Color.a("#F4A460", "Sandy brown");
7639 Color.a("#92000A", "Sangria");
7640 Color.a("#507D2A", "Sap green");
7641 Color.a("#0F52BA", "Sapphire");
7642 Color.a("#0067A5", "Sapphire blue");
7643 Color.a("#CBA135", "Satin sheen gold");
7644 Color.a("#FF2400", "Scarlet");
7645 Color.a("#FFD800", "School bus yellow");
7646 Color.a("#76FF7A", "Screamin' Green");
7647 Color.a("#006994", "Sea blue");
7648 Color.a("#2E8B57", "Sea green");
7649 Color.a("#321414", "Seal brown");
7650 Color.a("#FFF5EE", "Seashell");
7651 Color.a("#FFBA00", "Selective yellow");
7652 Color.a("#704214", "Sepia");
7653 Color.a("#8A795D", "Shadow");
7654 Color.a("#778BA5", "Shadow blue");
7655 Color.a("#FFCFF1", "Shampoo");
7656 Color.a("#009E60", "Shamrock green");
7657 Color.a("#8FD400", "Sheen Green");
7658 Color.a("#D98695", "Shimmering Blush");
7659 Color.a("#FC0FC0", "Shocking pink");
7660 Color.a("#882D17", "Sienna");
7661 Color.a("#C0C0C0", "Silver");
7662 Color.a("#ACACAC", "Silver chalice");
7663 Color.a("#5D89BA", "Silver Lake blue");
7664 Color.a("#C4AEAD", "Silver pink");
7665 Color.a("#BFC1C2", "Silver sand");
7666 Color.a("#CB410B", "Sinopia");
7667 Color.a("#007474", "Skobeloff");
7668 Color.a("#87CEEB", "Sky blue");
7669 Color.a("#CF71AF", "Sky magenta");
7670 Color.a("#6A5ACD", "Slate blue");
7671 Color.a("#708090", "Slate gray");
7672 Color.a("#C84186", "Smitten");
7673 Color.a("#738276", "Smoke");
7674 Color.a("#933D41", "Smokey topaz");
7675 Color.a("#100C08", "Smoky black");
7676 Color.a("#FFFAFA", "Snow");
7677 Color.a("#CEC8EF", "Soap");
7678 Color.a("#893843", "Solid pink");
7679 Color.a("#757575", "Sonic silver");
7680 Color.a("#9E1316", "Spartan Crimson");
7681 Color.a("#1D2951", "Space cadet");
7682 Color.a("#807532", "Spanish bistre");
7683 Color.a("#0070B8", "Spanish blue");
7684 Color.a("#D10047", "Spanish carmine");
7685 Color.a("#E51A4C", "Spanish crimson");
7686 Color.a("#989898", "Spanish gray");
7687 Color.a("#009150", "Spanish green");
7688 Color.a("#E86100", "Spanish orange");
7689 Color.a("#F7BFBE", "Spanish pink");
7690 Color.a("#E60026", "Spanish red");
7691 Color.a("#4C2882", "Spanish violet");
7692 Color.a("#007F5C", "Spanish viridian");
7693 Color.a("#0FC0FC", "Spiro Disco Ball");
7694 Color.a("#A7FC00", "Spring bud");
7695 Color.a("#00FF7F", "Spring green");
7696 Color.a("#007BB8", "Star command blue");
7697 Color.a("#4682B4", "Steel blue");
7698 Color.a("#CC33CC", "Steel pink");
7699 Color.a("#4F666A", "Stormcloud");
7700 Color.a("#E4D96F", "Straw");
7701 Color.a("#FC5A8D", "Strawberry");
7702 Color.a("#FFCC33", "Sunglow");
7703 Color.a("#E3AB57", "Sunray");
7704 Color.a("#FAD6A5", "Sunset");
7705 Color.a("#FD5E53", "Sunset orange");
7706 Color.a("#CF6BA9", "Super pink");
7707 Color.a("#D2B48C", "Tan");
7708 Color.a("#F94D00", "Tangelo");
7709 Color.a("#F28500", "Tangerine");
7710 Color.a("#FFCC00", "Tangerine yellow");
7711 Color.a("#483C32", "Dark Grayish Brown");
7712 Color.a("#8B8589", "Taupe gray");
7713 Color.a("#D0F0C0", "Tea green");
7714 Color.a("#F4C2C2", "Tea rose");
7715 Color.a("#008080", "Teal");
7716 Color.a("#367588", "Teal blue");
7717 Color.a("#99E6B3", "Teal deer");
7718 Color.a("#00827F", "Teal green");
7719 Color.a("#CF3476", "Telemagenta");
7720 Color.a("#CD5700", "Tenne");
7721 Color.a("#E2725B", "Terra cotta");
7722 Color.a("#D8BFD8", "Thistle");
7723 Color.a("#DE6FA1", "Thulian pink");
7724 Color.a("#FC89AC", "Tickle Me Pink");
7725 Color.a("#0ABAB5", "Tiffany Blue");
7726 Color.a("#E08D3C", "Tiger's eye");
7727 Color.a("#DBD7D2", "Timberwolf");
7728 Color.a("#EEE600", "Titanium yellow");
7729 Color.a("#FF6347", "Tomato");
7730 Color.a("#746CC0", "Toolbox");
7731 Color.a("#FFC87C", "Topaz");
7732 Color.a("#FD0E35", "Tractor red");
7733 Color.a("#00755E", "Tropical rain forest");
7734 Color.a("#0073CF", "True Blue");
7735 Color.a("#417DC1", "Tufts Blue");
7736 Color.a("#FF878D", "Tulip");
7737 Color.a("#DEAA88", "Tumbleweed");
7738 Color.a("#B57281", "Turkish rose");
7739 Color.a("#40E0D0", "Turquoise");
7740 Color.a("#00FFEF", "Turquoise blue");
7741 Color.a("#A0D6B4", "Turquoise green");
7742 Color.a("#7C4848", "Tuscan red");
7743 Color.a("#C09999", "Tuscany");
7744 Color.a("#8A496B", "Twilight lavender");
7745 Color.a("#0033AA", "UA blue");
7746 Color.a("#D9004C", "UA red");
7747 Color.a("#8878C3", "Ube");
7748 Color.a("#536895", "UCLA Blue");
7749 Color.a("#FFB300", "UCLA Gold");
7750 Color.a("#3CD070", "UFO Green");
7751 Color.a("#120A8F", "Ultramarine");
7752 Color.a("#4166F5", "Ultramarine blue");
7753 Color.a("#FF6FFF", "Ultra pink");
7754 Color.a("#635147", "Umber");
7755 Color.a("#FFDDCA", "Unbleached silk");
7756 Color.a("#5B92E5", "United Nations blue");
7757 Color.a("#B78727", "University of California Gold");
7758 Color.a("#FFFF66", "Unmellow yellow");
7759 Color.a("#7B1113", "UP Maroon");
7760 Color.a("#AE2029", "Upsdell red");
7761 Color.a("#E1AD21", "Urobilin");
7762 Color.a("#004F98", "USAFA blue");
7763 Color.a("#F77F00", "University of Tennessee Orange");
7764 Color.a("#D3003F", "Utah Crimson");
7765 Color.a("#F3E5AB", "Vanilla");
7766 Color.a("#F38FA9", "Vanilla ice");
7767 Color.a("#C5B358", "Vegas gold");
7768 Color.a("#C80815", "Venetian red");
7769 Color.a("#43B3AE", "Verdigris");
7770 Color.a("#E34234", "Medium vermilion");
7771 Color.a("#D9381E", "Vermilion");
7772 Color.a("#8F00FF", "Violet");
7773 Color.a("#7F00FF", "Violet (color wheel)");
7774 Color.a("#8601AF", "Violet (RYB)");
7775 Color.a("#324AB2", "Logie Bear");
7776 Color.a("#F75394", "Violet-red");
7777 Color.a("#40826D", "Viridian");
7778 Color.a("#009698", "Viridian green");
7779 Color.a("#922724", "Vivid auburn");
7780 Color.a("#9F1D35", "Vivid burgundy");
7781 Color.a("#DA1D81", "Vivid cerise");
7782 Color.a("#CC00FF", "Vivid orchid");
7783 Color.a("#00CCFF", "Vivid sky blue");
7784 Color.a("#FFA089", "Vivid tangerine");
7785 Color.a("#9F00FF", "Vivid violet");
7786 Color.a("#004242", "Warm black");
7787 Color.a("#A4F4F9", "Waterspout");
7788 Color.a("#645452", "Wenge");
7789 Color.a("#F5DEB3", "Wheat");
7790 Color.a("#FFFFFF", "White");
7791 Color.a("#F5F5F5", "White smoke");
7792 Color.a("#A2ADD0", "Wild blue yonder");
7793 Color.a("#D470A2", "Wild orchid");
7794 Color.a("#FF43A4", "Wild Strawberry");
7795 Color.a("#FC6C85", "Wild watermelon");
7796 Color.a("#FD5800", "Willpower orange");
7797 Color.a("#A75502", "Windsor tan");
7798 Color.a("#722F37", "Wine");
7799 Color.a("#C9A0DC", "Wisteria");
7800 Color.a("#C19A6B", "Wood brown");
7801 Color.a("#738678", "Xanadu");
7802 Color.a("#0F4D92", "Yale Blue");
7803 Color.a("#1C2841", "Yankees blue");
7804 Color.a("#FCE883", "Yellow Crayola");
7805 Color.a("#EFCC00", "Yellow Munsell");
7806 Color.a("#FEDF00", "Yellow Pantone");
7807 Color.a("#FEFE33", "Yellow");
7808 Color.a("#9ACD32", "Yellow Green");
7809 Color.a("#FFAE42", "Yellow Orange");
7810 Color.a("#FFF000", "Yellow rose");
7811 Color.a("#0014A8", "Zaffre");
7812 Color.a("#2C1608", "Zinnwaldite brown");
7813 Color.a("#39A78E", "Zomp");
7814
7815 // where it receives the message
7816 gClient.on("a", function (msg) {
7817 chat.receive(msg);
7818 });
7819
7820 $("#chat input").on("focus", function (evt) {
7821 releaseKeyboard();
7822 $("#chat").addClass("chatting");
7823 chat.scrollToBottom();
7824 });
7825
7826 $(document).mousedown(function (evt) {
7827 if (!$("#chat").has(evt.target).length > 0) {
7828 chat.blur();
7829 }
7830 });
7831
7832 document.addEventListener("touchstart", function (event) {
7833 for (var i in event.changedTouches) {
7834 var touch = event.changedTouches[i];
7835 if (!$("#chat").has(touch.target).length > 0) {
7836 chat.blur();
7837 }
7838 }
7839 });
7840
7841 $(document).on("keydown", function (evt) {
7842 if ($("#chat").hasClass("chatting")) {
7843 if (evt.keyCode == 27) {
7844 chat.blur();
7845 evt.preventDefault();
7846 evt.stopPropagation();
7847 } else if (evt.keyCode == 13) {
7848 $("#chat input").focus();
7849 }
7850 } else if (!gModal && (evt.keyCode == 27 || evt.keyCode == 13)) {
7851 $("#chat input").focus();
7852 }
7853 });
7854
7855 $("#chat input").on("keydown", function (evt) {
7856 if (evt.keyCode == 13) {
7857 var message = $(this).val();
7858
7859 // ♥ // local commands // ♥ //
7860
7861 if (message.length == 0) { //close chat if no input
7862 chat.blur();
7863
7864 } else if (message.substring(0, 6).toLowerCase() == cmdChar+"lhelp" || message.substring(0, 6).toLowerCase() == "!lhelp") { //local command list
7865 // thanks Someguy!
7866 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)");
7867 $(this).val(""); //empties chatbox
7868 chat.blur(); //closes chat
7869
7870 } else if (message.substring(0, 5).toLowerCase() == cmdChar+"name" || message.substring(0, 5).toLowerCase() == "!name") { //name
7871 if (message.substring(5).trim() == "") {
7872 msgBox('Rename', 'Usage: '+cmdChar+'name new_name.', 3000, '#piano');
7873
7874 } else {
7875 gClient.sendArray([{
7876 "m": "userset",
7877 "set": {
7878 "name": message.substring(5).trim()
7879 }
7880 }]);
7881 selfName = message.substring(5).trim();
7882 msgBox('Renamed', message.substring(5).trim(), 3000, '#piano');
7883 }
7884 $(this).val("");
7885 chat.blur();
7886
7887 } else if (message.substring(0, 5).toLowerCase() == cmdChar+"svol" || message.substring(0, 5).toLowerCase() == "!svol") { //speech volume
7888 var speechVolumeTEMP = message.substring(6).trim()
7889 if (isNaN(speechVolumeTEMP) || speechVolumeTEMP > 1 || speechVolumeTEMP < 0 || speechVolumeTEMP == '') {
7890 msgBox('Speech Volume [usage]', 'Please enter a number no greater than 1 and no less than 0.', 5000, '#piano');
7891 $(this).val("");
7892 chat.blur();
7893 return;
7894
7895 } else {
7896 speechVolume = speechVolumeTEMP; //sets new variable value
7897 msgBox('Speech Volume', speechVolume, 3000, '#piano');
7898
7899 $(this).val("");
7900 chat.blur();
7901 }
7902
7903 } else if (message.substring(0, 7).toLowerCase() == cmdChar+"spitch" || message.substring(0, 7).toLowerCase() == "!spitch") { //speech pitch
7904 var speechPitchTEMP = message.substring(8).trim()
7905 if (isNaN(speechPitchTEMP) || speechPitchTEMP > 2 || speechPitchTEMP < 0 || speechPitchTEMP == '') {
7906 msgBox('Speech Pitch [usage]', 'Please enter a number no greater than 2 and no less than 0.', 5000, '#piano');
7907 $(this).val("");
7908 chat.blur();
7909 return;
7910
7911 } else {
7912 speechPitch = message.substring(8).trim() //sets new variable value
7913 msgBox('Pitch', speechPitch, 3000, '#piano');
7914 $(this).val("");
7915 chat.blur();
7916 }
7917
7918 } else if (message.substring(0, 6).toLowerCase() == cmdChar+"srate" || message.substring(0, 6).toLowerCase() == "!srate") { //speech rate
7919 var speechRateTEMP = message.substring(7).trim()
7920 if (isNaN(speechRateTEMP) || speechRateTEMP > 2 || speechRateTEMP < 0 || speechRateTEMP == '') {
7921 msgBox('Speech Pitch [usage]', 'Please enter a number no greater than 2 and no less than 0.', 5000, '#piano');
7922 $(this).val("");
7923 chat.blur();
7924 return;
7925
7926 } else {
7927 speechRate = message.substring(7).trim() //sets new variable value
7928 msgBox('Rate', speechRate, 3000, '#piano');
7929 $(this).val("");
7930 chat.blur();
7931 }
7932
7933 } else if (message.substring(0, 9).toLowerCase() == cmdChar+"sdefault" || message.substring(0, 9).toLowerCase() == "!sdefault") { //speech default
7934 speechVolume = 0.5; //default volume for spoken text
7935 speechPitch = 1; //default pitch for spoken text
7936 speechRate = 1; //default speed for spoken text
7937 msgBox('Speech Default', 'Volume, pitch and rate all reset.', 3000, '#piano');
7938 $(this).val("");
7939 chat.blur();
7940
7941 } else if (message.substring(0, 6).toLowerCase() == cmdChar+"lobby" || message.substring(0, 6).toLowerCase() == "!lobby") { //lobby
7942 if (gClient.isOwner()) {
7943 var lobbyConfirm = prompt("Are you sure you want to turn this room into a lobby?\nThis cannot be undone.\n\nEnter \"Yes\" below to continue.");
7944 if (lobbyConfirm == "Yes") {
7945 MPP.client.sendArray([{m: "chset", set: {lobby: true}}]);
7946 msgBox('Room is now a lobby', '', 3000, '#piano');
7947 } else {
7948 alert("Incorrectly entered text or you cancled.");
7949 }
7950
7951 } else {
7952 alert("You're not the owner of this room!");
7953 }
7954
7955 $(this).val("");
7956 chat.blur();
7957
7958 } else if (message.substring(0, 9).toLowerCase() == cmdChar+"givefish" || message.substring(0, 9).toLowerCase() == "!givefish") { //give fish
7959 giveFish = !giveFish;
7960 if (!giveFish) {
7961 msgBox('Give Fish', 'Off', 3000, '#piano');
7962
7963 } else {
7964 msgBox('Give Fish', 'On', 3000, '#piano');
7965 }
7966
7967 $(this).val("");
7968 chat.blur();
7969
7970 } else if (message.substring(0, 9).toLowerCase() == cmdChar+"fishlord" || message.substring(0, 9).toLowerCase() == "!fishlord") { //fish lord
7971 fishLord = message.substring(10).trim();
7972 if (fishLord == '') {
7973 msgBox('Fish Lord [usage]', cmdChar+'fishlord name_here', 3000, '#piano');
7974 $(this).val("");
7975 chat.blur();
7976 return;
7977 }
7978 msgBox('Fish Lord', 'Fish lord: ' + fishLord, 3000, '#piano');
7979 $(this).val("");
7980 chat.blur();
7981
7982 } else if (message.substring(0, 7).toLowerCase() == cmdChar+"juggle" || message.substring(0, 7).toLowerCase() == "!juggle") { //juggle
7983 function jugglePls() {
7984 juggling = setInterval(function() {
7985 gClient.sendArray([{
7986 m: "chown"
7987 }]);
7988 }, 2100); //2300 is good for just the dropping of it
7989 }
7990
7991 if (juggle) {
7992 juggle = false;
7993 clearInterval(juggling);
7994
7995 gClient.sendArray([{
7996 m: "chown",
7997 id: gClient.participantId
7998 }]);
7999 msgBox('Juggle Crown', 'Off', 2000, '#piano');
8000
8001 } else {
8002 juggle = true;
8003 jugglePls();
8004 msgBox('Juggle Crown', 'On', 2000, '#piano');
8005 }
8006
8007 $(this).val("");
8008 chat.blur();
8009
8010 } else if (message.substring(0, 10).toLowerCase() == cmdChar+"mathcheat" || message.substring(0, 10).toLowerCase() == "!mathcheat") { //juggle
8011 if (mathCheat) {
8012 mathCheat = false;
8013 msgBox('Math Cheats', 'Off', 2000, '#piano');
8014 } else {
8015 mathCheat = true;
8016 msgBox('Math Cheats', 'On', 2000, '#piano');
8017 }
8018
8019 $(this).val("");
8020 chat.blur();
8021
8022 // ♥ // local commands // ♥ //
8023
8024 } else if (message.length <= 512) {
8025 if (!meow && !leet) {
8026 //console.log("Triggered first");
8027 chat.send(message);
8028 $(this).val("");
8029 chat.blur();
8030 }
8031 if (message.substring(0,1).trim() != "!" && message.substring(0,1).trim() != "/" && message.substring(0,1).trim() != cmdChar) {
8032 if (meow) {
8033 //thanks electrashave!
8034 leet = false;
8035 var words = ['meow', 'meow', 'mew', 'purr'];
8036 var final = '';
8037 for (var i = 0; words.length > i; i++) {
8038 final += words[Math.floor(Math.random()*words.length)] + ' ';
8039 }
8040 final = final.toLowerCase();
8041 final = final.charAt(0).toUpperCase() + final.slice(1).trim() + '. *' + message.trim() + '*';
8042 chat.send(final);
8043 $(this).val("");
8044 chat.blur();
8045
8046 } else if (!leet){
8047 $(this).val("");
8048 chat.blur();
8049 }
8050
8051 if (leet) {
8052 meow = false;
8053 var alpha1 = "abcdefghijklmnopqrstuvwxyz0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789~`?-=[]\;'\",./_+{}|:<>!@#$%^&*()♥°¬";
8054 var alpha2 = "4bcd3fgh1jklmn0pqrstuvwxyz0123456789 4BCD3FGH1JKLMN0PQRSTUVWXYZ0123456789~`?-=[]\;'\",./_+{}|:<>!@#$%^&*()♥°¬";
8055 var str = message;
8056 var newstr = '';
8057 for (var i = 0; i < str.length; i++) {
8058 charPos = alpha1.indexOf(str.charAt(i));
8059 newstr += alpha2.charAt(charPos);
8060 }
8061 chat.send(newstr);
8062 $(this).val("");
8063 chat.blur();
8064
8065 } else if (!meow) {
8066 $(this).val("");
8067 chat.blur();
8068 }
8069
8070 } else if (meow || leet) {
8071 //console.log("Triggered final");
8072 chat.send(message);
8073 $(this).val("");
8074 chat.blur();
8075 }
8076
8077 }
8078
8079 evt.preventDefault();
8080 evt.stopPropagation();
8081 } else if (evt.keyCode == 27) {
8082 chat.blur();
8083 evt.preventDefault();
8084 evt.stopPropagation();
8085 } else if (evt.keyCode == 9) {
8086 evt.preventDefault();
8087 evt.stopPropagation();
8088 }
8089 });
8090
8091 return {
8092 show: function () {
8093 $("#chat").fadeIn();
8094 },
8095
8096 hide: function () {
8097 $("#chat").fadeOut();
8098 },
8099
8100 clear: function () {
8101 if (clearChat) {
8102 $("#chat li").remove();
8103 return;
8104 }
8105 },
8106
8107 scrollToBottom: function () {
8108 var ele = $("#chat ul").get(0);
8109 ele.scrollTop = ele.scrollHeight;
8110 },
8111
8112 blur: function () {
8113 if ($("#chat").hasClass("chatting")) {
8114 $("#chat input").get(0).blur();
8115 $("#chat").removeClass("chatting");
8116 chat.scrollToBottom();
8117 captureKeyboard();
8118 }
8119 },
8120
8121 send: function (message) {
8122 gClient.sendArray([{
8123 m: "a",
8124 message: message
8125 }]);
8126 },
8127
8128
8129 receive: function (msg) {
8130 if (gChatMutes.indexOf(msg.p._id) != -1) return;
8131 msg.a = msg.a.replace(/</g, '<');
8132 msg.p.name = msg.p.name.replace(/</g, '<');
8133 content = msg.a.replace(/((https?\:\/\/|ftp\:\/\/)|(www\.))(\S+)(\w{2,4})(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/gi, function(url) {
8134 nice = url;
8135 if( url.match('^https?:\/\/') ) nice = nice.replace(/^https?:\/\//i,'')
8136 else url = 'http://' + url;
8137
8138 return '<a target="_blank" style="text-decoration: none;" href="'+ url +'">'+ url +'</a>';
8139 });
8140 var final = content;
8141
8142 var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
8143
8144 var li = $('<li><span class="name"/><span style="position: initial!important;" class="message"/>');
8145
8146 li.find(".name").html(msg.p.name + afterName); //fix for <3 showing up as lt;3 using .text instead of .html -thanks Someguy
8147 if (debug) {
8148 li.find(".name").html("[" + msg.p._id + "] " + msg.p.name + afterName);
8149 }
8150 if (timeStamp) {
8151 li.find(".name").html(getTime() + " | " + msg.p.name + afterName);
8152 }
8153 li.find(".message").html(
8154 "<span class='msg_'>"+ final + "</span>"
8155 );
8156
8157 li.css("color", msg.p.color || "white");
8158
8159 $("#chat ul").append(li);
8160
8161 var eles = $("#chat ul li").get();
8162 for (var i = 1; i <= 50 && i <= eles.length; i++) {
8163 eles[eles.length - i].style.opacity = 1.0 - (i * 0.03); //chat fade
8164 }
8165 if (eles.length > 50) {
8166 eles[0].style.display = "none";
8167 }
8168 if (eles.length > chatLimit) { //max chat log history default was 256
8169 $(eles[0]).remove();
8170 }
8171 updateChatLength(eles.length);
8172
8173 // scroll to bottom if not "chatting" or if not scrolled up
8174 if (!$("#chat").hasClass("chatting")) {
8175 chat.scrollToBottom();
8176 } else {
8177 var ele = $("#chat ul").get(0);
8178 if (ele.scrollTop > ele.scrollHeight - ele.offsetHeight - 50)
8179 chat.scrollToBottom();
8180 }
8181 if (debug2) {
8182 // test
8183 //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
8184 //length of msg: $('#chat li .msg_').get(0).innerHTML.length
8185 var myString = $('#chat li:last .msg_').get(0).innerHTML;
8186 var cut = myString.length;
8187 console.log("length: " + cut);
8188 var myArray = myString.split("");
8189 var loopTimer = 70;
8190 console.log('before loop ' + myString);
8191 $('#chat li:last .msg_').get(0).innerHTML = myString.substring(cut, cut);
8192 var frameLooper = setInterval( function() {
8193 console.log('looping ' + myString);
8194 if(myArray.length > 0) {
8195 $('#chat li:last .msg_').get(0).innerHTML += myArray.shift();
8196 } else {
8197 clearInterval(frameLooper);
8198 console.log('clearing loop ' + myString);
8199 return false;
8200 }
8201 }, loopTimer);
8202 console.log('done ' + myString);
8203
8204 //$('#chat li:last .msg_').get(0).innerHTML
8205
8206 // test
8207 }
8208
8209
8210 }
8211 };
8212
8213 })();
8214
8215
8216 clearChatFunc = function() {
8217 chat.clear();
8218 updateChatLength(0);
8219 }
8220
8221
8222 // use midi bridge (old one started here)
8223 $("#blah-btn").on("click", function (evt) {
8224 var pRoom = prompt("Enter the name of your lobby...", hotkeyRoom);
8225 if (!pRoom) return;
8226 var room_name = pRoom;
8227 changeRoom(room_name, "right", {
8228 "visible": true,
8229 "chat": true,
8230 "crownsolo": false,
8231 "lobby": true
8232 });
8233 });
8234
8235 // use midi bridge (old one ended here)
8236
8237
8238 // New MIDI
8239 var gWebMidiWorking;
8240 (function() {
8241
8242 MIDI_TRANSPOSE = -12;
8243
8244 var MIDI_KEY_NAMES = ["a-1", "as-1", "b-1"];
8245 var bare_notes = "c cs d ds e f fs g gs a as b".split(" ");
8246 for(var oct = 0; oct < 7; oct++) {
8247 for(var i in bare_notes) {
8248 MIDI_KEY_NAMES.push(bare_notes[i] + oct);
8249 }
8250 }
8251 MIDI_KEY_NAMES.push("c7");
8252
8253 if (navigator.requestMIDIAccess) {
8254 navigator.requestMIDIAccess().then(
8255 function(midi) {
8256 console.log(midi);
8257 if(midi.inputs.size > 0) {
8258 var inputs = midi.inputs.values();
8259 for(var input_it = inputs.next(); input_it && !input_it.done; input_it = inputs.next()) {
8260 var input = input_it.value;
8261 console.log(input);
8262 input.onmidimessage = function(evt) {
8263 var channel = evt.data[0] & 0xf;
8264 var cmd = evt.data[0] >> 4;
8265 var note_number = evt.data[1];
8266 var vel = evt.data[2];
8267 //console.log(channel, cmd, note_number, vel);
8268 if(cmd == 8 || (cmd == 9 && vel == 0)) {
8269 // NOTE_OFF
8270 release(MIDI_KEY_NAMES[note_number - 9 + MIDI_TRANSPOSE]);
8271 } else if(cmd == 9) {
8272 // NOTE_ON
8273 press(MIDI_KEY_NAMES[note_number - 9 + MIDI_TRANSPOSE], vel / 100);
8274 } else if(cmd == 11) {
8275 // CONTROL_CHANGE
8276 if(!gAutoSustain) {
8277 if(note_number == 64) {
8278 if(vel > 0) {
8279 pressSustain();
8280 } else {
8281 releaseSustain();
8282 }
8283 }
8284 }
8285 }
8286 };
8287 if(!gWebMidiWorking) {
8288 gWebMidiWorking = true;
8289 new Notification({title:"Nice!", text:"Web MIDI is going.", duration:2000}); //MIDI working
8290 }
8291 }
8292 } else {
8293 console.log("no midi inputs");
8294 gWebMidiWorking = false;
8295 }
8296 if(gMidiOutTest && midi.outputs.size > 0) {
8297 var outputs = midi.outputs.values();
8298 for(var output_it = outputs.next(); output_it && !output_it.done; output_it = outputs.next()) {
8299 var output = output_it.value;
8300 console.log(output);
8301 }
8302 gMidiOutTest = function(note_name, vel, delay_ms) {
8303 var note_number = MIDI_KEY_NAMES.indexOf(note_name);
8304 if(note_number == -1) return;
8305 note_number = note_number + 9 - MIDI_TRANSPOSE;
8306
8307 var outputs = midi.outputs.values();
8308 for(var output_it = outputs.next(); output_it && !output_it.done; output_it = outputs.next()) {
8309 var output = output_it.value;
8310 output.send([0x90, note_number, vel], window.performance.now() + delay_ms);
8311 }
8312 }
8313 }
8314 },
8315 function(err){
8316 console.log(err);
8317 gWebMidiWorking = false;
8318 } );
8319 }
8320 })();
8321
8322
8323
8324 //More button
8325 (function () {
8326 var loaded = false;
8327 $("#social").fadeIn(250);
8328 $("#more-button").click(function () {
8329 //stuff goes between here and..
8330 if (leet) {
8331 leet = false;
8332 } else {
8333 leet = true;
8334 }
8335 msgBox('1337 Mode', ''+leet, 2000, '#piano');
8336 });
8337 })();
8338
8339
8340 //api
8341 //window.MPP
8342 MPP = {
8343 press: press,
8344 release: release,
8345 piano: gPiano,
8346 client: gClient,
8347 chat: chat,
8348 msgBox: msgBox,
8349 SoundSelector: gSoundSelector
8350 };
8351
8352
8353});
8354//main end
8355
8356//Thanks B@K$
8357MPP.client.sendArray = function(arr) {
8358 if (arr[0].m == "m") {
8359 logie = this;
8360 logie.participantUpdate({
8361 id: logie.participantId
8362 , x: parseFloat(arr[0].x)
8363 , y: parseFloat(arr[0].y)
8364 , m: "m"
8365 });
8366 }
8367 this.send(JSON.stringify(arr));
8368}
8369
8370// miscellaneous HTML changes
8371 // default place holder for chat
8372 $("#chat .translate").attr("placeholder", "")
8373
8374// miscellaneous HTML changes
8375
8376//♥ Test Button ♥
8377//button 4
8378function updateChatLength(num) {
8379 document.getElementById("4-btn").innerHTML = "Msgs: " + num;
8380}
8381$("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>');
8382$("#4-btn").click(function(){
8383 var yayNayChat = confirm("Do you want to clear the chat?");
8384
8385 if (yayNayChat) {
8386 clearChat = true;
8387 clearChatFunc();
8388 clearChat = false;
8389 }
8390});
8391
8392//♥ button 5
8393$("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>');
8394$("#5-btn").click(function(){
8395 if (debug) {
8396 //off
8397 debug = false;
8398 document.getElementById("5-btn").style.color = "red";
8399 } else {
8400 //on
8401 debug = true;
8402 document.getElementById("5-btn").style.color = "green";
8403 }
8404});
8405
8406//♥ button 6
8407$("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>');
8408$("#6-btn").click(function(){
8409 document.getElementById("6-btn").style.color = Col();
8410 //nothing as of now
8411});
8412
8413//♥ button 7
8414$("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>');
8415$("#7-btn").click(function(){
8416 document.getElementById("7-btn").style.color = Col();
8417 //nothing as of now
8418});
8419
8420//♥ button 8
8421$("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>');
8422$("#8-btn").click(function(){
8423 document.getElementById("8-btn").style.color = Col();
8424 //nothing as of now
8425});
8426
8427//♥ button 9
8428$("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>');
8429$("#9-btn").click(function(){
8430 document.getElementById("9-btn").style.color = Col();
8431 //nothing as of now
8432});
8433
8434//♥ button 10
8435$("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>');
8436$("#10-btn").click(function(){
8437 document.getElementById("10-btn").style.color = Col();
8438 //nothing as of now
8439});
8440
8441//♥ button 11
8442$("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>');
8443$("#11-btn").click(function(){
8444 document.getElementById("11-btn").style.color = Col();
8445 //nothing as of now
8446});
8447
8448//♥ button 12
8449$("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>');
8450$("#12-btn").click(function(){
8451 document.getElementById("12-btn").style.color = Col();
8452 //nothing as of now
8453});
8454
8455//♥ button 13
8456$("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>');
8457$("#13-btn").click(function(){
8458 document.getElementById("13-btn").style.color = Col();
8459 //nothing as of now
8460});
8461
8462//♥ button 14
8463$("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>');
8464$("#14-btn").click(function(){
8465 document.getElementById("14-btn").style.color = Col();
8466 //nothing as of now
8467});
8468
8469//♥ button 15
8470$("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>');
8471$("#15-btn").click(function(){
8472 document.getElementById("15-btn").style.color = Col();
8473 //nothing as of now
8474});
8475
8476//♥ button 16
8477$("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>');
8478var playingMid = false;
8479document.getElementById("16-btn").style.color = "red";
8480$("#16-btn").click(function(){
8481 if (!playingMid) {
8482 //MIDIjs.play('http://localhost:3000/midis/logan.mid');
8483 playingMid = true;
8484 document.getElementById("16-btn").style.color = "green";
8485 } else {
8486 //MIDIjs.stop();
8487 document.getElementById("16-btn").style.color = "red";
8488 playingMid = false;
8489 }
8490});
8491
8492//♥ button 17
8493$("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>');
8494var spinning = false;
8495document.getElementById("17-btn").style.color = "red";
8496$("#17-btn").click(function(){
8497 if (spinning) {
8498 document.getElementById("17-btn").style.color = "red";
8499 $("#piano").removeClass("spin");
8500 spinning = false;
8501 } else {
8502 document.getElementById("17-btn").style.color = "green";
8503 $("#piano").addClass("spin");
8504 spinning = true;
8505 }
8506});
8507
8508//♥ button 18
8509$("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>');
8510$("#18-btn").click(function(){
8511 document.getElementById("18-btn").style.color = Col();
8512 MPP.press("b1", volume); MPP.press("fs2", volume); MPP.press("d2", volume); MPP.press("b2", volume); MPP.press("b-1", volume);
8513});
8514
8515//♥ button 19
8516$("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>');
8517$("#19-btn").click(function(){
8518 document.getElementById("19-btn").style.color = Col();
8519 MPP.press("b1", volume); MPP.press("fs2", volume); MPP.press("ds2", volume); MPP.press("b2", volume); MPP.press("b-1", volume);
8520});
8521
8522//♥ button 20
8523$("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>');
8524$("#20-btn").click(function(){
8525 document.getElementById("20-btn").style.color = Col();
8526 MPP.press("cs2", volume); MPP.press("e2", volume); MPP.press("as2", volume); MPP.press("fs0", volume);
8527});
8528
8529//♥ button 21
8530$("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>');
8531$("#21-btn").click(function(){
8532 document.getElementById("21-btn").style.color = Col();
8533 MPP.press("cs2", volume); MPP.press("e2", volume); MPP.press("gs2", volume); MPP.press("cs0", volume);
8534});
8535
8536//♥ button 22
8537$("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>');
8538$("#22-btn").click(function(){
8539 document.getElementById("22-btn").style.color = Col();
8540 MPP.press("c2", volume); MPP.press("fs2", volume); MPP.press("gs2", volume);
8541});
8542
8543//♥ button 23
8544$("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>');
8545$("#23-btn").click(function(){
8546 document.getElementById("23-btn").style.color = Col();
8547 MPP.press("b1", volume); MPP.press("e2", volume); MPP.press("gs2", volume);
8548});
8549
8550//♥ button 24
8551$("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>');
8552$("#24-btn").click(function(){
8553 setCmdChar();
8554 updateCmdChar(cmdChar);
8555
8556});
8557
8558// le label
8559$("body").append('<div id="resource-label" style="position: fixed; bottom: 529px; right: 17px;">Resource Monitor</div>');
8560
8561// thanks http://stackoverflow.com/users/165737/anurag
8562$("body #resource-label").css("fontSize", "11px");
8563
8564console.log(window.performance.now() - startUpDelay);
8565//END OF SCRIPT// //END OF SCRIPT// //END OF SCRIPT// //END OF SCRIPT// //END OF SCRIPT// //END OF SCRIPT/