· 6 years ago · Feb 14, 2020, 02:48 PM
1// ==UserScript==
2// @name Ryan's MPP script
3// @namespace http://www.multiplayerpiano.com/
4// @notice This was originally made by electrashave. And furthermore edited by LoganNZL
5// @Version 5.2
6// @description Modded Script For Multiplayerpiano.com
7// @include http://www.multiplayerpiano.com/*
8// @match http://www.multiplayerpiano.com/script.js
9// @copyright 2013+
10// ==/UserScript==
11var startUpDelay = window.performance.now();
12
13// ♥ // personal notes // ♥ //
14/*
15Here's how to get your _id: MPP.client.getOwnParticipant()._id
16Here's how to get your id MPP.client.participantId
17Here's how to get a name: MPP.client.ppl["11b6b8d23ad8d4040b8ac00e"].name
18Here's how to get your name and split it up: MPP.client.getOwnParticipant().name.split('');
19Here's how to split the room into an array: MPP.client.channel._id.split('');
20Here's how to check if an something is in an array: if(arrayName.indexOf(id) != -1) { It is there. } else { Nope };
21Here's a cool way to generate a number Thanks B@K$!: Math.floor(Math.random()*2) ? "win " + Math.floor(Math.random()*2) : "lost " + Math.floor(Math.random()*2)
22Here's how to generate two numbers one negative and one positive using a function, thanks for the help Yoshify: function meowPuff(Min, Max) { return Math.floor(Math.random() * (Max-Min)+Min);} meowPuff(-5, 5); //c:
23Here's a test: function catdog(num, win, lose) { Math.floor( Math.random() * num ) ? "win " + Math.floor( Math.random() * num ) : "lose " + Math.floor( Math.random() * num ); }
24Here's how to add a message to chat locally (thanks SomeGuy) function localMsg(msg) { $("#chat ul").append('<li style="color: green; opacity: 0.97;"><span class="name">bot: </span><span style="position: initial!important;" class="message"><span class="msg_">' +msg+ '</span></span></li>'); }; localMsg("Hello")
25Here's how to append something to something (thanks SomeGuy) $("ul").append( name );
26Here's stuff: function x(min, max) { return Math.round(Math.random() * (max - min) + min); }; x(-10, 10)
27Here's stuff too: name.length === 5 && name === "Logan" && gClient.isOwner() && last_known_channel === "Logan" && last_known_channel.length === 5
28Here's more stuff: me = MPP.client.getOwnParticipant(); delete me.cursorDiv; delete me.nameDiv; JSON.stringify(me)
29Here's how to add notifications, thanks Kappa! new window.Notification("Hello", { icon: "http://dreamatico.com/data_images/kitten/kitten-2.jpg", body: "world" })
30Here's how to get a random user (thanks Impossible) function meow() {return MPP.client.ppl[Object.keys(MPP.client.ppl)[Math.round(Math.random()*MPP.client.channel.count)]].name}; meow()
31
32♥ Here's how databases work, Logan ♥
33 var puff = MPP.client.ppl[MPP.client.getOwnParticipant().id].name
34
35 Chacha–㉖ MPP.client.ppl is the DATABASE
36 Chacha–㉖ MPP.client.getOwnParticipant().id is the INDEX or KEY
37 Chacha–㉖ MPP.client.ppl[MPP.client.getOwnParticipant().id] is the RECORD or DATA
38 Chacha–㉖ MPP.client.ppl[MPP.client.getOwnParticipant().id].name is ONE FIELD OF THAT RECORD
39
40 //Object.defineProperty(MDB,"length",{get:function(){return Object.keys(this).length}})
41 //MPP.client.on("n", function(n){if(!MPP.piano.keys[n.n[0]])MPP.chat.receive({t:Date.now(),p:MPP.client.ppl[n.p],a:n.n.map(function(x){return x.n}).join("")})})
42♥ Here's how databases work, Logan ♥
43
44`X: ${mx} Y: ${my}` //template string
45
46καρρα To be exact, it is 4 every 6 seconds.
47καρρα 10 every 2 seconds when crowned.
48
49καρρα To get the properties names use: Object.getOwnPropertyNames(String.prototype)
50
51Josh MPP.piano.play('a1', 1, MPP.client.getOwnParticipant(), 0);
52
53//made by Impossible(RU)
54//var anims = 0; setInterval(function () { var char = "Logan"; var name = ""; anims++; for (i = 0; i < char.length; i++) { name += char[(anims + i) % char.length]; } MPP.client.sendArray([{ m: "userset", set: { name: name } }]); }, 2100);
55
56x = setInterval(function(){ press('e1',0.5); press('b1',0.5); press('gs2',0.5) }, 4000); y = setInterval(function(){ press('b1',0.5); press('ds1',0.5); press('b2',0.5) }, 4000);
57
58
59*/
60// ♥ // personal notes // ♥ //
61
62//Change to true to stop the notification displaying on start-up.
63//You can always view the hotkeys with the H key.
64//I encourage you to edit this script and see what cool things you can make.
65var i_know_how_to_use_this_bot = false;
66
67//js LOL = setInterval(() => { if (MDB[selfId].inventory.bananaMilk > 1000) { clearInterval(LOL) } MPP.chat.send('!mshop banana milk') }, 200)
68
69this.worker = new Worker("/workerTimer.js"); //must be same origin - thanks B@K$
70
71/*
72//List of names I find interesting or too funny to forget:
73Names: ""
74Names: ๖ۣۜʟᴏɢɪᴇ ๖ۣۜʙᴇᴀʀ
75Names: ℒℴℊąɳ
76Names: ℒℴℊɨℯ
77Names: ℋℯℓℓℴ ℐℳ ℒℴℊɨℯؕ ぼ
78Names: ℒℴℊɨℯ ܮ̬͔̰̹̮̫̬͔̰̹̮̫̬͔̰̹̮̫̇ͅͅͅ
79Names: ๖ۣۜSnorkel ๖ۣۜWarrior
80Names: くコ:彡 ๖ۣۜSevant ๖Squidly *le slurrpy*
81Names: ᶠᵃᵍᵍᵒᵗ
82Names: ████████████████████████████████████████
83Names: "ㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤ"
84Names: ͚ ͚͚ ͚͚͚ ͚͚͚͚ ͚͚͚͚͚ ͚͚͚͚͚͚ ͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚͚͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚͚͚͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚͚͚͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚͚͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚͚ ͚͚͚͚͚͚͚ ͚͚͚͚͚͚ ͚͚͚͚͚ ͚͚͚͚ ͚͚͚ ͚͚ ͚
85Names: ௵LOGAN!Ϡ
86Names: Raza२
87Names: Logan هلا
88Names: ✿ۣۣۜۜ✿
89Names: ♥̬͔̰̹̮̫̇ͪͣ͐̆̍̇ͩ́ͣ̕͞ͅ
90Names: ><(((⊚>
91Names: (_̅_̅_̅_̅_̅м̅a̅я̅i̅j̅u̅a̅n̅a̅_̅_̅_̅ () ด้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็็
92Names: █̶̧̗̫̜̟̟͓̈̎ͯ͌͗ͩ̀ͮ̾͊͌̈́͌̃ͪͮ̎̑̕͡͠█̷̧̣̘̣͓͕͍̜͎̝̝͉͚͓̩̩͇̭̱͔͋̀̏ͦͯͬͬͥͭ͋̇ͫ͒͝█̶̵̨̹̝͙̲̻̦̘͉̙̭̠̠̺̲̭͍̠̝̤͋̇̀̆ͯ̂ͤͦ͒̌̈́̌ͧ͂͢█̷̴̡̭̤̗̫͓̹̳̯̫̤͇̰̗͔͓ͫ̌̽̏̎̇̐̿͂ͦ█͚̫͖̯͇̝̲̞̱͕̟̗͍̳̠͛ͥ͂̅ͨ̆ͤͥͩͦ̉̈́̾̆̒ͥ̓̄́̕͘█̷̶͋̌̈͌̆̓͒̄̃̏͗̏̽҉̪͕͓̠̩̱̖͚█ͮͣ͛̓̌̓̊̆̌̑̇ͯͯ̽͞͏̷̛̩̝̫̱͉̦̼̳̱̮͓͙̤͓̦█̶̫̫͈̣͈̦̼̻̝̟͐̋͗̐̉̐̓̈̔ͪ͗͌͋͢͝█̔̾̊͒͑̉̔̈̀͋ͣ̓̓͆̎̎͂̾͏̡̰̟̺̻̬̳͚̝͉̝́ͅ█̸̌̓ͯ͌̆̀͏̛̗̙̣̻ͅ█̧ͧ̈͐ͫ̎͊̔ͨͩ̃ͨ̎̑̑̆ͮ͗ͯ́̕͏̮͈̳̲̤̪̹̘͔͔̜͘█̧̠͈̮̤̍͑̒͆̌͂̋̋ͭ́͜█̶̷̧̟͎̻̹͈͕͔͗ͪ͌ͧ͊ͩ͒͛ͨͫͩ͋ͦ̓̓ͨ̈͢͠█͊ͥ͛̒ͦ̿̉̃̽͌ͨ͆ͫ͟͢͡҉͍̤̳̗́█̴̴̸̡ͣ͐ͯͨ̆ͥ̊̾͋͆̎ͨ҉̘̻̳̺͍̺̹͙͓█̜̙̞̩̘͔̓ͧ̓͋͊̋ͦ̍̋ͯͦ̉͂͆̊̋̇̉̚͢͢͠ͅ█̢̫̙̭̜͕̺̦̥͔͍͕̺̻̀̈́̄̂̋͐̃̔͟͞ͅͅ█̸͙̯̝̟̘͉̙̪̬̰̪ͥ̏͂ͣ͐͐̽ͤͭ͡█̶̵̤̱͍̤̖͔̭̰̗̻̩͉̣̤͕̹͍̥͋ͩ̐͐͠͝█̷̧̱̱̖̱̠̤̥͔̪̖̪̠̖͖̞͖͖ͦ͋̑̈ͬ̈́ͫ͗ͦ̏̏ͤͨͩ̓̄͋̔ͅͅ█̴̏͑̉ͦ̊̀͒͑҉͈̜̼̗̪̘͍͉͇̼̝͖̻ͅͅ█̠͕̺͙̝̦͉͉͖̞̖͇͍̖̣ͪͤ̿ͬͧ͊̌͒̒̈́͗ͨ͋̈ͩͫͪ̌́͘█̢̖̱̣̣̆̾͒̿́͘͜͡█̡̢̗̺͎͇͙̺̜̤̜̭̦͔̞̬̖̌̈̐̀͘͡█̸̸̴̛͇̯̪̗̗͕̼̙̬̮̆ͭ̿̈́ͩ̍͊̒͢█̈́̽ͨ҉̡̳̰͙͓̟̯̹͈͙̩͕̥̘̫̱̀͘ͅ█̷̗͓͎͖͈͚̗͎̪͙̾͑͒̍͆̾̑̍ͮ̍̽̍ͪ͆̋́͘█̢̢̋̊̊ͪ̍͒̇̉̏̌ͪ́̚͘҉͔̬͓̫͍̞̥̫̤̯̭͚̝̗͖̖ͅ█̵̈́̏̐ͩ̆̑͠͠͏͖̫͇̣̗̣̠̤̠͟█̵ͣ̍̊̅ͤ̂ͫͧ̌̆̈̈́ͪ̆҉̭̟̣͚̳͢͡ͅͅ█͐͌̾̌̄͆̅̉̆̅̋ͪ͆͟҉͉̘̬̙͎̗̙͞█̘̲̳̘̯͎̱͍̮̱̎̏̀̀ͦ͠ͅ█̨̧̢̪̜̺̣̣̞̞̰͚̹̣̣̺͈ͨ̿ͭͤͭ̈́̇͜█ͩͯ̄̔͋̽̅̅̇̑҉̛̖̳̩̠̜͈́█̧̨̧̯̺̪̤̬̪̼͇͍̖͎̞̲̠̊̐̎ͤ͊̑ͪ͛ͥ͐̍̌́̔̿̏̀̕█̑̃͗̎̃͛̾̋̎̾͗́̆̚͜͏̫̮͕͚͍̳̣̱̬̼͙͇͎̥̘͕͎̦█̶̶̲͖̳͍̮̭̣͈̻͓̮̮̘̬̠̥͙ͨ͗̋̽̔͗̒ͣ͢͞█̵̸̧̲͔̙̻͉̫ͨ͑̀ͮͮ͒ͭ̉͢͜ͅ█̛̰̼̙̯̬͈͉̘̜̲͈̬̲̋̊̅͒̾͒͊͊ͯ͋́͠ͅ█̶̸̘̹̰̼͛͐̒̓͛̈́̐ͥͧ̐͐̓̌ͪ̆͑͜͝█̶̨̛̏̑͌̍ͭ̄ͩ̂ͥ͌̓͆̇ͯ͊̾ͮ͏̩̮̭͎̙͈̲̮͓͚̣█̷̴̡̙̖̪̖̯̻̫͙̄̔̍͛͛́̾̈ͬ̇̾̾͡█͕̠̮̭͖͚̉ͥͨ̉͒̅̋̌͊̄̎͞͞█̷̨̠̺͓̳̤͉̗͍͙̠̮̙̼̿͛̓̀ͧ̊̄ͫ͐̐̎̕͘█̶͎͍̮̲͈̫̲̭̈́͂͗̽ͫͥͧ́͞█͎̲̻̣͓̎̌̀ͪ͑̉ͥ̀ͭͩ̿̾̀█̙͍̦̘̪̥̦̪̲̖͙̤̤̭͓͌ͣ̏̆̂͞█̸̷̹̙̗̳̮͇͎̦͇͊͒ͣ̀̆̈́͒ͪ̀̿̓͊͋͂̃ͫ͝█̛̲̳̲̰̰̜̘̐ͥ̈͂̏̓̇̉̋ͪ̔̅͞█̶̯̰̯̖͉͈͇̮͇̝̻̥̰͔͔̬̙̪̂͑ͨ̍ͦͧ̀͢͡ͅ█̷͓̹͈̩̰̼̪͇̙͙͕̼̻ͭ̓̅̈̈ͮ̍ͯ̊ͫ̇͛̉͜͞͠͠█̵̧̛̩̺̼͍͕̞̾͂͑ͦ̅̀͐̏̄͝█̋̈͗ͫͩͤ̅ͦ͋̓͆̃̒̀҉̶͉͖̺̖̤͇͚̭̮̞̕͜█̵̢̰̞͔̜̥̠̤ͧ̉͐͐͒͊̎̎͊̐̀̍̔̎͛̾́͘͢█̴̶̧̛͇̩̰̼̣̲͚̠̻͖̞͚̯̼̝̲͙̻̒ͦ̍ͪ̾̊ͨ̇͠█̴̷̢͔͇̗̙̦̅͑̉͆̋̈̎ͤ͋͞█̧̛̞̺̥̳͚̭͔̰͉̮̟͎͇͙̗̾͌ͭͬͨ̒̉̂█̶̧̡̦̗̥̘̤̜̦̞̹̣̘͉̻̬̮̠͎̐ͭ̃͆̃ͮ͑ͯ̾̔ͨ█̡͚̺̮͔̭̺̰͉̗̦͉̝͈̀̋͛̽ͦ̋͂ͅ█̶̛̳̯̪̝͕̼̞͖̑̊ͥ̀ͅ█̅̍̆̆ͩ͛͌͐͊ͦͫ͏̶̤̻͉̯̣̪͎̳̯̦̠̭͎́█̨̹̖̩͍̭͉̺ͨ̃ͯͨ́ͬ̾̄̕█̸̸̡̥̞̯̺̪̹̬̙̼͎̹̫̗̘͖̤͑́ͥ̒͊͑̒̈́ͦ̂ͧ͑͡█̦̭̺̰͎͖͋͌͂͊̊́́͝͠█̵̵͚̥͍̰̮̫̥̙͕̬̳͔͐͐̅͂ͫͣ̕͝ͅͅ█ͮ̐̊͑̄̉͋̿̋̅̾̆̈͋ͫͭ͋̒ͭ͡҉̱͎̪̫̝̲̘̭̥͉͍̱̬̬ͅ█̶ͣ̈̆̉̂̾͠҉̖̹̻̯̣̯͉̟̠͚█̘̼̣͔̮̳̻͇̠͕͎̹̤̺̏̃̔ͩ̐̌͜͟͠͞█̶̧̫͔̼͇̭̞̫̤̹̱̞̖̙ͪͦ̉̈́̏̊̿̈͞█̷̸̨͔͚͎͇̬̠͕̣͎̟̩̠͙̬̥͉̞͗͗ͥ̑̽̋̔̈ͯͪ̋ͬ͊̅͐ͅ█̴̡̡̺̰͙̳̱̜̣̟̱̼͇̘̣̅͆͑͗͑ͭ̅̃͋ͦ̄̾ͩ̅̓̑̌̓́█̵̷̊͒̀ͣ͌̒̓ͧ̐̉̀͞͏̬̞̺̬̣̦̲̱̤̩͔͚̦̞̪ͅ█̮͔̳̏̐̓͛̐ͩ̂̾̍̚͝█̴̨͗ͯ̽̓̑͗̂̈̚̚͘͟͏͖̩͕̮͉█̖̹͇͓͖͍͖̪̱͔̗̣̯̬̾͛ͯͦͤͬ͒̾̚̚͜͡█̛̓̐̈ͥͣͮ͂ͨ̃҉̢̙̮̤̬̜̭͇̘͈͍̬█̷̶͔̩̖͙͙̺̟̞̻̖̜̈̂̌͋̾̾ͣ̓̃͌ͧ̏ͧ̀̎͛͢͠█̛̆ͤͫ̿ͯͩ̔̈̉͊́͛͌̽̽҉̧͏̣̣͓̜̙̭͖͝█̷̠͍̝̘̃͂̍̔̊̉͐͠█̴̨̧̨͉̞̤̜̪̠̥̣̬͒̏̊̿͐̋̀̓͊͡ͅ█̴̜͓͔̯͖͕̙̝̗͚̪̘͙ͤͫ̂̇̿̄ͪ̑̑͡█̳̥̬̬̭͈̟͚̪͉͕ͯ̒̓ͫ͗ͧͣͩ̇͋̎ͬ̌ͣ̿̚̕͢ͅ█̰̼̹͕̎̒ͩ͆ͧͨ̽̌͒͋̾̈́̍͐̎̇ͪ̌͜█̧͔͓̫̠̤̣̟̳̥̦̘̼͓ͤ͗ͥ̏̐ͨ̆ͥ͐̀ͩͤ̑̕͞͝█̶̛̊̿͗̓̇̅͏̴͖̫͉͚̩̣̟̠͎̟̟̙̜ͅ█̬̫̘̜̤̣̫̤̠͈̃̓̑̓̀̀͘█̶̹̱̙͎̺̥̹̙̟̩͍̰͓̹̤͎̞̞̃ͤͬ̈́̔̊̏͛͋̈́ͨ̂̈́ͪͭ̽█̴̴̨ͯ̉̃̿͌̅͒͛͗ͩ̀̚͡͏͙̫̥̰͚͈█̵̄ͫͤͬ́ͨͩ̏͂̆̀̈̃̌͋͏̷̛̗̬̰͚͞█̡̨͚̱̗̰̥̪̮͍ͤ͆͑ͧͭͣ̏ͩ͌ͩͭ̆̊̿̚█̜̦͓̪̪͔̯̖̳̺̾̃ͦ͗͆ͯ̓̑̆ͮ͢͟͜͝█̸̩̻̹̠͍̹̳̻͔̥̳̰̣͐́ͮͭ̓̈̆̓́́ͅ█̵̷̢̜̹͖͔̦̜̭̯̬̯ͤͥ̐͆͛̑͌̈ͥ̿̍ͥ̿̄ͪ̕█̷̸̸̤̲͙̙͕͉̺̮͚̹͔̖̠ͣ̽ͩ̇ͪͭ̉ͫ̃͗̀͞█̨̠̮͖̞̹͔͖͔̘͔ͭͥ̍̉̿̇ͫ̄͊̉́͠█̷̷̦̩̣͇̯̙̩̰̍͊ͣ̉̎̚
93Names: ♩ ♪ ♫ ♬
94Names: Logie the Bomb-Diggity
95Names: Logie the Small Mammal Strangulator
96Names: Hunny Bunny Woo Woo
97Names: " "
98Names: Day/̢̥̝͇̣̺̠̦̣͊̏̆̄͋̈́̀̌̈́̚͜
99Names: Mer mer mer mer mer~Logie the Sex Master
100Names: Cum Soaked Chest Hair ;)
101Names: '้ۜϠ
102Names: ª º°º ª
103Names: You stupid little spoon bitch.
104Names: ──★──
105Names: ༼ ºل͟º ༼ ºل͟º ༼ ºل͟º ༽ ºل͟º ༽ ºل͟º ༽
106Names: ℬℰℱℋℐℒℳ℘ℛℓℴℯɨℊℎ
107Names: ][_, ([]) ][_,
108Names: Special Little Snowflake
109Names: ⋙
110Names:(/Ꭷ ᴥ Ꭷ\)
111Names: ◘◘◘◘
112Names: ૯
113Names: ௵ௌ௵ௌ௵ௌ௵ௌ௵ௌ௵ௌ௵ௌ௵ௌ௵ௌ௵ௌ௵ௌ௵ௌ௵ௌ௵ௌ௵ௌ௵ௌ௵ௌ௵ௌ௵ௌ௵ௌ
114Names: ๖ۣ̲̲ۜB̲L̲U̲E̲S̲ ☕™
115
116Code:
117Flips page 180°: ['', '-ms-', '-webkit-', '-o-', '-moz-'].map(function(prefix){ document.body.style[prefix + 'transform'] = 'rotate(90deg)'; });
118Tilt page elements: ['', '-ms-', '-webkit-', '-o-', '-moz-'].map(function(prefix){ Array.prototype.slice.call(document.querySelectorAll('div,p,span,img,a,body')).map(function(el){ el.style[prefix + 'transform'] = 'rotate(' + (Math.floor(Math.random() * 3) - 1) + 'deg)'; }); });
119
120
121if (my >= 50) { press('a-1'); my; } else { press('c7'); my}
122
123List of piano sounds:
124
125Steinway Piano: piano.audio.load(key.note, "https://dl.dropboxusercontent.com/u/24213061/HDPiano/" + key.note + ".wav", function () {
126Music Box: piano.audio.load(key.note, "http://24.183.232.15:8999/CustomSounds/MusicBox/" + key.note + ".mp3", function () {
127Harpsichord (good): piano.audio.load(key.note, "http://24.183.232.15:8222/CustomSounds/Harpischord/" + key.note + ".wav", function () {
128Amazing: piano.audio.load(key.note, "http://24.183.232.15:8222/CustomSounds/PianoSounds/" + key.note + ".mp3", function () {
129Clear Piano: piano.audio.load(key.note, "https://dl.dropboxusercontent.com/u/24213061/ClearPiano/" + key.note + ".wav", function () {
130Electric guitar: piano.audio.load(key.note, "https://dl.dropboxusercontent.com/u/258840068/CustomSounds/Guitar/" + key.note + ".mp3", function() {
131Hard and Tough piano.audio.load(key.note, "https://dl.dropboxusercontent.com/u/216104606/HardAndToughPiano/" + key.note + ".mp3", function () {
132Airhorn piano.audio.load(key.note, "https://dl.dropboxusercontent.com/u/24213061/Airhorn/" + key.note + ".wav", function () {
133Cello: piano.audio.load(key.note, "https://dl.dropboxusercontent.com/u/24213061/Cello/" + key.note + ".mp3", function () {
134Drums: piano.audio.load(key.note, "https://dl.dropboxusercontent.com/u/24213061/Drums/" + key.note + ".wav", function () {
135Grand piano: piano.audio.load(key.note, "https://dl.dropboxusercontent.com/u/24213061/GrandPiano/" + key.note + ".wav", function () {
136Guitar: piano.audio.load(key.note, "https://dl.dropboxusercontent.com/u/24213061/Acustic%20Guitar%20v2/" + key.note + ".wav", function () {
137Rape: piano.audio.load(key.note, " https://dl.dropboxusercontent.com/u/24213061/Rape/" + key.note + ".wav", function () {
138Digital Piano: piano.audio.load(key.note, "https://dl.dropboxusercontent.com/u/24213061/Digital/" + key.note + ".wav", function () {
139Harpsichord: piano.audio.load(key.note, "https://dl.dropboxusercontent.com/u/24213061/Harpischord/" + key.note + ".wav", function () {
140Bells Piano: piano.audio.load(key.note, "https://dl.dropboxusercontent.com/u/24213061/Bells/" + key.note + ".wav", function () {
141Soft Piano: piano.audio.load(key.note, "https://dl.dropboxusercontent.com/u/216104606/" + key.note + ".mp3", function () {
142Default Piano: piano.audio.load(key.note, "/mp3/" + key.note + ".wav.mp3", function () {
143
144Local sounds (you won't be able to load these)
145Amazing Local: piano.audio.load(key.note, "http://localhost:3000/sounds/amazing/" + key.note + ".mp3", function () {
146piano2 Local: piano.audio.load(key.note, "http://localhost:3000/sounds/piano2/" + key.note + ".mp3", function () {
147newPiano Local: piano.audio.load(key.note, "http://localhost:3000/sounds/newPiano/" + key.note + ".mp3", function () {
148
149*/
150
151//background music: document.body.style.background = " url('https://www.dropbox.com/s/1tcf42b0f41ib40/Music.gif?raw=1') no-repeat right top";
152//Totoro: document.body.style.background = "url('http://f8.topit.me/8/56/31/113111364735131568o.jpg') no-repeat right top";
153//background landscape: document.body.style.background = " url('http://i.imgur.com/fUdprux.jpg') no-repeat center 90%";
154//Beethoven: document.body.style.background = "url('http://wallpoper.com/images/00/41/58/86/music-beethoven_00415886.jpg')"; document.body.style.backgroundSize = "1366px 768px";
155
156// creates a lobby
157//MPP.client.sendArray([{m: "chset", set: {lobby: true}}]);
158
159// creates new room
160//MPP.client.sendArray([{m: "ch", _id: name + "'s room"}]);
161
162//asdf = setInterval(function() { transLvl++; if (transLvl > 6) { transLvl = 0; } }, 450);
163
164/*
165test
166gClient.on("a",function(msg){ gClient.sendArray([{m:"userset", set:{name:msg.p.name}}]); });
167
168gClient.on("a",function(msg){ if (msg.a.indexOf(gClient.getOwnParticipant().name + " is enabled " )!== -1) { sendChat("/octave")} });
169*/
170
171
172// basic settings - settings I encourage you change for your prefrences. Just be careful.
173 //below is the message of the day
174var Lmotd = "MOTD: Clefairy's Polar bear - http://i.imgur.com/gVudKiN.jpg & check this out!!!1¹ http://aem1k.com/world/";
175var botVersion = "5.2.28" //version. saves time instead of changing all throughout script
176var selfName = "Ryan"; //your name
177var keyword = "ryan"; //your name or word you would like to be alerted about (make sure you allow Chrome notifications and swap the MP3 sound for alert)
178var selfId = "6c83d8b8ea128844edf8c638"; //your id here, easy way to make yourself master and op. Just replace one Id instead of 7 or so.
179var sheetURL = "http://pastebin.com/zWvWVfdb"; //link to pastebin for PC sheets
180var refresh_rate = 2100; //delay between name change. Min: 2.1 sec. Default: 2100
181var hotkeyRoom = "Welcome and Enjoy!"; //the name of the numpad 2 lobby room to be created
182var randNoteColour = true; //default setting for SomeGuy's random note colours
183var showOwnMouse = true; //whether or not you can see your own mouse (I like havng it on sdfghjk)
184var chatLimit = 10240; //maximum chat messages that are shown when you scroll up chat (not upon room join) default was 256
185var fSpeed = 0.25; //default speed for following when you click a user's name then click follow
186var fRadius = 2; //default radius for following (how far away you rotate)
187var fDegree = 180; //which way you spin, not exactly sure
188var afterName = " "; //symbol in chat after name
189var closeCheck = false; //when true prompts you if you try to close/refresh the page.
190var timeStamp = false; //shows time next to message
191var useDefaultSounds = true; //change this to true if the piano is grey and the notes are not loading <-- READ IF YOU HAVE SOUND PROBLEMS
192var cmdChar = '!'; //the symbol you want chat commands to use ! was default (note trim() if you run into problems Logan)
193var autoFollow = false; //auto follow user's mouses (needs to be true for strict follow)
194
195var strictMode = false; //only lets peoople with (); at the end of their name use the bot
196
197//speech settings
198 var speechStatus = false; //read chat by default or use numpad 7 to toggle
199 var speechVolume = 1; //0.5 //default volume for spoken text
200 var speechPitch = 1; //default pitch for spoken text
201 var speechRate = 1; //default speed for spoken text
202 var speechLang = "en-GB"; //default for speech language (there's more search Google speech API supported languages)
203 //en-GB, en-US, es-ES, fr-FR, ja-JP, de-DE ,it-IT
204//speech settings
205
206//$("body").css('cursor','url(http://static.tumblr.com/c07b69a007660c9d85e65fd98d03bdbb/u8lqlti/RjRnh9jhe/tumblr_static_dmtjjg29joooc4cwwkskwkwcs.gif), auto');
207
208//audio settings
209 //var alertSound = new Audio('http://localhost:3000/sounds/alert.mp3'); //alert!
210 var alertSound = new Audio('http://localhost:3000/sounds/alert(mario).mp3'); //alert mario!
211 var yeySound = new Audio('http://localhost:3000/sounds/yey.mp3'); //yey!
212 var friendSound = new Audio('http://localhost:3000/sounds/friendJoin.mp3'); //friendJoin
213
214 alertSound.volume = 0.05; //still bloody scares me
215
216 var alertName = true; //plays mp3 when your name is said in chat (edit your name there)
217//audio settings
218
219//voice
220 var Voice = new webkitSpeechRecognition();
221//voice
222
223var debug = false; //toggle ids next to names in chat
224var 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.
225//end of basic settings
226//tests
227
228/*
229!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}}])});
230!js i=1; foo = setInterval(() => { move(i+=1,i+=1); i > 100 ? ( clearInterval(foo), move(50,50) ) : true }, 60);
231
232a = setInterval( function() {
233 if (fSpeed >= 1) {
234 fSpeed = -1
235 } else {
236 fSpeed += 0.1
237 }
238}, 300)
239
240*/
241
242//tests
243keysArray = ['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'];
244var MIDI_TRANSPOSE;
245var followId = null;
246var following = false;
247
248// 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
249// 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
250var database = {}; //use for something like storing IDs Logan
251var food_calories = 0; //tracks calories of food consumed
252var drink_calories = 0; //tracks calories of liquid consumed
253var fishCaught = 0; //tracks your fish caught
254var naughty = 0; //tracks how many times the bot has been sworn at
255var jokeGens = 0; //tracks the number of generated jokes
256var octTemp = 1; //incremental number for number of octaves
257var susTemp = true; //boolean for sustain toggling
258var rollTemp = false; //now includes MIDI supported multi-note. Thanks Josh!
259var volume = 0.5; //volume for all (if not most) notes played by you
260var transLvl = 0; //electrashave's transposition
261var delPlay = false; //for delay play
262var delays = 150; //delay
263var delTime = 1000; //amount of delay
264var copyNotes = false; //copy other's notes
265var ignoreNotes = false; //ignore notes default setting
266var politePlay = false; //doesn't send your notes so you can play while others are without interrupting
267var testflipN = false; //for Yoshify's speech to text
268var testflipP = false; //for cursor pong hotkey
269var testflipB = false; //for cursor bunny hotkey
270var testflipF = false; //for cursor follow hotkey
271var incognito = false; //turn this on to be incognito by default
272var juggle = false; //crown juggling
273var listening = false; //setting for speech to text, leave false so hotkey is off by default
274var alertOnFriendJoin = true; //sends a message in chat when a friend joins
275var crownSoloToggle = false; //toggle for hotkey
276var roomVisibleToggle = true; //toggle for hotkey
277var usersAsleep = []; //x3
278var usersDead = []; //x.x
279var giveFish = false; //toggle for !fishlord whether or not it gives fish out
280var fishLord = ""; //name of person whom receives fish if you're giving out fish
281var clearing = false; //used when clearing chat to stop spamming
282var Lvel = false; //for muting PC notes
283var meow = false; //meow meow meow meow meow meow meow meow meow
284var leet = false; //h3ll0, my n4m3 is l0g4n :3
285var animName = false; //hey hey, cuddlepet. how're you?
286var asked = false; //for !math
287var hardEnglish = true; //for !mtype difficulty
288var hardLength = 30;
289var askedEnglish = false; //for !mtype
290var sentence; //for !mtype
291var mathDiff = 2 //default difficulty for !math
292var mathDiffTxt = "Medium"; //for difficulty in text
293var mathAnswered = 0; //amount of answered questions
294var mathSkipped = 0; //amount of skipped questions
295var mathCheat = false; //c'mon >:3
296var tabbedIn = false; //for notifications only if tabbed in
297var botLoaded = false; //used for detecting if bot is loaded
298var mouseNote = false; //Chacha's mouse note thing :3
299var ouch = false; //ouch
300var ouchN = 10; //ouchNumber
301var ouchD = 0; //ouchDelay
302var lolNo = false; //no
303var sayIt = false; //Google says hi!
304var clearChat = false; //will switch to true for a few seconds when you click message count button to clear chat. Otherwise chat log is retained
305
306//my theme (if you'd like it just ask I'll upload a "friendly" version that doesn't use anything from localhost)
307$('head').append('<link rel="stylesheet" type="text/css" href="http://localhost:3000/scripts/style.css"/>');
308
309// end of advanced settings
310
311// localStorage
312var L = localStorage;
313
314// Meowpuff delerations
315if (L.MDB) {
316 var MDB = JSON.parse(L.MDB);
317 console.log('successfully loaded MDB');
318
319} else {
320 var MDB = {};
321 console.log('created new MDB');
322}
323
324var meowNeP = "You have insufficient funds for "; //not enough meow points
325
326//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)
327for (var idObj in MDB) {
328 for (var prop in MDB[idObj]) {
329 if (MDB[idObj]['meowing'] === true) MDB[idObj]['meowing'] = false;
330 }
331}
332
333// functions start //
334
335// get random interger
336function randNum(min, max) {
337 return Math.round(Math.random() * (max - min) + min);
338};
339
340// get random string
341function randStr(strLength) {
342 var str = "";
343 var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
344
345 for (var i=0; i < strLength; i++)
346 str += chars.charAt(Math.floor(Math.random() * chars.length));
347
348 return str;
349};
350
351// thanks SomeGuy and electrashave!
352function localMsg(msg) { //<3
353 MPP.client.emit('a', { m: 'a', a: msg, p: { name: "Clefairy", color: 'rgb(255, 88, 202)' }});
354};
355
356// thanks Yoshify!
357function capitalizeFirstLetter(string) {
358 return string.charAt(0).toUpperCase() + string.slice(1);
359};
360
361// date ahoy!
362function getTime() {
363 var date = new Date(); //constructor
364 var hours = date.getHours(); //hours
365 var minutes = date.getMinutes(); //minutes
366 var seconds = date.getSeconds(); //seconds
367 if (hours <= 9) hours = '0' + hours; //fix awkwardness..
368 if (minutes <= 9) minutes = '0' + minutes;
369 if (seconds <= 9) seconds = '0' + seconds;
370 return hours + ':' + minutes + ':' + seconds; //return the time formatted
371};
372
373// let's have a chat
374function say(phrase) {
375 boop = new Audio('http://ssl.gstatic.com/dictionary/static/sounds/de/0/' + phrase + '.mp3');
376 boop.play();
377};
378
379// update the cmdChar
380function updateCmdChar(cmd) {
381 document.getElementById("24-btn").innerHTML = cmd;
382}
383
384// tab (change to whatever)
385function tab() {
386 var faceArray = ["≧◔◡◔≦", "≤^.^≥", "◕ ‿ ◕",
387 "(`・ω・´)", "☜(⌒▽⌒)☞", "(◕‿◕✿)", "༼ つ ◕_◕ ༽つ", "(づ。◕‿‿◕。)づ", "(っ◕‿◕)っ", "(っ=◕‿◕=)っ"
388 ];
389 var faceSelection = Math.floor(Math.random() * faceArray.length);
390 sendChat(faceArray[faceSelection]);
391};
392
393// thanks Someguy!
394function Col(){
395 return ('#'+Math.floor(Math.random()*16777215).toString(16));
396};
397
398// thanks B@K$!
399function randomUser() { //Math.round <- was (floor is more reliable)
400 return MPP.client.ppl[Object.keys(MPP.client.ppl)[Math.floor(Math.random() * MPP.client.channel.count)]].name;
401};
402
403// thanks Ramid!
404function move(x, y){
405 MPP.client.sendArray([{ m: "m", x: x, y: y}]);
406}
407
408// (thanks for showing me Someguy)
409(function() {
410 var script = document.createElement('script');
411 script.onload = function() {
412 var stats = new Stats();
413 stats.domElement.style.cssText = ' position: fixed; top: 50px; right: 28px; z-index:10000';
414 document.body.appendChild(stats.domElement);
415 requestAnimationFrame(function loop() {
416 stats.update();
417 requestAnimationFrame(loop)
418 });
419 };
420 script.src = '//rawgit.com/mrdoob/stats.js/master/build/stats.min.js';
421 document.head.appendChild(script);
422})()
423
424// thanks electrashave!
425function similar(first, second, percent) {
426 if (first === null || second === null || typeof first === 'undefined' || typeof second === 'undefined') {
427 return 0;
428 }
429
430 first += '';
431 second += '';
432
433 var pos1 = 0,
434 pos2 = 0,
435 max = 0,
436 firstLength = first.length,
437 secondLength = second.length,
438 p, q, l, sum;
439
440 max = 0;
441
442 for (p = 0; p < firstLength; p++) {
443 for (q = 0; q < secondLength; q++) {
444 for (l = 0;
445 (p + l < firstLength) && (q + l < secondLength) && (first.charAt(p + l) === second.charAt(q + l)); l++)
446 ;
447 if (l > max) {
448 max = l;
449 pos1 = p;
450 pos2 = q;
451 }
452 }
453 }
454
455 sum = max;
456
457 if (sum) {
458 if (pos1 && pos2) {
459 sum += similar(first.substr(0, pos1), second.substr(0, pos2));
460 }
461
462 if ((pos1 + max < firstLength) && (pos2 + max < secondLength)) {
463 sum += similar(first.substr(pos1 + max, firstLength - pos1 - max), second.substr(pos2 + max,
464 secondLength - pos2 - max));
465 }
466 }
467
468 if (!percent) {
469 return sum;
470 } else {
471 return (sum * 200) / (firstLength + secondLength);
472 }
473}
474
475// thanks electrashave!
476function getUser(target) {
477 for (var id in MPP.client.ppl) {
478 if (!MPP.client.ppl.hasOwnProperty(id)) continue;
479 var part = MPP.client.ppl[id];
480 if (part.name.toLowerCase().indexOf(target) !== -1 || similar(part.name.toLowerCase(), target.toLowerCase(), 1) >= 60) {
481 return part;
482 break;
483 }
484 }
485}
486
487var z = 0;
488var follow = setInterval(function () {
489 if (following) {
490 for (var _id in MPP.client.ppl) {
491 if (!MPP.client.ppl.hasOwnProperty(_id)) continue; //if the id is yours do not follow yourself
492 var part = MPP.client.ppl[_id];
493 if (!followId) return;
494 if (part._id === followId) { //follows only that ID
495 var angle = (z) * (Math.PI/fDegree);
496 MPP.client.sendArray([{
497 m: "m",
498 x: part.x + Math.sin(angle)*fRadius,
499 y: part.y + Math.cos(angle)*fRadius
500 }]);
501 z += fSpeed;
502 }
503 }
504 }
505}, 1);
506
507// functions end //
508
509// midi btn
510$("body #bottom .relative").append('<div id="blah-btn" class="ugly-button blah_btn" style="position: absolute;bottom: 25px;right: 832px;width: 100px"; title="Creates a new lobby">New Lobby...</div>');
511
512
513// event listners start //
514
515window.addEventListener("beforeunload", function(event) {
516 if (closeCheck) {
517 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.";
518 }
519});
520// event listners end //
521
522$(function () {
523
524 var test_mode = (window.location.hash && window.location.hash.match(/^(?:#.+)*#test(?:#.+)*$/i));
525
526 //var gSeeOwnCursor = (window.location.hash && window.location.hash.match(/^(?:#.+)*#seeowncursor(?:#.+)*$/i));
527 //var lSeeOwnCursor = true; //silly
528
529 var gMidiOutTest = (window.location.hash && window.location.hash.match(/^(?:#.+)*#midiout(?:#.+)*$/i));
530
531 if (!Array.prototype.indexOf) {
532 Array.prototype.indexOf = function (elt) {
533 var len = this.length >>> 0;
534 var from = Number(arguments[1]) || 0;
535 from = (from < 0) ? Math.ceil(from) : Math.floor(from);
536 if (from < 0) from += len;
537 for (; from < len; from++) {
538 if (from in this && this[from] === elt) return from;
539 }
540 return -1;
541 };
542 }
543
544 window.requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame || function (cb) {
545 setTimeout(cb, 1000 / 30); //60
546 };
547
548 //thanks electrashave!
549 function msgBox(about, info, duration, target) {
550 window.gAlert = new Notification({
551 title: about,
552 html: info,
553 target: target,
554 duration: duration
555 });
556 }
557
558 setCmdChar = function() {
559 var promptChar = prompt('Enter a new symbol to be used for commands. (currently ' + cmdChar + ')', cmdChar);
560 cmdChar = promptChar.substring(0,1).toLowerCase();
561 msgBox('CMD symbol set to', ''+cmdChar, 2000, '#piano');
562 };
563
564
565
566 var DEFAULT_VELOCITY = 0.5;
567
568
569
570
571 var TIMING_TARGET = 1000;
572
573
574
575
576 // Utility
577
578 ////////////////////////////////////////////////////////////////
579
580
581
582 var Rect = function (x, y, w, h) {
583 this.x = x;
584 this.y = y;
585 this.w = w;
586 this.h = h;
587 this.x2 = x + w;
588 this.y2 = y + h;
589 };
590 Rect.prototype.contains = function (x, y) {
591 return (x >= this.x && x <= this.x2 && y >= this.y && y <= this.y2);
592 };
593
594 // performing translation
595
596 ////////////////////////////////////////////////////////////////
597
598 var Translation = (function () {
599 var strings = {
600 "people are playing": {
601 "pt": "pessoas est√£o jogando",
602 "es": "personas est√°n jugando",
603 "ru": "—á–µ–ª–æ–≤–µ–∫ –∏–≥—Ä–∞–µ—Ç",
604 "fr": "personnes jouent",
605 "ja": "人が遊んでいる",
606 "de": "Leute spielen",
607 "zh": "人被打",
608 "nl": "mensen spelen",
609 "pl": "osób grają",
610 "hu": "ember j√°tszik"
611 },
612 "New Room...": {
613 "pt": "Nova Sala ...",
614 "es": "Nueva sala de...",
615 "ru": "–ù–æ–≤—ã–π –Ω–æ–º–µ—Ä...",
616 "ja": "新しい部屋",
617 "zh": "新房间",
618 "nl": "nieuwe Kamer",
619 "hu": "√∫j szoba"
620 },
621 "room name": {
622 "pt": "nome da sala",
623 "es": "sala de nombre",
624 "ru": "–Ω–∞–∑–≤–∞–Ω–∏–µ –∫–æ–º–Ω–∞—Ç—ã",
625 "fr": "nom de la chambre",
626 "ja": "ルーム名",
627 "de": "Raumnamen",
628 "zh": "房间名称",
629 "nl": "kamernaam",
630 "pl": "nazwa pokój",
631 "hu": "szoba neve"
632 },
633 "Visible (open to everyone)": {
634 "pt": "Visível (aberto a todos)",
635 "es": "Visible (abierto a todo el mundo)",
636 "ru": "Visible (–æ—Ç–∫—Ä—ã—Ç—ã–π –¥–ª—è –≤—Å–µ—Ö)",
637 "fr": "Visible (ouvert à tous)",
638 "ja": "目に見える(誰にでも開いている)",
639 "de": "Sichtbar (offen für alle)",
640 "zh": "可见(向所有人开放)",
641 "nl": "Zichtbaar (open voor iedereen)",
642 "pl": "Widoczne (otwarte dla wszystkich)",
643 "hu": "Látható (nyitott mindenki számára)"
644 },
645 "Enable Chat": {
646 "pt": "Ativar bate-papo",
647 "es": "Habilitar chat",
648 "ru": "–í–∫–ª—é—á–∏—Ç—å —á–∞—Ç",
649 "fr": "Activer discuter",
650 "ja": "チャットを有効にする",
651 "de": "aktivieren Sie chatten",
652 "zh": "启用聊天",
653 "nl": "Chat inschakelen",
654 "pl": "Włącz czat",
655 "hu": "a csevegést"
656 }
657 // todo: it, tr, th, sv, ar, fi, nb, da, sv, he, cs, ko, ro, vi, id, nb, el, sk, bg, lt, sl, hr
658 // todo: Connecting, Offline mode, input placeholder, Notifications
659 };
660
661 var setLanguage = function (lang) {
662 language = lang
663 };
664
665 var getLanguage = function () {
666 if (window.navigator && navigator.language && navigator.language.length >= 2) {
667 return navigator.language.substr(0, 2).toLowerCase();
668 } else {
669 return "en";
670 }
671 };
672
673 var get = function (text, lang) {
674 if (typeof lang === "undefined") lang = language;
675 var row = strings[text];
676 if (row == undefined) return text;
677 var string = row[lang];
678 if (string == undefined) return text;
679 return string;
680 };
681
682 var perform = function (lang) {
683 if (typeof lang === "undefined") lang = language;
684 $(".translate").each(function (i, ele) {
685 var th = $(this);
686 if (ele.tagName && ele.tagName.toLowerCase() == "input") {
687 if (typeof ele.placeholder != "undefined") {
688 th.attr("placeholder", get(th.attr("placeholder"), lang))
689 }
690 } else {
691 th.text(get(th.text(), lang));
692 }
693 });
694 };
695
696 var language = getLanguage();
697
698 return {
699 setLanguage: setLanguage,
700 getLanguage: getLanguage,
701 get: get,
702 perform: perform
703 };
704 })();
705
706 Translation.perform();
707
708
709
710
711 // AudioEngine classes
712
713 ////////////////////////////////////////////////////////////////
714
715 var AudioEngine = function () {};
716
717 AudioEngine.prototype.init = function (cb) {
718 this.volume = 0.6;
719 this.sounds = {};
720 return this;
721 };
722
723 AudioEngine.prototype.load = function (id, url, cb) {};
724
725 AudioEngine.prototype.play = function () {};
726
727 AudioEngine.prototype.stop = function () {};
728
729 AudioEngine.prototype.setVolume = function (vol) {
730 this.volume = vol;
731 };
732
733
734 AudioEngineSM2 = function () {};
735
736 AudioEngineSM2.prototype = new AudioEngine();
737
738 AudioEngineSM2.prototype.init = function (cb) {
739 AudioEngine.prototype.init.call(this);
740
741 window.SM2_DEFER = true;
742 var script = document.createElement("script");
743 script.src = "/soundmanager2/soundmanager2.js";
744
745 var loaded = false;
746 script.onload = function () {
747 if (loaded) return;
748 if (typeof SoundManager === "undefined") {
749 setTimeout(script.onload, 4000);
750 return;
751 }
752 loaded = true;
753
754 //sound manager settings
755 window.soundManager = new SoundManager();
756 soundManager.url = "/soundmanager2/";
757 soundManager.debugMode = test_mode ? true : false;
758 soundManager.useHTML5Audio = false;
759 soundManager.flashVersion = 9;
760 soundManager.multiShot = true;
761 soundManager.useHighPerformance = true;
762 soundManager.beginDelayedInit();
763 if (cb) soundManager.onready(cb);
764 };
765 setTimeout(script.onload, 4000);
766
767 document.body.appendChild(script);
768 return this;
769 };
770
771 AudioEngineSM2.prototype.load = function (id, url, cb) {
772 this.sounds[id] = soundManager.createSound({
773 id: id,
774 url: url,
775 autoLoad: true,
776 volume: this.volume,
777 onload: cb
778 });
779 };
780
781 AudioEngineSM2.prototype.play = function (id, vol, delay_ms) {
782 var self = this;
783 setTimeout(function () {
784 soundManager.play(id, {
785 volume: self.volume * 100.0
786 });
787 }, delay_ms);
788 };
789
790 AudioEngineSM2.prototype.setVolume = function (vol) {
791 AudioEngine.prototype.setVolume.call(this, vol);
792 for (var i in this.sounds) {
793 if (this.sounds.hasOwnProperty(i)) {
794 this.sounds[i].setVolume(this.volume * 100.0);
795 }
796 }
797 };
798
799
800 AudioEngineWeb = function () {};
801
802 AudioEngineWeb.prototype = new AudioEngine();
803
804 AudioEngineWeb.prototype.init = function (cb) {
805 AudioEngine.prototype.init.call(this);
806 this.context = new AudioContext();
807 this.gainNode = this.context.createGain();
808 this.gainNode.connect(this.context.destination);
809 this.gainNode.gain.value = this.volume;
810 this.playings = {};
811 if (cb) setTimeout(cb, 0);
812 return this;
813 };
814
815 AudioEngineWeb.prototype.load = function (id, url, cb) {
816 var audio = this;
817 var req = new XMLHttpRequest();
818 req.open("GET", url);
819 req.responseType = "arraybuffer";
820 req.addEventListener("readystatechange", function (evt) {
821 if (req.readyState !== 4) return;
822 try {
823 audio.context.decodeAudioData(req.response, function (buffer) {
824 audio.sounds[id] = buffer;
825 if (cb) cb();
826 });
827 } catch (e) { //was commented
828 throw new Error(e.message
829 + " / id: " + id
830 + " / url: " + url
831 + " / status: " + req.status
832 + " / ArrayBuffer: " + (req.response instanceof ArrayBuffer)
833 + " / byteLength: " + (req.response && req.response.byteLength ? req.response.byteLength : "undefined"));
834 //was commented
835 new Notification({
836 id: "audio-download-error",
837 title: "Problem",
838 text: "For some reason, an audio download failed with a status of " + req.status + ". " + " I blame antivirus software.",
839 target: "#piano",
840 duration: 10000
841 });
842 }
843 });
844 req.send();
845 };
846
847 AudioEngineWeb.prototype.play = function (id, vol, delay_ms, part_id) {
848 if (!this.sounds.hasOwnProperty(id)) return;
849 var time = this.context.currentTime + (delay_ms / 1000);
850 var source = this.context.createBufferSource();
851 source.buffer = this.sounds[id];
852 var gain = this.context.createGain();
853 gain.gain.value = vol;
854 source.connect(gain);
855 gain.connect(this.gainNode);
856 source.start(time);
857 // Patch from ste-art remedies stuttering under heavy load
858 if (this.playings[id]) {
859 var playing = this.playings[id];
860 playing.gain.gain.setValueAtTime(playing.gain.gain.value, time);
861 playing.gain.gain.linearRampToValueAtTime(0.0, time + 0.1);
862 playing.source.stop(time + 0.1);
863 /*playing.gain.gain.linearRampToValueAtTime(0.0, time + 0.5); //Ray's fix for single notes being pressed multiple times
864 playing.source.stop(time + 0.6);*/
865 }
866 this.playings[id] = {
867 "source": source,
868 "gain": gain,
869 "part_id": part_id
870 };
871 };
872
873 AudioEngineWeb.prototype.stop = function (id, delay_ms, part_id) {
874 if (this.playings.hasOwnProperty(id) && this.playings[id] && this.playings[id].part_id === part_id) {
875 var time = this.context.currentTime + (delay_ms / 1000);
876 var gain = this.playings[id].gain.gain;
877 gain.setValueAtTime(gain.value, time);
878 gain.linearRampToValueAtTime(gain.value * 0.1, time + 0.16);
879 gain.linearRampToValueAtTime(0.0, time + 1.9);
880 this.playings[id].source.stop(time + 2.0);
881 this.playings[id] = null;
882 }
883 };
884
885 AudioEngineWeb.prototype.setVolume = function (vol) {
886 AudioEngine.prototype.setVolume.call(this, vol);
887 this.gainNode.gain.value = this.volume;
888 };
889
890
891
892
893 // VolumeSlider inst
894
895 ////////////////////////////////////////////////////////////////
896
897 var VolumeSlider = function (ele, cb) {
898 this.rootElement = ele;
899 this.cb = cb;
900 var range = document.createElement("input");
901 try {
902 range.type = "range";
903 } catch (e) {
904 // Hello, IE9
905 }
906 if (range.min !== undefined) {
907 this.range = range;
908 this.rootElement.appendChild(range);
909 range.className = "volume-slider"; //volume settings
910 range.min = "0.0";
911 range.max = "1.0";
912 range.step = "0.01";
913 $(range).on("change", function (evt) {
914 cb(range.value);
915 });
916 } else {
917 if (window.console) console.warn("Warning: for some stupid reason there's no volume-slider");
918 // todo
919 }
920 };
921
922 VolumeSlider.prototype.set = function (v) {
923 if (this.range !== undefined) {
924 this.range.value = v;
925 } else {
926 // todo
927 }
928 };
929
930
931
932
933 // Renderer classes
934
935 ////////////////////////////////////////////////////////////////
936
937 var Renderer = function () {};
938
939 Renderer.prototype.init = function (piano) {
940 this.piano = piano;
941 this.resize();
942 return this;
943 };
944
945 Renderer.prototype.resize = function (width, height) {
946 if (typeof width == "undefined") width = $(this.piano.rootElement).width();
947 if (typeof height == "undefined") height = Math.floor(width * 0.2);
948 $(this.piano.rootElement).css({
949 "height": height + "px",
950 marginTop: Math.floor($(window).height() / 2 - height / 2) + "px"
951 });
952 this.width = width;
953 this.height = height;
954 };
955
956 Renderer.prototype.visualize = function (key, color) {};
957
958
959
960
961 var DOMRenderer = function () {
962 Renderer.call(this);
963 };
964
965 DOMRenderer.prototype = new Renderer();
966
967 DOMRenderer.prototype.init = function (piano) {
968 // create keys in dom
969 for (var i in piano.keys) {
970 if (!piano.keys.hasOwnProperty(i)) continue;
971 var key = piano.keys[i];
972 var ele = document.createElement("div");
973 key.domElement = ele;
974 piano.rootElement.appendChild(ele);
975 // "key sharp cs cs2"
976 ele.note = key.note;
977 ele.id = key.note;
978 ele.className = "key " + (key.sharp ? "sharp " : " ") + key.baseNote + " " + key.note + " loading";
979 var table = $('<table width="100%" height="100%" style="pointer-events:none"></table>');
980 var td = $('<td valign="bottom"></td>');
981 table.append(td);
982 td.valign = "bottom";
983 $(ele).append(table);
984 }
985 // add event listeners
986 var mouse_down = false;
987 $(piano.rootElement).mousedown(function (event) {
988 // todo: IE10 doesn't support the pointer-events css rule on the "blips"
989 var ele = event.target;
990 if ($(ele).hasClass("key") && piano.keys.hasOwnProperty(ele.note)) {
991 var key = piano.keys[ele.note];
992 press(key.note);
993 mouse_down = true;
994 event.stopPropagation();
995 };
996 //event.preventDefault();
997 });
998 piano.rootElement.addEventListener("touchstart", function (event) {
999 for (var i in event.changedTouches) {
1000 var ele = event.changedTouches[i].target;
1001 if ($(ele).hasClass("key") && piano.keys.hasOwnProperty(ele.note)) {
1002 var key = piano.keys[ele.note];
1003 press(key.note);
1004 mouse_down = true;
1005 event.stopPropagation();
1006 }
1007 }
1008 //event.preventDefault();
1009 }, false);
1010 $(window).mouseup(function (event) {
1011 mouse_down = false;
1012 });
1013
1014 Renderer.prototype.init.call(this, piano);
1015 return this;
1016 };
1017
1018 DOMRenderer.prototype.resize = function (width, height) {
1019 Renderer.prototype.resize.call(this, width, height);
1020 };
1021
1022 DOMRenderer.prototype.visualize = function (key, color) { //mess with Logan
1023 var k = $(key.domElement);
1024 k.addClass("play");
1025 setTimeout(function () {
1026 k.removeClass("play");
1027 }, 100);
1028 // "blips"
1029 var d = $('<div style="width:100%;height:10%;margin:0;padding:0"> </div>');
1030 d.css("background", color);
1031 k.find("td").append(d);
1032 d.fadeOut(1000, function () {
1033 d.remove();
1034 });
1035 };
1036
1037
1038
1039
1040 var CanvasRenderer = function () {
1041 Renderer.call(this);
1042 };
1043
1044 CanvasRenderer.prototype = new Renderer();
1045
1046 CanvasRenderer.prototype.init = function (piano) {
1047 this.canvas = document.createElement("canvas");
1048 this.ctx = this.canvas.getContext("2d");
1049 piano.rootElement.appendChild(this.canvas);
1050
1051 Renderer.prototype.init.call(this, piano); // calls resize()
1052
1053 // create render loop
1054 var self = this;
1055 var render = function () {
1056 self.redraw();
1057 requestAnimationFrame(render);
1058 };
1059 requestAnimationFrame(render);
1060
1061 // add event listeners
1062 var mouse_down = false;
1063 var last_key = null;
1064 $(piano.rootElement).mousedown(function(event) {
1065 mouse_down = true;
1066 event.preventDefault();
1067
1068 var pos = CanvasRenderer.translateMouseEvent(event);
1069 var hit = self.getHit(pos.x, pos.y);
1070 if(hit) {
1071 press(hit.key.note, volume);
1072 last_key = hit.key;
1073 }
1074 });
1075 piano.rootElement.addEventListener("touchstart", function (event) { //mess with Logan
1076 mouse_down = true;
1077 event.preventDefault();
1078 for (var i in event.changedTouches) {
1079 var pos = CanvasRenderer.translateMouseEvent(event);
1080 var hit = self.getHit(pos.x, pos.y);
1081 if (hit) {
1082 last_key = hit.key;
1083 }
1084 }
1085 }, false);
1086 $(window).mouseup(function (event) {
1087 if (last_key) {
1088 release(last_key.note);
1089 }
1090 mouse_down = false;
1091 last_key = null;
1092 });
1093 $(piano.rootElement).mousemove(function(event) { //enables you to hold mouse and drag across notes.
1094 if(!mouse_down) return;
1095 var pos = CanvasRenderer.translateMouseEvent(event);
1096 var hit = self.getHit(pos.x, pos.y);
1097 if(hit && hit.key != last_key) {
1098 press(hit.key.note, volume);
1099 last_key = hit.key;
1100 release(last_key.note); //fix for sustain ignoring mouse being dragged across keys -Logan
1101 }
1102 });
1103
1104 return this;
1105 };
1106
1107 CanvasRenderer.prototype.resize = function (width, height) {
1108 Renderer.prototype.resize.call(this, width, height);
1109 if (this.width < 52 * 2) this.width = 52 * 2;
1110 if (this.height < this.width * 0.2) this.height = Math.floor(this.width * 0.2);
1111 this.canvas.width = this.width;
1112 this.canvas.height = this.height;
1113
1114 // calculate key sizes
1115 this.whiteKeyWidth = Math.floor(this.width / 52);
1116 this.whiteKeyHeight = Math.floor(this.height * 0.9);
1117 this.blackKeyWidth = Math.floor(this.whiteKeyWidth * 0.75);
1118 this.blackKeyHeight = Math.floor(this.height * 0.5);
1119
1120 this.blackKeyOffset = Math.floor(this.whiteKeyWidth - (this.blackKeyWidth / 2));
1121 this.keyMovement = Math.floor(this.whiteKeyHeight * 0.015);
1122
1123 this.whiteBlipWidth = Math.floor(this.whiteKeyWidth * 0.7);
1124 this.whiteBlipHeight = Math.floor(this.whiteBlipWidth * 0.8);
1125 this.whiteBlipX = Math.floor((this.whiteKeyWidth - this.whiteBlipWidth) / 2);
1126 this.whiteBlipY = Math.floor(this.whiteKeyHeight - this.whiteBlipHeight * 1.2);
1127 this.blackBlipWidth = Math.floor(this.blackKeyWidth * 0.7);
1128 this.blackBlipHeight = Math.floor(this.blackBlipWidth * 0.8);
1129 this.blackBlipY = Math.floor(this.blackKeyHeight - this.blackBlipHeight * 1.2);
1130 this.blackBlipX = Math.floor((this.blackKeyWidth - this.blackBlipWidth) / 2);
1131
1132 // prerender white key
1133 this.whiteKeyRender = document.createElement("canvas");
1134 this.whiteKeyRender.width = this.whiteKeyWidth;
1135 this.whiteKeyRender.height = this.height + 10;
1136 var ctx = this.whiteKeyRender.getContext("2d");
1137 if (ctx.createLinearGradient) {
1138 var gradient = ctx.createLinearGradient(0, 0, 0, this.whiteKeyHeight);
1139 gradient.addColorStop(0, "#eee");
1140 gradient.addColorStop(0.35, "#fff");
1141 gradient.addColorStop(1, "#dad4d4");
1142 ctx.fillStyle = gradient;
1143 } else {
1144 ctx.fillStyle = "#fff";
1145 }
1146 ctx.strokeStyle = "#000";
1147 ctx.lineJoin = "round";
1148 ctx.lineCap = "round";
1149 ctx.lineWidth = 10;
1150 ctx.strokeRect(ctx.lineWidth / 2, ctx.lineWidth / 2, this.whiteKeyWidth - ctx.lineWidth, this.whiteKeyHeight - ctx.lineWidth);
1151 ctx.lineWidth = 2.5; //4 - shadow between the white keys
1152 ctx.fillRect(ctx.lineWidth / 2, ctx.lineWidth / 2, this.whiteKeyWidth - ctx.lineWidth, this.whiteKeyHeight - ctx.lineWidth);
1153
1154 // prerender black key
1155 this.blackKeyRender = document.createElement("canvas");
1156 this.blackKeyRender.width = this.blackKeyWidth + 10;
1157 this.blackKeyRender.height = this.blackKeyHeight + 10;
1158 var ctx = this.blackKeyRender.getContext("2d");
1159 if (ctx.createLinearGradient) {
1160 var gradient = ctx.createLinearGradient(0, 0, 0, this.blackKeyHeight);
1161 gradient.addColorStop(0, "#000");
1162 gradient.addColorStop(1, "#444");
1163 ctx.fillStyle = gradient;
1164 } else {
1165 ctx.fillStyle = "#000";
1166 }
1167 ctx.strokeStyle = "#222";
1168 ctx.lineJoin = "round";
1169 ctx.lineCap = "round";
1170 ctx.lineWidth = 8;
1171 ctx.strokeRect(ctx.lineWidth / 2, ctx.lineWidth / 2, this.blackKeyWidth - ctx.lineWidth, this.blackKeyHeight - ctx.lineWidth);
1172 ctx.lineWidth = 4;
1173 ctx.fillRect(ctx.lineWidth / 2, ctx.lineWidth / 2, this.blackKeyWidth - ctx.lineWidth, this.blackKeyHeight - ctx.lineWidth);
1174
1175 // prerender shadows
1176 this.shadowRender = [];
1177 var y = -this.canvas.height * 2;
1178 for (var j = 0; j < 2; j++) {
1179 var canvas = document.createElement("canvas");
1180 this.shadowRender[j] = canvas;
1181 canvas.width = this.canvas.width;
1182 canvas.height = this.canvas.height;
1183 var ctx = canvas.getContext("2d");
1184 var sharp = j ? true : false;
1185 ctx.lineJoin = "round";
1186 ctx.lineCap = "round";
1187 ctx.lineWidth = 1;
1188 ctx.shadowColor = "rgba(0, 0, 0, 0.5)";
1189 ctx.shadowBlur = this.keyMovement * 3;
1190 ctx.shadowOffsetY = -y + this.keyMovement;
1191 if (sharp) {
1192 ctx.shadowOffsetX = this.keyMovement;
1193 } else {
1194 ctx.shadowOffsetX = 0;
1195 ctx.shadowOffsetY = -y + this.keyMovement;
1196 }
1197 for (var i in this.piano.keys) {
1198 if (!this.piano.keys.hasOwnProperty(i)) continue;
1199 var key = this.piano.keys[i];
1200 if (key.sharp != sharp) continue;
1201
1202 if (key.sharp) {
1203 ctx.fillRect(this.blackKeyOffset + this.whiteKeyWidth * key.spatial + ctx.lineWidth / 2,
1204 y + ctx.lineWidth / 2,
1205 this.blackKeyWidth - ctx.lineWidth, this.blackKeyHeight - ctx.lineWidth);
1206 } else {
1207 ctx.fillRect(this.whiteKeyWidth * key.spatial + ctx.lineWidth / 2,
1208 y + ctx.lineWidth / 2,
1209 this.whiteKeyWidth - ctx.lineWidth, this.whiteKeyHeight - ctx.lineWidth);
1210 }
1211 }
1212 }
1213
1214 // update key rects
1215 for (var i in this.piano.keys) {
1216 if (!this.piano.keys.hasOwnProperty(i)) continue;
1217 var key = this.piano.keys[i];
1218 if (key.sharp) {
1219 key.rect = new Rect(this.blackKeyOffset + this.whiteKeyWidth * key.spatial, 0,
1220 this.blackKeyWidth, this.blackKeyHeight);
1221 } else {
1222 key.rect = new Rect(this.whiteKeyWidth * key.spatial, 0,
1223 this.whiteKeyWidth, this.whiteKeyHeight);
1224 }
1225 }
1226 };
1227
1228 CanvasRenderer.prototype.visualize = function (key, color) {
1229 key.timePlayed = Date.now();
1230 key.blips.push({
1231 "time": key.timePlayed,
1232 "color": color
1233 });
1234 };
1235
1236 CanvasRenderer.prototype.redraw = function () {
1237 var now = Date.now();
1238 var timeLoadedEnd = now - 1000;
1239 var timePlayedEnd = now - 100;
1240 var timeBlipEnd = now - 1000;
1241
1242 this.ctx.save();
1243 this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
1244 // draw all keys
1245 for (var j = 0; j < 2; j++) {
1246 this.ctx.globalAlpha = 1.0; //unloaded keys colour
1247 this.ctx.drawImage(this.shadowRender[j], 0, 0);
1248 var sharp = j ? true : false;
1249 for (var i in this.piano.keys) {
1250 if (!this.piano.keys.hasOwnProperty(i)) continue;
1251 var key = this.piano.keys[i];
1252 if (key.sharp != sharp) continue;
1253
1254 if (!key.loaded) {
1255 this.ctx.globalAlpha = 0.2;
1256 } else if (key.timeLoaded > timeLoadedEnd) {
1257 this.ctx.globalAlpha = ((now - key.timeLoaded) / 1000) * 0.8 + 0.2;
1258 } else {
1259 this.ctx.globalAlpha = 1.0;
1260 }
1261 var y = 0;
1262 if (key.timePlayed > timePlayedEnd) {
1263 y = Math.floor(this.keyMovement - (((now - key.timePlayed) / 100) * this.keyMovement));
1264 }
1265 var x = Math.floor(key.sharp ? this.blackKeyOffset + this.whiteKeyWidth * key.spatial : this.whiteKeyWidth * key.spatial);
1266 var image = key.sharp ? this.blackKeyRender : this.whiteKeyRender;
1267 this.ctx.drawImage(image, x, y);
1268
1269 // render blips
1270 if (key.blips.length) {
1271 var alpha = this.ctx.globalAlpha;
1272 var w, h;
1273 if (key.sharp) {
1274 x += this.blackBlipX;
1275 y = this.blackBlipY;
1276 w = this.blackBlipWidth;
1277 h = this.blackBlipHeight;
1278 } else {
1279 x += this.whiteBlipX;
1280 y = this.whiteBlipY;
1281 w = this.whiteBlipWidth;
1282 h = this.whiteBlipHeight;
1283 }
1284 for (var b = 0; b < key.blips.length; b++) {
1285 var blip = key.blips[b];
1286 if (blip.time > timeBlipEnd) {
1287 this.ctx.fillStyle = blip.color;
1288 this.ctx.globalAlpha = alpha - ((now - blip.time) / 1000);
1289 this.ctx.fillRect(x, y, w, h);
1290 } else {
1291 key.blips.splice(b, 1);
1292 --b;
1293 }
1294 y -= Math.floor(h * 1.1); //blips space apart
1295 }
1296 }
1297 }
1298 }
1299 this.ctx.restore();
1300 };
1301
1302 CanvasRenderer.prototype.getHit = function (x, y) {
1303 for (var j = 0; j < 2; j++) {
1304 var sharp = j ? false : true; // black keys first
1305 for (var i in this.piano.keys) {
1306 if (!this.piano.keys.hasOwnProperty(i)) continue;
1307 var key = this.piano.keys[i];
1308 if (key.sharp != sharp) continue;
1309 if (key.rect.contains(x, y)) {
1310 var v = y / (key.sharp ? this.blackKeyHeight : this.whiteKeyHeight);
1311 v += 0.25;
1312 v *= DEFAULT_VELOCITY;
1313 if (v > 1.0) v = 1.0;
1314 return {
1315 "key": key,
1316 "v": v
1317 };
1318 }
1319 }
1320 }
1321 return null;
1322 };
1323
1324
1325 CanvasRenderer.isSupported = function () {
1326 var canvas = document.createElement("canvas");
1327 return !!(canvas.getContext && canvas.getContext("2d"));
1328 };
1329
1330 CanvasRenderer.translateMouseEvent = function (evt) {
1331 var element = evt.target;
1332 var offx = 0;
1333 var offy = 0;
1334 do {
1335 offx += element.offsetLeft;
1336 offy += element.offsetTop;
1337 } while (element = element.offsetParent);
1338 return {
1339 x: evt.pageX - offx,
1340 y: evt.pageY - offy
1341 }
1342 };
1343
1344
1345
1346
1347 // Pianoctor
1348
1349 ////////////////////////////////////////////////////////////////
1350
1351 var PianoKey = function(note, octave, num) {
1352 this.note = note + octave;
1353 this.baseNote = note;
1354 this.octave = octave;
1355 this.sharp = note.indexOf("s") != -1;
1356 this.loaded = false;
1357 this.timeLoaded = 0;
1358 this.domElement = null;
1359 this.timePlayed = 0;
1360 this.blips = [];
1361 this.num = num; //Ltranspose
1362 };
1363
1364 var Piano = function (rootElement) {
1365
1366 var piano = this;
1367 piano.rootElement = rootElement;
1368 piano.keys = {};
1369
1370 var white_spatial = 0;
1371 var black_spatial = 0;
1372 var black_it = 0;
1373 var black_lut = [2, 1, 2, 1, 1];
1374 var addKey = function(note, octave, num) {
1375 var key = new PianoKey(note, octave, num);
1376 piano.keys[key.note] = key;
1377 if (key.sharp) {
1378 key.spatial = black_spatial;
1379 black_spatial += black_lut[black_it % 5];
1380 ++black_it;
1381 } else {
1382 key.spatial = white_spatial;
1383 ++white_spatial;
1384 }
1385 }
1386 if (test_mode) { //Logan check!
1387 addKey("c", 2);
1388
1389 } else {
1390 addKey("a", -1, 1);
1391 addKey("as", -1, 2);
1392 addKey("b", -1, 3);
1393 var notes = "c cs d ds e f fs g gs a as b".split(" ");
1394 var count = 4;
1395
1396 for(var oct = 0; oct < 7; oct++) {
1397 for(var i in notes) {
1398 addKey(notes[i], oct, count);
1399 count++;
1400 }
1401 }
1402 addKey("c", 7); //default key
1403 addKey("cs", 7); //extra key
1404 addKey("d", 7); //extra key
1405 addKey("ds", 7); //extra key
1406 addKey("e", 7); //extra key
1407
1408 }
1409
1410
1411 var render_engine = CanvasRenderer.isSupported() ? CanvasRenderer : DOMRenderer;
1412 this.renderer = new render_engine().init(this);
1413
1414 $(window).resize(function () {
1415 piano.renderer.resize();
1416 });
1417
1418
1419 window.AudioContext = window.AudioContext || window.webkitAudioContext || undefined;
1420 var audio_engine = (window.AudioContext === undefined) ? AudioEngineSM2 : AudioEngineWeb;
1421
1422 // Firefox 25 supports WebAudio, but a decodeAudioData issue is blocking until 26
1423 // https://bugzilla.mozilla.org/show_bug.cgi?id=865553
1424 var search_str = " Firefox/";
1425 var idx = navigator.userAgent.indexOf(search_str);
1426 if (idx !== -1) {
1427 var version = parseFloat(navigator.userAgent.substring(idx + search_str.length));
1428 if (isNaN(version) || version < 26.0) {
1429 audio_engine = AudioEngineSM2;
1430 }
1431 }
1432
1433 this.audio = new audio_engine().init(function () {
1434 for (var i in piano.keys) {
1435 if (!piano.keys.hasOwnProperty(i)) continue;
1436 (function () {
1437 var key = piano.keys[i];
1438 if (useDefaultSounds) {
1439 piano.audio.load(key.note, "/mp3/" + key.note + ".wav.mp3", function () {
1440 key.loaded = true;
1441 key.timeLoaded = Date.now();
1442 if (key.domElement) // todo: move this to renderer somehow
1443 $(key.domElement).removeClass("loading");
1444 });
1445 } else {
1446 //Lsounds
1447 piano.audio.load(key.note, "https://dl.dropboxusercontent.com/u/24213061/HDPiano/" + key.note + ".wav", function () {
1448 key.loaded = true;
1449 key.timeLoaded = Date.now();
1450 if (key.domElement)
1451 $(key.domElement).removeClass("loading");
1452 });
1453 }
1454 })();
1455 }
1456 });
1457 };
1458
1459 Piano.prototype.play = function(note, vol, participant, delay_ms) {
1460 if(!this.keys.hasOwnProperty(note)) return;
1461 var key = this.keys[note];
1462 if(key.loaded) this.audio.play(key.note, vol, delay_ms, participant.id);
1463 if(typeof gMidiOutTest === "function") gMidiOutTest(key.note, vol * 100, delay_ms);
1464 var self = this;
1465 var jq_namediv = $(typeof participant == "undefined" ? null : participant.nameDiv);
1466 if(jq_namediv) {
1467 setTimeout(function() {
1468 self.renderer.visualize(key, typeof participant == "undefined" ? "yellow" : (participant.color || "#777"));
1469 jq_namediv.addClass("play");
1470 setTimeout(function() {
1471 jq_namediv.removeClass("play");
1472 }, 30);
1473 }, delay_ms);
1474 }
1475 };
1476
1477 Piano.prototype.stop = function(note, participant, delay_ms) {
1478 if(!this.keys.hasOwnProperty(note)) return;
1479 var key = this.keys[note];
1480 if(key.loaded) this.audio.stop(key.note, delay_ms, participant.id);
1481 if(typeof gMidiOutTest === "function") gMidiOutTest(key.note, 0, delay_ms);
1482 };
1483
1484 var gPiano = new Piano(document.getElementById("piano"));
1485
1486 var gAutoSustain = true;
1487 var gSustain = false;
1488
1489 var gHeldNotes = {};
1490 var gSustainedNotes = {};
1491
1492 // roll
1493 function roll(id, vol, i) {
1494 if (octTemp == 1) { //check Logan
1495 gPiano.play(id, vol !== undefined ? vol : DEFAULT_VELOCITY, gClient.getOwnParticipant(), 0);
1496 gClient.startNote(id, vol);
1497 return;
1498 }
1499 setTimeout(function() {
1500 gPiano.play(id, vol !== undefined ? vol : DEFAULT_VELOCITY, gClient.getOwnParticipant(), 0);
1501 gClient.startNote(id, vol);
1502 }, delays + (delays * i));
1503 }
1504 // pressing
1505 function pressing(id, vol) {
1506 if (ouch) {
1507 for (i=0; i <= ouchN; i++) {
1508 setTimeout( function() { gPiano.play(id, vol !== undefined ? vol : DEFAULT_VELOCITY, gClient.getOwnParticipant(), 0);}, ouchD * i);
1509 if (!politePlay) {
1510 setTimeout( function() { gClient.startNote(id, vol);}, ouchD * i)
1511 }
1512 }
1513
1514 } else {
1515 gPiano.play(id, vol !== undefined ? vol : DEFAULT_VELOCITY, gClient.getOwnParticipant(), 0);
1516 if (!politePlay) {
1517 gClient.startNote(id, vol);
1518 }
1519 }
1520 }
1521
1522 // press
1523 function press(id, vol) {
1524 //thanks electrashave!
1525 var pKey = gPiano.keys[id];
1526 for (as in MPP.piano.keys) {
1527 var key = MPP.piano.keys[as];
1528 if (key.num == (pKey.num + transLvl)) {
1529 id = key.note
1530 }
1531 }
1532
1533 if (mouseNote) {
1534 // thanks Chacha!
1535 try {
1536 var rect = gPiano.keys[id].rect;
1537 var t = 900; // 900
1538 var x = (rect.x + rect.x2) / 2; // Position within piano
1539 x /= gPiano.renderer.width; // Position within renderer
1540 x *= 95; // 100% minus left offset (3%) minus right offset (2%)
1541 x += 3; // Left offset of 3%, gives position within window
1542 var y = rect.h; // === rect.y2 - rect.y
1543 y -= gPiano.renderer.height * 0.75; // Center around midpoint between black and white keys.
1544 y /= 10; // Scale to fit the keys. (This is arbitrary since the height of the keys will vary between users anyway.)
1545 y += 50; // Center on middle of screen
1546 x += (Math.random()+Math.random()-1)*0.5; // Alters x slightly each press
1547 y += (Math.random()+Math.random()+Math.random()+Math.random()-2)*2.5; // Alters y slightly each press
1548 setTimeout(()=>gClient.sendArray([{ m: "m", x: x, y: y }]), t); // Wait for t before
1549 } catch (e) {console.log("mouseNote err: " + e)} // If there's an error log it
1550 }
1551
1552 var me = gClient.getOwnParticipant();
1553
1554 if (randNoteColour && !ignoreNotes && !politePlay) {
1555 me = gClient.getOwnParticipant();
1556 me.color = Col();
1557
1558 } else if (ignoreNotes && politePlay) {
1559 randNoteColour = true;
1560 me = gClient.getOwnParticipant();
1561 me.color = "purple";
1562
1563 } else if (ignoreNotes) {
1564 randNoteColour = true;
1565 me = gClient.getOwnParticipant();
1566 me.color = "red";
1567
1568 } else if (politePlay) {
1569 randNoteColour = true;
1570 me = gClient.getOwnParticipant();
1571 me.color = "blue";
1572 }
1573
1574
1575 if (delPlay) {
1576 setTimeout(function() {
1577 gPiano.play(id, vol !== undefined ? vol : DEFAULT_VELOCITY, gClient.getOwnParticipant(), 0);
1578 gClient.startNote(id, vol);
1579 }, delTime);
1580 }
1581
1582 var note = id.replace(/[0-9]/g, '').replace("-", "");
1583 var octave = parseInt(id.replace(/[^\d.]/, '').replace('s', ''));
1584 if (octTemp >= 3) {
1585 if (octTemp > 4) {
1586 octave = octave - 2;
1587 } else {
1588 octave = octave - 1;
1589 }
1590 }
1591 for (i = 0; i < octTemp; i++) {
1592 if (rollTemp) {
1593 roll(note + (octave + i), vol, i);
1594 } else {
1595 pressing(note + (octave + i), vol);
1596 }
1597 }
1598 gHeldNotes[id] = true;
1599 gSustainedNotes[id] = true;
1600
1601 }
1602 // release roll
1603 function releaseRoll(id, i) {
1604 setTimeout(function() {
1605 gPiano.stop(id, gClient.getOwnParticipant(), 0);
1606 gClient.stopNote(id);
1607 gSustainedNotes[id] = false;
1608 }, delays + (delays * i));
1609 }
1610
1611 // releasing
1612 function releasing(id) {
1613 gPiano.stop(id, gClient.getOwnParticipant(), 0);
1614 gClient.stopNote(id);
1615 gSustainedNotes[id] = false;
1616 }
1617
1618 // release
1619 function release(id) {
1620 if (gHeldNotes[id]) {
1621 gHeldNotes[id] = false;
1622 if (gAutoSustain || gSustain) {
1623 gSustainedNotes[id] = true;
1624 } else {
1625 if (gNoteQuota.spend(1)) {
1626 var octave = parseInt(id.replace(/[^\d.]/, '').replace('s', ''));
1627 var note = id.replace(/[0-9]/g, '').replace("-", "");
1628 if (octTemp >= 3) {
1629 if (octTemp > 4) {
1630 octave = octave - 2;
1631 } else {
1632 octave = octave - 1;
1633 }
1634 }
1635 for (i = 0; i < octTemp; i++) {
1636 if (rollTemp) {
1637 releaseRoll(note + (octave + i), i);
1638 } else {
1639 releasing(note + (octave + i));
1640 }
1641 }
1642 }
1643 }
1644 }
1645 }
1646
1647 function pressSustain() {
1648 gSustain = true;
1649 }
1650
1651 function releaseSustain() {
1652 gSustain = false;
1653 if (!gAutoSustain) {
1654 for (var id in gSustainedNotes) {
1655 if (gSustainedNotes.hasOwnProperty(id) && gSustainedNotes[id] && !gHeldNotes[id]) {
1656 if (gNoteQuota.spend(0)) {
1657 gPiano.stop(id, gClient.getOwnParticipant(), 0);
1658 gClient.stopNote(id);
1659 }
1660 }
1661 }
1662 }
1663 }
1664
1665
1666
1667
1668 // internet science
1669
1670 ////////////////////////////////////////////////////////////////
1671
1672 var channel_id = decodeURIComponent(window.location.pathname);
1673 if(channel_id.substr(0, 1) == "/") channel_id = channel_id.substr(1);
1674 if(channel_id == "") channel_id = "lolwutsecretlobbybackdoor"; //lobby
1675
1676 //FIX FOR HANDSHAKE ERROR
1677 var gClient = new Client("ws://" + window.location.hostname + ":443"); //FIX FOR HANDSHAKE ERROR
1678 //FIX FOR HANDSHAKE ERROR
1679
1680 //worker
1681 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}]); } }
1682 gClient.setChannel(channel_id);
1683 gClient.start();
1684
1685 // Setting status
1686 (function () {
1687 gClient.on("count", function (status) {
1688 $("#status").text(status);
1689 });
1690 gClient.on("count", function (count) {
1691 if (count > 0) {
1692 $("#status").html('<span class="number">' + count + '</span> ' + (count == 1 ? 'player' : 'players'));
1693 document.title = "Ryan's Bot [v" + botVersion + "] (" + count + ")";
1694 } else {
1695 document.title = "Logan's Bot [v" + botVersion + "]";
1696 }
1697 });
1698 })();
1699
1700 // Handle changes to participants
1701 (function () {
1702 gClient.on("participant added", function (part) {
1703
1704 part.displayX = 0.75; //150
1705 part.displayY = 25; //50
1706
1707 // add nameDiv
1708 var div = document.createElement("div");
1709 div.className = "name";
1710 div.participantId = part.id;
1711 div.textContent = part.name || selfName; // ""
1712 div.style.backgroundColor = part.color || "#777";
1713 if (gClient.participantId === part.id) {
1714 $(div).addClass("me");
1715 }
1716 if (gClient.channel && gClient.channel.crown && gClient.channel.crown.participantId === part.id) {
1717 $(div).addClass("owner");
1718 }
1719 if (gPianoMutes.indexOf(part._id) !== -1) {
1720 $(part.nameDiv).addClass("muted-notes");
1721 }
1722 if (gChatMutes.indexOf(part._id) !== -1) {
1723 $(part.nameDiv).addClass("muted-chat");
1724 }
1725 div.style.display = "none";
1726 part.nameDiv = $("#names")[0].appendChild(div);
1727 $(part.nameDiv).fadeIn(500); //2000
1728
1729 // sort names
1730 var arr = $("#names .name");
1731 arr.sort(function (a, b) {
1732 a = a.style.backgroundColor; // todo: sort based on user id instead
1733 b = b.style.backgroundColor;
1734 if (a > b) return 1;
1735 else if (a < b) return -1;
1736 else return 0;
1737 });
1738 $("#names").html(arr);
1739
1740 // add cursorDiv //gSeeOwnCursor
1741 if (gClient.participantId !== part.id || showOwnMouse) {
1742 var div = document.createElement("div");
1743 div.className = "cursor";
1744 div.style.display = "none";
1745 part.cursorDiv = $("#cursors")[0].appendChild(div);
1746 $(part.cursorDiv).fadeIn(500); //2000
1747
1748 //sets mouse position on join (thanks Josh)
1749 part.cursorDiv.style.left = 46.73 + "%";
1750 part.cursorDiv.style.top = 19.60 + "%";
1751
1752 var div = document.createElement("div");
1753 div.className = "name";
1754 div.style.backgroundColor = part.color || "#777"
1755 div.textContent = part.name || selfName; // ""
1756 part.cursorDiv.appendChild(div);
1757
1758 } else {
1759 part.cursorDiv = undefined;
1760 }
1761 });
1762 gClient.on("participant removed", function (part) { //when the participant leaves
1763 // remove nameDiv
1764 var nd = $(part.nameDiv);
1765 var cd = $(part.cursorDiv);
1766 cd.fadeOut(500); //2000
1767 nd.fadeOut(450, function () { //2000
1768 nd.remove();
1769 cd.remove();
1770 part.nameDiv = undefined;
1771 part.cursorDiv = undefined;
1772 });
1773 });
1774 gClient.on("participant update", function (part) {
1775 var name = part.name || "";
1776 var color = part.color || "#777";
1777 part.nameDiv.style.backgroundColor = color;
1778 part.nameDiv.textContent = name;
1779 $(part.cursorDiv)
1780 .find(".name")
1781 .text(name)
1782 .css("background-color", color);
1783 });
1784 gClient.on("ch", function (msg) {
1785 for (var id in gClient.ppl) {
1786 if (gClient.ppl.hasOwnProperty(id)) {
1787 var part = gClient.ppl[id];
1788 if (part.id === gClient.participantId) {
1789 $(part.nameDiv).addClass("me");
1790 } else {
1791 $(part.nameDiv).removeClass("me");
1792 }
1793 if (msg.ch.crown && msg.ch.crown.participantId === part.id) {
1794 $(part.nameDiv).addClass("owner");
1795 $(part.cursorDiv).addClass("owner");
1796 } else {
1797 $(part.nameDiv).removeClass("owner");
1798 $(part.cursorDiv).removeClass("owner");
1799 }
1800 if (gPianoMutes.indexOf(part._id) !== -1) {
1801 $(part.nameDiv).addClass("muted-notes");
1802 } else {
1803 $(part.nameDiv).removeClass("muted-notes");
1804 }
1805 if (gChatMutes.indexOf(part._id) !== -1) {
1806 $(part.nameDiv).addClass("muted-chat");
1807 } else {
1808 $(part.nameDiv).removeClass("muted-chat");
1809 }
1810 }
1811 }
1812 });
1813 })();
1814
1815
1816 // Handle changes to crown
1817 (function () {
1818 var jqcrown = $('<div id="crown"></div>').appendTo(document.body).hide();
1819 var jqcountdown = $('<span></span>').appendTo(jqcrown);
1820 var countdown_interval;
1821 jqcrown.click(function () {
1822 gClient.sendArray([{
1823 m: "chown",
1824 id: gClient.participantId
1825 }]);
1826 });
1827 gClient.on("ch", function (msg) {
1828 if (msg.ch.crown) {
1829 var crown = msg.ch.crown;
1830 if (!crown.participantId || !gClient.ppl[crown.participantId]) {
1831 var land_time = crown.time + 2000 - gClient.serverTimeOffset;
1832 var avail_time = crown.time + 15000 - gClient.serverTimeOffset;
1833 jqcountdown.text("");
1834 jqcrown.show();
1835 if (land_time - Date.now() <= 0) {
1836 jqcrown.css({
1837 "left": crown.endPos.x + "%",
1838 "top": crown.endPos.y + "%"
1839 });
1840 } else {
1841 jqcrown.css({
1842 "left": crown.startPos.x + "%",
1843 "top": crown.startPos.y + "%"
1844 });
1845 jqcrown.addClass("spin");
1846 jqcrown.animate({
1847 "left": crown.endPos.x + "%",
1848 "top": crown.endPos.y + "%"
1849 }, 2000, "linear", function () {
1850 jqcrown.removeClass("spin");
1851 });
1852 }
1853 clearInterval(countdown_interval);
1854 countdown_interval = setInterval(function () {
1855 var time = Date.now();
1856 if (time >= land_time) {
1857 var ms = avail_time - time;
1858 if (ms > 0) {
1859 jqcountdown.text(Math.ceil(ms / 1000) + "s");
1860 } else {
1861 jqcountdown.text("");
1862 clearInterval(countdown_interval);
1863 }
1864 }
1865 }, 1000);
1866 } else {
1867 jqcrown.hide();
1868 }
1869 } else {
1870 jqcrown.hide();
1871 }
1872 });
1873 gClient.on("disconnect", function () {
1874 jqcrown.fadeOut(2000);
1875 });
1876 })();
1877
1878
1879// Josh's playThing
1880 function playThing(notes, veloc, delay, times) {
1881 setTimeout(function() {
1882 gClient.sendArray([{
1883 m: "n",
1884 t: times,
1885 n: [{
1886 n: notes,
1887 v: veloc
1888 }]
1889 }]);
1890 }, delay);
1891 //console.log(notes);
1892 }
1893
1894
1895// Playing notes
1896 gClient.on("n", function(msg) {
1897 var t = msg.t - gClient.serverTimeOffset + TIMING_TARGET - Date.now();
1898 var participant = gClient.findParticipantById(msg.p);
1899 if (gPianoMutes.indexOf(participant._id) !== -1)
1900 return;
1901 for (var i = 0; i < msg.n.length; i++) {
1902 var note = msg.n[i];
1903 var octave = parseInt(note.n.replace( /[^\d.]/, '').replace('s', ''));
1904 if (octave > 7) {
1905 return;
1906 }
1907 var ms = t + (note.d || 0);
1908 if (ms < 0) {
1909 ms = 0;
1910 } else if (ms > 10000) continue;
1911 if (ignoreNotes) {
1912 if (participant.id == gClient.participantId) {
1913 if (note.s) {
1914 gPiano.stop(note.n, participant, ms);
1915 } else {
1916 var vel = (typeof note.v !== "undefined") ? parseFloat(note.v) : DEFAULT_VELOCITY;
1917 if (vel < 0) vel = 0;
1918 else if (vel > 1) vel = 1;
1919 gPiano.play(note.n, vel, participant, ms);
1920 }
1921 }
1922 } else {
1923 if (note.s) {
1924 gPiano.stop(note.n, participant, ms);
1925 } else {
1926 var vel = (typeof note.v !== "undefined") ? parseFloat(note.v) : DEFAULT_VELOCITY;
1927 if (vel < 0) vel = 0;
1928 else if (vel > 1) vel = 1;
1929 gPiano.play(note.n, vel, participant, ms);
1930 if (copyNotes){
1931 playThing(note.n,vel,note.d||0, t);
1932 }
1933 }
1934 }
1935 }
1936 });
1937
1938 // Send cursor updates
1939 // mouse optimizations by Alex
1940 var mx = 0, last_mx = -2.5, my = 0, last_my = -2.5;
1941 setInterval(function() {
1942 if (Math.abs(mx - last_mx) > 0.1 || Math.abs(my - last_my) > 0.1) {
1943 last_mx = mx;
1944 last_my = my;
1945 if (!incognito){
1946 gClient.sendArray([{m: "m", x: mx, y: my}]);
1947 }
1948 }
1949 }, 50);
1950
1951 $(document).mousemove(function(event) {
1952 mx = ((event.pageX / $(window).width()) * 100).toFixed(2);
1953 my = ((event.pageY / $(window).height()) * 100).toFixed(2);
1954 });
1955
1956 // Animate cursors
1957 setInterval(function() {
1958 for (var id in gClient.ppl) {
1959 if (!gClient.ppl.hasOwnProperty(id)) continue;
1960 var part = gClient.ppl[id];
1961 if (part.cursorDiv && (Math.abs(part.x - part.displayX) > 0.1 || Math.abs(part.y - part.displayY) > 0.1)) {
1962 part.displayX += (part.x - part.displayX) * 0.25;
1963 part.displayY += (part.y - part.displayY) * 0.25;
1964 part.cursorDiv.style.left = part.displayX + "%";
1965 part.cursorDiv.style.top = part.displayY + "%";
1966 if (autoFollow && part._id != selfId) {
1967 followId = part._id;
1968 }
1969 }
1970 }
1971 }, 1);
1972
1973 // Room settings button
1974 (function () {
1975 gClient.on("ch", function (msg) {
1976 if (gClient.isOwner()) {
1977 $("#room-settings-btn").show();
1978 $("#room-settings-btn").animate({opacity:0.7},100); //animates it thanks B@K$
1979 } else {
1980 $("#room-settings-btn").css("display","block"); //shows it
1981 $("#room-settings-btn").animate({opacity:0.3},100);
1982 }
1983 });
1984 $("#room-settings-btn").click(function (evt) { //room settings button
1985 if (gClient.channel && gClient.isOwner()) {
1986 var settings = gClient.channel.settings;
1987 openModal("#room-settings");
1988 setTimeout(function () {
1989 $("#room-settings .checkbox[name=visible]").prop("checked", settings.visible);
1990 $("#room-settings .checkbox[name=chat]").prop("checked", settings.chat);
1991 $("#room-settings .checkbox[name=crownsolo]").prop("checked", settings.crownsolo);
1992 }, 100);
1993 }
1994 });
1995 $("#room-settings .submit").click(function () {
1996 var settings = {
1997 visible: $("#room-settings .checkbox[name=visible]").is(":checked"),
1998 chat: $("#room-settings .checkbox[name=chat]").is(":checked"),
1999 crownsolo: $("#room-settings .checkbox[name=crownsolo]").is(":checked")
2000 };
2001 gClient.sendArray([{
2002 m: "chset",
2003 set: settings
2004 }]);
2005 closeModal();
2006 });
2007 $("#room-settings .drop-crown").click(function () {
2008 gClient.sendArray([{
2009 m: "chown"
2010 }]);
2011 closeModal();
2012 });
2013 })();
2014
2015 // Handle notifications
2016 gClient.on("notification", function (msg) {
2017 new Notification(msg);
2018 });
2019
2020 //cursor float
2021 /*gClient.on("ch", function (msg) {
2022 var chidlo = msg.ch._id.toLowerCase();
2023 if (chidlo === "a" || chidlo.substr() === "a") {
2024 $(".cursor").addClass("floating");
2025 } else {
2026
2027 $(".cursor").addClass("floating");
2028
2029 }
2030 });*/
2031
2032 // Don't forget spin
2033 /*gClient.on("ch", function (msg) {
2034 var chidlo = msg.ch._id.toLowerCase();
2035 if (chidlo === "spin" || chidlo.substr(-5) === "/spin") {
2036 $("#piano").addClass("spin");
2037 } else {
2038 $("#piano").removeClass("spin");
2039 }
2040 });*/
2041
2042 // Crownsolo notice
2043 gClient.on("ch", function (msg) {
2044 if (msg.ch.settings.crownsolo) {
2045 if ($("#crownsolo-notice").length == 0) {
2046 $('<div id="crownsolo-notice">').text('Only owner can play mode').appendTo("body").fadeIn(500);
2047 }
2048 } else {
2049 $("#crownsolo-notice").remove();
2050 }
2051 });
2052 gClient.on("disconnect", function () {
2053 $("#crownsolo-notice").remove();
2054 $("#nochat-notice").remove();
2055 });
2056
2057
2058
2059 var gPianoMutes = ["3ed152147e36d229cf5b7cba", "9b8df25492874a938ce9fb74"];
2060
2061 var gChatMutes = [];
2062
2063 //animated name stuff
2064 if (animName) {
2065 setInterval(function() {
2066 if (heyThereKitty == MPP.client.getOwnParticipant().name) return;
2067 updateName(heyThereKitty); //name to print
2068 if (followId == heyThereKittyId) return;
2069 followId = heyThereKittyId;
2070 }, 2100);
2071 }
2072
2073 // thanks Kappa
2074 /*
2075 var i = 0;
2076 setInterval(function() {
2077 MPP.client.sendArray([{
2078 m: "userset"
2079 , set: {
2080 name: selfName.slice(i % selfName.length) + selfName.slice(0, i++ % selfName.length)
2081 }
2082 }]);
2083 }, 2100)
2084 */
2085
2086 var volume_slider = new VolumeSlider(document.getElementById("volume"), function (v) {
2087 gPiano.audio.setVolume(v);
2088 if (window.localStorage) localStorage.volume = v;
2089 });
2090 volume_slider.set(gPiano.audio.volume);
2091
2092 var Note = function (note, octave) {
2093 this.note = note;
2094 this.octave = octave || 0;
2095 };
2096
2097
2098
2099 var n = function (a, b) {
2100 return {
2101 note: new Note(a, b),
2102 held: false
2103 };
2104 };
2105 //Logan, these are the key bindings for on the piano
2106 var key_binding = {
2107 65: n("gs"),
2108 90: n("a"),
2109 83: n("as"),
2110 88: n("b"),
2111 67: n("c", 1),
2112 70: n("cs", 1),
2113 86: n("d", 1),
2114 71: n("ds", 1),
2115 66: n("e", 1),
2116 78: n("f", 1),
2117 74: n("fs", 1),
2118 77: n("g", 1),
2119 75: n("gs", 1),
2120 188: n("a", 1),
2121 76: n("as", 1),
2122 190: n("b", 1),
2123 191: n("c", 2),
2124 222: n("cs", 2),
2125
2126 49: n("gs", 1),
2127 81: n("a", 1),
2128 50: n("as", 1),
2129 87: n("b", 1),
2130 69: n("c", 2),
2131 52: n("cs", 2),
2132 82: n("d", 2),
2133 53: n("ds", 2),
2134 84: n("e", 2),
2135 89: n("f", 2),
2136 55: n("fs", 2),
2137 85: n("g", 2),
2138 56: n("gs", 2),
2139 73: n("a", 2),
2140 57: n("as", 2),
2141 79: n("b", 2),
2142 80: n("c", 3),
2143 189: n("cs", 3),
2144 219: n("d", 3),
2145 187: n("ds", 3),
2146 221: n("e", 3)
2147 };
2148
2149 var capsLockKey = false; //here are some settings, Logan
2150 var gSustain = false;
2151 var keys = [];
2152 var volTemp = 1;
2153
2154 function handleKeyDown(evt) {
2155 var key = evt.keyCode;
2156 keys[key] = true;
2157
2158 // volume changing
2159 if (keys[107]) {
2160 volume > 0.9 ? volume = 1 : volume += 0.1;
2161 msgBox('Note Volume', 'Volume: ' + parseFloat(volume.toFixed(2)), 1000, '#piano');
2162
2163 } else if (keys[109]) {
2164 volume < 0.1 ? volume = 0 : volume -= 0.1;
2165 msgBox('Note Volume', 'Volume: ' + parseFloat(volume.toFixed(2)), 1000, '#piano');
2166 }
2167 // multi-octave toggling
2168 if (keys[38]) {
2169 octTemp > 6 ? octTemp = 7 : ++octTemp;
2170 msgBox('Multi-octave', 'Level ' + octTemp, 1000, '#piano');
2171
2172 } else if (keys[40]) {
2173 octTemp < 2 ? octTemp = 1 : --octTemp;
2174 msgBox('Multi-octave', 'Level ' + octTemp, 1000, '#piano');
2175 }
2176
2177 // roll toggling
2178 if (keys[35] && rollTemp) {
2179 rollTemp = false;
2180 msgBox('Roll', 'Disabled', 1000, '#piano');
2181
2182 } else if (keys[35] && !rollTemp) {
2183 rollTemp = true;
2184 msgBox('Roll', 'Enabled', 1000, '#piano');
2185 }
2186
2187 // sustain toggling
2188 //Insert key
2189 if (keys[45] && !susTemp) {
2190 msgBox('Sustain', 'Enabled', 1000, '#piano');
2191 susTemp = true;
2192
2193 } else if (keys[45] && susTemp) {
2194 msgBox('Sustain', 'Disabled', 1000, '#piano');
2195 susTemp = false;
2196 }
2197 if (!susTemp) {
2198 gAutoSustain = false;
2199 } else if (susTemp) {
2200 gAutoSustain = true;
2201 }
2202
2203 var code = parseInt(evt.keyCode); //move up and make use of more Logan
2204
2205 //numpad5
2206 if (code == 101 || code == 12) { //delay
2207 delPlay = !delPlay; //swaps it
2208 if (!delPlay) {
2209 msgBox('Delay', 'Disabled', 1000, '#piano');
2210 } else {
2211 msgBox('Delay', 'Enabled', 1000, '#piano');
2212 }
2213 //Pagedown
2214 } else if (code == 34) { //ignore
2215 ignoreNotes = !ignoreNotes;
2216 if (!ignoreNotes) {
2217 msgBox('Ignore Notes', 'Disabled', 1000, '#piano');
2218 } else {
2219 msgBox('Ignore Notes', 'Enabled', 1000, '#piano');
2220 }
2221 //Pageup
2222 } else if (code == 33) { //bot on/off [clean this logan]
2223 if (bot == 2) {
2224 bot = 0;
2225 msgBox('Commands', 'Disabled', 1000, '#piano');
2226 } else if (bot == 0) {
2227 bot = 1;
2228 msgBox('Commands', 'For everyone', 1000, '#piano');
2229 } else if (bot == 1) {
2230 bot = 2;
2231 msgBox('Commands', 'Only for you', 1000, '#piano');
2232 }
2233
2234 //numpad *
2235 } else if (code == 106) { //bot on/off //♥ REMOVE AND JUST MAKE NUMPAD - GO TO 0 ♥//
2236 if (timeStamp) {
2237 timeStamp = false;
2238 msgBox('Timestamps', 'Off', 1000, '#piano');
2239 } else {
2240 timeStamp = true;
2241 msgBox('Timestamps', 'On', 1000, '#piano');
2242 }
2243
2244 //numpad 0
2245 } else if (code == 96) { //reconnect
2246 MPP.client.stop();
2247 MPP.client.start();
2248 msgBox('Reconnecting...', '', 2000, '#piano');
2249
2250 //numpad 1
2251 } else if (code == 97) { //private room
2252 var room_name = randStr(28);
2253 changeRoom(room_name, "right", {
2254 "visible": false,
2255 "chat": true,
2256 "crownsolo": false,
2257 "lobby": false
2258 });
2259 //numpad 2
2260 } else if (code == 98) { //illuminati hotkey (until I find a better use)
2261 if (autoFollow) {
2262 autoFollow = false;
2263 following = false;
2264 followId = null;
2265 msgBox('Auto Follow', 'Off', 2000, '#blah-btn');
2266 } else {
2267 autoFollow = true;
2268 following = true;
2269 msgBox('Auto Follow', 'On', 2000, '#blah-btn');
2270 }
2271 //tab
2272 } else if (code == 9) { //hotkeymsg
2273 tab(); //ring ring..
2274
2275 //ctrl
2276 } else if (code == 17) { //drop crown
2277 gClient.sendArray([{
2278 m: "chown"
2279 }]);
2280 msgBox('Dropping crown', '', 1000, '#piano');
2281
2282 //alt
2283 } else if (code == 18) { //pickup crown
2284 gClient.sendArray([{
2285 m: "chown",
2286 id: gClient.participantId
2287 }]);
2288 msgBox('Picking up crown', '', 1000, '#piano');
2289
2290 //H
2291 } else if (code == 72) { //display help
2292 new Notification({id: "volume", title: "Hotkeys (thanks B@K$ for the design)", html: '\
2293 <h3>๖ۣۜHold to display binds and hotkeys...</h3>\
2294 <font color="#FF0066">Page Up:</font>Turns on/off chat commands (excluding !js and !room)<br />\
2295 <font color="#FF0066">Page Down</font> Ignores everyone elses notes<br />\
2296 <font color="#FF0066">End</font> Toggles rolling on multi-octaves<br />\
2297 <font color="#FF0066">Up/Down Arrows</font> Turns sets number of multi-octave<br />\
2298 <font color="#FF0066">Left/Right Arrows</font> electrashave\'s note transposing<br />\
2299 <font color="#FF0066">Insert</font> Toggles sustain (default was backspace)<br />\
2300 <font color="#FF0066">Backspace</font> Alerts you if someone in the friends list array joins<br />\
2301 <font color="#FF0066">Delete</font> Toggles an alert sound and notifcation if "Logan" is said<br />\
2302 <font color="#FF0066">Home *new</font> Toggles Polite Play Mode<br />\
2303 <font color="#FF0066">\\</font> Speech to text for Chrome (click accept then speak)<br />\
2304 <font color="#FF0066">Spacebar</font> Plays low notes while held<br />\
2305 <font color="#FF0066">~</font> Plays high notes while held<br />\
2306 <font color="#FF0066">Tab</font> Sends hotkey message<br />\
2307 <font color="#FF0066">3</font> Toggles owner only mode (need crown)<br />\
2308 <font color="#FF0066">6</font> Toggles room visibility (need crown)<br />\
2309 <font color="#FF0066">Numpad + -</font> Change note volume<br />\
2310 <font color="#FF0066">Numpad *</font> Toggles timestamps in chat<br />\
2311 <font color="#FF0066">Numpad .</font> Meow meow meow<br />\
2312 <font color="#FF0066">Numpad 0</font> Quick reconnect<br />\
2313 <font color="#FF0066">Numpad 1</font> Play Alone<br />\
2314 <font color="#FF0066">Numpad 2</font> Auto Follow<br />\
2315 <font color="#FF0066">Numpad 3</font> Greeting<br />\
2316 <font color="#FF0066">Numpad 4</font> Toggle Bunny<br />\
2317 <font color="#FF0066">Numpad 5</font> Toggles delay<br />\
2318 <font color="#FF0066">Numpad 6</font> Toggles Pong<br />\
2319 <font color="#FF0066">Numpad 7</font> Toggles text to speech<br />\
2320 <font color="#FF0066">Numpad 8</font> Toggles SomeGuy\'s incognito<br />\
2321 <font color="#FF0066">Alt</font> Picks up the crown<br />\
2322 <font color="#FF0066">Ctrl</font> Drops the crown<br />\
2323 <font color="#FF0066">H</font> Displays displays Hotkeys again<br />\
2324 <font color="#FF3399">!lhelp</font> Displays local commands in chat<br />\
2325 To stop this message displaying every time you start the script search for <font color="#FF0066">i_know_how_to_use_this_bot</font> and change <font color="#CC0000">false</font> to <font color="#0066FF">true</font>.<br />\
2326 ', target: "#blah-btn", duration: 600});
2327
2328//--TEST--TEST--TEST////--TEST--TEST--TEST////--TEST--TEST--TEST//
2329 //numpad .
2330 } else if (code == 110) { //hotkey test
2331 if (meow) {
2332 meow = false;
2333 msgBox('Cat Mode', 'Off', 1000, '#blah-btn');
2334 } else {
2335 meow = true;
2336 msgBox('Cat Mode', 'On', 1000, '#blah-btn');
2337 }
2338
2339
2340//--TEST--TEST--TEST////--TEST--TEST--TEST////--TEST--TEST--TEST//
2341
2342
2343 // ♥ Thanks Josh ♥ //
2344 // \ key
2345 } else if (code == 220) { //Yoshify's speech to text
2346 if (listening) {
2347 listening = false;
2348 Voice.stop();
2349 msgBox('Speech to Text', 'Stopping Capture', 3000, '#blah-btn');
2350 } else {
2351 listening = true;
2352 Voice.start();
2353 msgBox('Speech to Text', 'Listening (press again to send)', 3000, '#blah-btn');
2354 }
2355
2356 //numpad 7
2357 } else if (code == 103) { //speech toggle
2358 if (speechStatus) {
2359 speechStatus = false;
2360 speechSynthesis.cancel();
2361 msgBox('Text to Speech', 'Off', 1000, '#blah-btn');
2362 } else {
2363 speechStatus = true;
2364 msgBox('Text to Speech', 'On', 1000, '#blah-btn');
2365 }
2366 //del
2367 } else if (code == 46) { //alert on name said in chat toggle
2368 if (alertName) {
2369 alertName = false;
2370 msgBox('Alert on key-word', 'Off', 1000, '#blah-btn');
2371 } else {
2372 alertName = true;
2373 msgBox('Alert on key-word', 'On', 1000, '#blah-btn');
2374 }
2375 //home
2376 } else if (code == 36) { //politePlay
2377 if (politePlay) {
2378 politePlay = false;
2379 msgBox('Polite Play', 'Off', 1000, '#blah-btn');
2380 } else {
2381 politePlay = true;
2382 msgBox('Polite Play', 'On (others cannot hear your notes)', 1000, '#blah-btn');
2383 }
2384
2385 //backspace
2386 } else if (code == 8) { //alert on friends join toggle
2387 if (alertOnFriendJoin) {
2388 alertOnFriendJoin = false;
2389 msgBox('Alert on Friend Join', 'Off', 1000, '#blah-btn');
2390 } else {
2391 alertOnFriendJoin = true;
2392 msgBox('Alert on Friend Join', 'On', 1000, '#blah-btn');
2393 }
2394 // 3 key
2395 } else if (code == 51) { //owner only
2396 if (crownSoloToggle) {
2397 crownSoloToggle = false;
2398 MPP.client.sendArray([{m: "chset", set: {crownsolo: false}}]);
2399 msgBox('Owner Only', 'Off', 1000, '#blah-btn');
2400 } else {
2401 crownSoloToggle = true;
2402 MPP.client.sendArray([{m: "chset", set: {crownsolo: true}}]);
2403 msgBox('Owner Only', 'On', 1000, '#blah-btn');
2404 }
2405 // 6 key
2406 } else if (code == 54) { //hide room
2407 if (roomVisibleToggle) {
2408 roomVisibleToggle = false;
2409 MPP.client.sendArray([{m: "chset", set: {visible: false}}]);
2410 msgBox('Room Visible', 'No', 1000, '#blah-btn');
2411 } else {
2412 roomVisibleToggle = true;
2413 MPP.client.sendArray([{m: "chset", set: {visible: true}}]);
2414 msgBox('Room Visible', 'Yes', 1000, '#blah-btn');
2415 }
2416
2417
2418 } else if (code == 104) { //mouse updates
2419 if (incognito) {
2420 incognito = false;
2421 msgBox('Incognito', 'Off', 1000, '#blah-btn');
2422 } else {
2423 incognito = true;
2424 msgBox('Incognito', 'On', 1000, '#blah-btn');
2425 }
2426
2427 } else if (code == 105) { //copy notes
2428 if (copyNotes) {
2429 copyNotes = false;
2430 msgBox('Copy Notes', 'Off', 1000, '#blah-btn');
2431 } else {
2432 copyNotes = true;
2433 msgBox('Copy Notes', 'On', 1000, '#blah-btn');
2434 }
2435
2436 } else if (code == 100) { //cursor bunny
2437 testflipB = !testflipB;
2438 if (!testflipB) {
2439 msgBox('Bunny', 'Off', 1000, '#blah-btn');
2440 } else {
2441 setTimeout(function () {
2442 client = MPP.client;
2443 var bunny = new Bunny(client);
2444 worker.onmessage = function(event)
2445 {
2446 if(event.data.args)
2447 if(event.data.args.action==0){
2448 if(testflipB){ bunny.tick(); }
2449 }
2450 }
2451 worker.postMessage({delay:120,args:{action:0}});
2452 }, 120);
2453
2454
2455 var Bunny = function (client) {
2456 this.client = client;
2457
2458 this.vx = 1.5;
2459 this.vy = 2.2;
2460
2461 var self = this;
2462 self.part = self.client.ppl[self.client.participantId];
2463 client.on("ch", function () {
2464 self.part = self.client.ppl[self.client.participantId];
2465 });
2466 }
2467
2468 Bunny.prototype.tick = function () {
2469 if (!this.client.isConnected() || !this.part) return;
2470 this.part.x += this.vx;
2471 this.part.y += this.vy;
2472 if (this.part.x < 0) {
2473 this.vx = -this.vx;
2474 } else if (this.part.x > 100) {
2475 this.vx = -this.vx;
2476 }
2477 if (this.part.y < 0) {
2478 this.vy = -this.vy;
2479 } else if (this.part.y > 0) { //0 makes the ceiling which it bounces off
2480 this.vy = -this.vy;
2481 }
2482 this.client.sendArray([{
2483 m: "m",
2484 x: this.part.x,
2485 y: this.part.y
2486 }]);
2487 this.client.sendArray([{
2488 m: "m",
2489 x: this.part.x,
2490 y: this.part.y
2491 }]);
2492 worker.postMessage({delay:120,args:{action:0}});
2493 };
2494 msgBox('Bunny', 'On', 1000, '#blah-btn');
2495 }
2496
2497 //msgBox('Pong', 'Off', 1000, '#blah-btn');
2498
2499 } else if (code == 102) { //cursor pong
2500 testflipP = !testflipP;
2501 if (!testflipP) {
2502 msgBox('Pong', 'Off', 1000, '#blah-btn');
2503
2504 } else {
2505 //on
2506 setTimeout(function() {
2507 client = MPP.client;
2508 var pong = new Pong(client);
2509 worker.onmessage = function(event) {
2510 if (event.data.args)
2511 if (event.data.args.action == 0) {
2512 if (testflipP) {
2513 pong.tick();
2514 }
2515 }
2516 }
2517 worker.postMessage({
2518 delay: 60
2519 , args: {
2520 action: 0
2521 }
2522 });
2523 }, 60);
2524
2525
2526 var Pong = function(client) {
2527 this.client = client;
2528
2529 this.vx = 0.1875; //0.75
2530 this.vy = 0.275; //1.1
2531
2532 var self = this;
2533 self.part = self.client.ppl[self.client.participantId];
2534 client.on("ch", function() {
2535 self.part = self.client.ppl[self.client.participantId];
2536 });
2537 }
2538
2539 Pong.prototype.tick = function() {
2540 if (!this.client.isConnected() || !this.part) return;
2541 this.part.x += this.vx;
2542 this.part.y += this.vy;
2543 if (this.part.x < 0) {
2544 this.vx = -this.vx;
2545 } else if (this.part.x > 100) {
2546 this.vx = -this.vx;
2547 }
2548 if (this.part.y < 0) {
2549 this.vy = -this.vy;
2550 } else if (this.part.y > 100) {
2551 this.vy = -this.vy;
2552 }
2553
2554 //x is <--> 100 is --> 0 is <--
2555 //y is ^v 0 is ^ 100 is v
2556
2557 this.vx += Math.random() * 0.1 - 0.05;
2558 this.vy += Math.random() * 0.1 - 0.05;
2559 this.client.sendArray([{ //were two of these
2560 m: "m"
2561 , x: this.part.x
2562 , y: this.part.y
2563 }]);
2564 if (this.part.x < -10 || this.part.y < -10 || this.part.x > 110 || this.part.y > 110) {
2565 this.part.x = 50;
2566 this.part.y = 50;
2567 //resets the velocity when setting position
2568 this.vx = -this.vx;
2569 this.vy = -this.vy;
2570 }
2571 worker.postMessage({
2572 delay: 60
2573 , args: {
2574 action: 0
2575 }
2576 });
2577 };
2578 msgBox('Pong', 'On', 1000, '#blah-btn');
2579 }
2580
2581 } else if (code == 99) { //lenny
2582 var msgTmp = $("input").val(); //retain old text
2583 $("body #chat input").val(msgTmp + " Hello everyone! Type in (!help) to get my commands! Remember to stay cool ( ͡◕ ͜ʖ ͡◕)");
2584
2585 //numpad /
2586 } else if (code == 111) { //hotkey spam
2587 for(var key in MPP.piano.keys) MPP.press(key, volume);
2588
2589 //thanks electrashave!
2590 } else if (code == 39) {
2591 transLvl++;
2592 msgBox('Transposing (by electrashave)', 'Transpose level: ' + transLvl, 1000, '#blah-btn');
2593
2594 //thanks electrashave!
2595 } else if (code == 37) {
2596 transLvl--;
2597 msgBox('Transposing (by electrashave)', 'Transpose level: ' + transLvl, 1000, '#blah-btn');
2598 }
2599
2600 if (key_binding[code] !== undefined) {
2601 var binding = key_binding[code];
2602 if (!binding.held) {
2603 binding.held = true;
2604 if (gNoteQuota.spend(0)) {
2605 var note = binding.note;
2606 var octave = 1 + note.octave;
2607 // extra octaves
2608 if (keys[16])++octave;
2609 else if (keys[32])--octave == --octave + -octave;
2610 else if (keys[18])++octave == ++octave + +octave;
2611 else if (keys[192])++octave == ++octave + ++octave;
2612 else if (capsLockKey)--octave;
2613 var note = note.note;
2614 var vol = volume;
2615
2616 if (volume > 5) {
2617 volume = 5;
2618 }
2619 press(note + octave, vol);
2620 }
2621 }
2622
2623 if (++gKeyboardSeq == 3) {
2624 gKnowsYouCanUseKeyboard = true;
2625 if (window.gKnowsYouCanUseKeyboardTimeout) clearTimeout(gKnowsYouCanUseKeyboardTimeout);
2626 if (localStorage) localStorage.knowsYouCanUseKeyboard = true;
2627 if (window.gKnowsYouCanUseKeyboardNotification) gKnowsYouCanUseKeyboardNotification.close();
2628 }
2629
2630 evt.preventDefault();
2631 evt.stopPropagation();
2632 return false;
2633 } else if (code == 20) { // Caps Lock
2634 capsLockKey = true;
2635 evt.preventDefault();
2636 } else if (code === 0x20) { // Space Bar
2637 evt.preventDefault();
2638 } else if (code == 9) { // Tab (don't tab away from the piano)
2639 evt.preventDefault();
2640 } else if (code == 8) { // Backspace (don't navigate Back)
2641 evt.preventDefault();
2642 }
2643 };
2644
2645 //FIX BELOW MESS
2646
2647 var keys = [];
2648
2649 function handleKeyUp(evt) {
2650 var key = evt.keyCode;
2651 keys[key] = false;
2652 var code = parseInt(evt.keyCode);
2653 if (key_binding[code] !== undefined) {
2654 var binding = key_binding[code];
2655 if (binding.held) {
2656 keys[key] = false;
2657 binding.held = false;
2658
2659 if (!gAutoSustain && !gSustain) {
2660 if (gNoteQuota.spend(octTemp)) {
2661 var note = binding.note;
2662 var octave = 1 + note.octave;
2663 // extra octaves
2664 if (keys[16])++octave;
2665 else if (keys[32])--octave == --octave + -octave;
2666 else if (keys[18])++octave == ++octave + +octave;
2667 else if (keys[192])++octave == ++octave + ++octave;
2668 else if (capsLockKey)--octave;
2669 var note = note.note;
2670 release(note + octave); //was missing octave which didn't stop the note - Logan
2671 }
2672 }
2673 }
2674
2675 evt.preventDefault();
2676 evt.stopPropagation();
2677 return false;
2678 } else if (code == 20) { // Caps Lock
2679 capsLockKey = false;
2680 evt.preventDefault();
2681 } else if (code === 0x20) { // Space Bar
2682 evt.preventDefault();
2683 } else if (code == 8) { // Backspace (don't navigate Back)
2684 evt.preventDefault();
2685 }
2686 };
2687
2688 function handleKeyPress(evt) {
2689 evt.preventDefault();
2690 evt.stopPropagation();
2691 if (evt.keyCode == 27 || evt.keyCode == 13) {
2692 //add some stuff here Logan
2693 }
2694 return false;
2695 };
2696
2697 var recapListener = function (evt) {
2698 captureKeyboard();
2699 };
2700
2701 function captureKeyboard() {
2702 $("#piano").off("mousedown", recapListener);
2703 $("#piano").off("touchstart", recapListener);
2704 $(document).on("keydown", handleKeyDown);
2705 $(document).on("keyup", handleKeyUp);
2706 $(window).on("keypress", handleKeyPress);
2707 };
2708
2709 function releaseKeyboard() {
2710 $(document).off("keydown", handleKeyDown);
2711 $(document).off("keyup", handleKeyUp);
2712 $(window).off("keypress", handleKeyPress);
2713 $("#piano").on("mousedown", recapListener);
2714 $("#piano").on("touchstart", recapListener);
2715 };
2716
2717 captureKeyboard();
2718
2719
2720 var velocityFromMouseY = function () {
2721 return 0.1 + (my / 100) * 0.6;
2722 };
2723
2724
2725
2726
2727 // NoteQuota
2728 var gNoteQuota = (function () {
2729 var last_rat = 0;
2730 var nqjq = $("#quota .value");
2731 setInterval(function () {
2732 gNoteQuota.tick();
2733 }, 2000);
2734 return new NoteQuota(function (points) {
2735 // update UI
2736 var rat = (points / this.max) * 100; // 100
2737 if (rat <= last_rat)
2738 nqjq.stop(true, true).css("width", rat.toFixed(0) + "%");
2739 else
2740 nqjq.stop(true, true).animate({
2741 "width": rat.toFixed(0) + "%"
2742 }, 2000, "linear");
2743 last_rat = rat;
2744 });
2745 })();
2746 gClient.on("nq", function (nq_params) {
2747 gNoteQuota.setParams(nq_params);
2748 });
2749 gClient.on("disconnect", function () {
2750 gNoteQuota.setParams(NoteQuota.PARAMS_OFFLINE);
2751 });
2752
2753
2754
2755 // click participant names
2756 (function () {
2757 var ele = document.getElementById("names");
2758 var touchhandler = function (e) {
2759 var target_jq = $(e.target);
2760 if (target_jq.hasClass("name")) {
2761 target_jq.addClass("play");
2762 if (e.target.participantId == gClient.participantId) {
2763 var id = e.target.participantId;
2764 var part = gClient.ppl[id] || null;
2765 if (part) {
2766 participantMenu(part);
2767 e.stopPropagation();
2768 }
2769 } else if (e.target.participantId) {
2770 var id = e.target.participantId;
2771 var part = gClient.ppl[id] || null;
2772 if (part) {
2773 participantMenu(part);
2774 e.stopPropagation();
2775 }
2776 }
2777 }
2778 };
2779 ele.addEventListener("mousedown", touchhandler);
2780 ele.addEventListener("touchstart", touchhandler);
2781 var releasehandler = function (e) {
2782 $("#names .name").removeClass("play");
2783 };
2784 document.body.addEventListener("mouseup", releasehandler);
2785 document.body.addEventListener("touchend", releasehandler);
2786
2787 var removeParticipantMenus = function () {
2788 $(".participant-menu").fadeOut(500);
2789 $(".participantSpotlight").hide(); //what is this?
2790 document.removeEventListener("mousedown", removeParticipantMenus);
2791 document.removeEventListener("touchstart", removeParticipantMenus);
2792 };
2793
2794 var participantMenu = function (part) {
2795 if (!part) return;
2796 removeParticipantMenus();
2797 document.addEventListener("mousedown", removeParticipantMenus);
2798 document.addEventListener("touchstart", removeParticipantMenus);
2799 $("#" + part.id).find(".enemySpotlight").show(); //what is this D:
2800 var menu = $('<div class="participant-menu"></div>');
2801 $("body").append(menu);
2802 // move menu to name position
2803 var jq_nd = $(part.nameDiv);
2804 var pos = jq_nd.position();
2805 menu.css({
2806 "top": pos.top + jq_nd.height() + 15,
2807 "left": pos.left + 6,
2808 "background": part.color || "black"
2809 });
2810 menu.on("mousedown touchstart", function (evt) {
2811 evt.stopPropagation();
2812 var target = $(evt.target);
2813 if (target.hasClass("menu-item")) {
2814 target.addClass("clicked"); //why is this needed?
2815 menu.fadeOut(500, function () {
2816 removeParticipantMenus();
2817 });
2818 }
2819 });
2820 // this spaces stuff out but also can be used for informational purposes
2821 $('<div class="info"></div>').appendTo(menu).text(part._id)
2822 .on("mousedown touchstart", function (evt) {
2823 //prompt("Press CTRL C to copy "+ part.name +"'s ID", part._id);
2824 prompt(part.name.endsWith("s") ? "Press CTRL C to copy "+ part.name +"' ID" : "Press CTRL C to copy "+ part.name +"'s ID", part._id);
2825 });
2826
2827 // added menu items
2828
2829 // rename
2830 if (part._id == gClient.getOwnParticipant()._id) {
2831 $('<div class="menu-item">• Rename</div>').appendTo(menu)
2832 .on("mousedown touchstart", function (evt) {
2833 openModal("#rename", "input[name=name]");
2834 setTimeout(function () {
2835 $("#rename input[name=name]").val(gClient.ppl[gClient.participantId].name);
2836 $("#rename input[name=color]").val(gClient.ppl[gClient.participantId].color);
2837 }, 100);
2838 });
2839 }
2840
2841
2842 // master and unmaster
2843 if (masters.indexOf(part._id) == -1) {
2844 $('<div class="menu-item">• Master</div>').appendTo(menu)
2845 .on("mousedown touchstart", function (evt) {
2846 masters.push(part._id);
2847 gClient.sendArray([{ m: "a", message: "Mastered " + part.name + "."}])
2848 });
2849 } else {
2850 $('<div class="menu-item">• Unmaster</div>').appendTo(menu)
2851 .on("mousedown touchstart", function (evt) {
2852 delete masters[masters.indexOf(part._id)];
2853 gClient.sendArray([{ m: "a", message: "Unmastered " + part.name + "."}])
2854 });
2855 }
2856
2857
2858 // op and deop
2859 if (ops.indexOf(part._id) == -1) {
2860 $('<div class="menu-item">• Op</div>').appendTo(menu)
2861 .on("mousedown touchstart", function (evt) {
2862 ops.push(part._id);
2863 gClient.sendArray([{ m: "a", message: "Opped " + part.name + "."}])
2864 });
2865 } else {
2866 $('<div class="menu-item">• Deop</div>').appendTo(menu)
2867 .on("mousedown touchstart", function (evt) {
2868 delete ops[ops.indexOf(part._id)];
2869 gClient.sendArray([{ m: "a", message: "deopped " + part.name + "."}])
2870 });
2871 }
2872
2873 if (part._id != gClient.getOwnParticipant()._id) {
2874
2875 // follow and rest
2876 if (!followId) {
2877 $('<div class="menu-item">• Follow >.<</div>').appendTo(menu)
2878 .on("mousedown touchstart", function (evt) {
2879 following = true;
2880 followId = part._id;
2881
2882 msgBox('Following', part.name, 2000, '#piano');
2883 });
2884 } else {
2885 $('<div class="menu-item">• Rest <.></div>').appendTo(menu)
2886 .on("mousedown touchstart", function (evt) {
2887 following = false;
2888 followId = null;
2889 msgBox('Stopping', 'Ok...', 2000, '#piano');
2890 });
2891 }
2892
2893 if (gPianoMutes.indexOf(part._id) == -1) {
2894 $('<div class="menu-item">• Mute Notes</div>').appendTo(menu)
2895 .on("mousedown touchstart", function (evt) {
2896 gPianoMutes.push(part._id);
2897 $(part.nameDiv).addClass("muted-notes");
2898 });
2899 } else {
2900 $('<div class="menu-item">• Unmute Notes</div>').appendTo(menu)
2901 .on("mousedown touchstart", function (evt) {
2902 var i;
2903 while ((i = gPianoMutes.indexOf(part._id)) != -1)
2904 gPianoMutes.splice(i, 1);
2905 $(part.nameDiv).removeClass("muted-notes");
2906 });
2907 }
2908 if (gChatMutes.indexOf(part._id) == -1) {
2909 $('<div class="menu-item">• Mute Chat</div>').appendTo(menu)
2910 .on("mousedown touchstart", function (evt) {
2911 gChatMutes.push(part._id);
2912 $(part.nameDiv).addClass("muted-chat");
2913 });
2914 } else {
2915 $('<div class="menu-item">• Unmute Chat</div>').appendTo(menu)
2916 .on("mousedown touchstart", function (evt) {
2917 var i;
2918 while ((i = gChatMutes.indexOf(part._id)) != -1)
2919 gChatMutes.splice(i, 1);
2920 $(part.nameDiv).removeClass("muted-chat");
2921 });
2922 }
2923 if (!(gPianoMutes.indexOf(part._id) >= 0) || !(gChatMutes.indexOf(part._id) >= 0)) {
2924 $('<div class="menu-item">• Mute Completely</div>').appendTo(menu)
2925 .on("mousedown touchstart", function (evt) {
2926 gPianoMutes.push(part._id);
2927 gChatMutes.push(part._id);
2928 $(part.nameDiv).addClass("muted-notes");
2929 $(part.nameDiv).addClass("muted-chat");
2930 });
2931 }
2932 if ((gPianoMutes.indexOf(part._id) >= 0) || (gChatMutes.indexOf(part._id) >= 0)) {
2933 $('<div class="menu-item">• Unmute Completely</div>').appendTo(menu)
2934 .on("mousedown touchstart", function (evt) {
2935 var i;
2936 while ((i = gPianoMutes.indexOf(part._id)) != -1)
2937 gPianoMutes.splice(i, 1);
2938 while ((i = gChatMutes.indexOf(part._id)) != -1)
2939 gChatMutes.splice(i, 1);
2940 $(part.nameDiv).removeClass("muted-notes");
2941 $(part.nameDiv).removeClass("muted-chat");
2942 });
2943 }
2944
2945 // ban and unban
2946 if (banned.indexOf(part._id) == -1) {
2947 $('<div class="menu-item">• Ban</div>').appendTo(menu)
2948 .on("mousedown touchstart", function (evt) {
2949 banned.push(part._id);
2950 msgBox('Banned', part.name, 1000, '#piano');
2951 });
2952 } else {
2953 $('<div class="menu-item">• Unban</div>').appendTo(menu)
2954 .on("mousedown touchstart", function (evt) {
2955 delete banned[banned.indexOf(part._id)];
2956 msgBox('Unbanned', part.name, 1000, '#piano');
2957 });
2958 }
2959
2960 if (gClient.isOwner()) {
2961 $('<div class="menu-item give-crown">• Give Crown</div>').appendTo(menu)
2962 .on("mousedown touchstart", function (evt) {
2963 gClient.sendArray([{
2964 m: "chown",
2965 id: part.id
2966 }]);
2967 });
2968 }
2969 }
2970 menu.fadeIn(500);
2971 };
2972 })();
2973
2974
2975
2976
2977 // Notification class
2978
2979 ////////////////////////////////////////////////////////////////
2980
2981 var Notification = function (par) {
2982 EventEmitter.call(this);
2983
2984 var par = par || {};
2985
2986 this.id = "Notification-" + (par.id || Math.random());
2987 this.title = par.title || "";
2988 this.text = par.text || "";
2989 this.html = par.html || "";
2990 this.target = $(par.target || "#piano");
2991 this.duration = par.duration || 30000;
2992
2993 var self = this;
2994 var eles = $("#" + this.id);
2995 if (eles.length > 0) {
2996 eles.remove();
2997 }
2998 this.domElement = $('<div class="notification"><div class="notification-body"><div class="title"></div>' +
2999 '<div class="text"></div></div><div class="x">x</div></div>');
3000 this.domElement[0].id = this.id;
3001 this.domElement.find(".title").text(this.title);
3002 if (this.text.length > 0) {
3003 this.domElement.find(".text").text(this.text);
3004 } else if (this.html.length > 0) {
3005 this.domElement.find(".text").html(this.html);
3006 }
3007 document.body.appendChild(this.domElement.get(0));
3008
3009 this.position();
3010 this.onresize = function () {
3011 self.position();
3012 };
3013 $(window).on("resize", this.onresize);
3014
3015 this.domElement.find(".x").click(function () {
3016 self.close();
3017 });
3018
3019 if (this.duration > 0) {
3020 setTimeout(function () {
3021 self.close();
3022 }, this.duration);
3023 }
3024
3025 return this;
3026 }
3027
3028 mixin(Notification.prototype, EventEmitter.prototype);
3029 Notification.prototype.constructor = Notification;
3030
3031 Notification.prototype.position = function () {
3032 var pos = this.target.offset();
3033 var x = pos.left - (this.domElement.width() / 2) + (this.target.width() / 4);
3034 var y = pos.top - this.domElement.height() - 8;
3035 var width = this.domElement.width();
3036 if (x + width > $("body").width()) {
3037 x -= ((x + width) - $("body").width());
3038 }
3039 if (x < 0) x = 0;
3040 this.domElement.offset({
3041 left: x,
3042 top: y
3043 });
3044 };
3045
3046 Notification.prototype.close = function () {
3047 var self = this;
3048 $(window).off("resize", this.onresize);
3049 this.domElement.fadeOut(500, function () {
3050 self.domElement.remove();
3051 self.emit("close");
3052 });
3053 };
3054
3055
3056
3057
3058 // set variables from settings or set settings
3059
3060 ////////////////////////////////////////////////////////////////
3061
3062 if(!i_know_how_to_use_this_bot) {
3063
3064 new Notification({id: "volume", title: "Hotkeys (thanks B@K$ for the design)", html: '\
3065 <h3>๖ۣۜHold to display binds and hotkeys...</h3>\
3066 <font color="#FF0066">Page Up:</font>Turns on/off chat commands (excluding !js and !room)<br />\
3067 <font color="#FF0066">Page Down</font> Ignores everyone elses notes<br />\
3068 <font color="#FF0066">End</font> Toggles rolling on multi-octaves<br />\
3069 <font color="#FF0066">Up Arrow</font> Turns on / increases multi-octave<br />\
3070 <font color="#FF0066">Down Arrow:</font> Turns on / increases multi-octave<br />\
3071 <font color="#FF0066">Insert</font> Toggles sustain (default was backspace)<br />\
3072 <font color="#FF0066">Backspace</font> Alerts you if someone in the friends list array joins<br />\
3073 <font color="#FF0066">Delete</font> Toggles an alert sound and notifcation if "Logan" is said<br />\
3074 <font color="#FF0066">Home *new</font> Toggles Polite Play Mode<br />\
3075 <font color="#FF0066">\\</font> Speech to text for Chrome (click accept then speak)<br />\
3076 <font color="#FF0066">Spacebar</font> Plays low notes while held<br />\
3077 <font color="#FF0066">~</font> Plays high notes while held<br />\
3078 <font color="#FF0066">Tab</font> Sends hotkey message<br />\
3079 <font color="#FF0066">3</font> Toggles owner only mode (need crown)<br />\
3080 <font color="#FF0066">6</font> Toggles room visibility (need crown)<br />\
3081 <font color="#FF0066">Numpad + -</font> Change note volume<br />\
3082 <font color="#FF0066">Numpad *</font> Toggles timestamps in chat<br />\
3083 <font color="#FF0066">Numpad .</font> Meow meow meow<br />\
3084 <font color="#FF0066">Numpad 0</font> Quick reconnect<br />\
3085 <font color="#FF0066">Numpad 1</font> Play Alone<br />\
3086 <font color="#FF0066">Numpad 2</font> Auto Follow<br />\
3087 <font color="#FF0066">Numpad 3</font> Greeting<br />\
3088 <font color="#FF0066">Numpad 4</font> Toggle Bunny<br />\
3089 <font color="#FF0066">Numpad 5</font> Toggles delay<br />\
3090 <font color="#FF0066">Numpad 6</font> Toggles Pong<br />\
3091 <font color="#FF0066">Numpad 7</font> Toggles text to speech<br />\
3092 <font color="#FF0066">Numpad 8</font> Toggles SomeGuy\'s incognito<br />\
3093 <font color="#FF0066">Alt</font> Picks up the crown<br />\
3094 <font color="#FF0066">Ctrl</font> Drops the crown<br />\
3095 <font color="#FF0066">H</font> Displays displays Hotkeys again<br />\
3096 <font color="#FF3399">!lhelp</font> Displays local commands in chat<br />\
3097 To stop these messages displaying every time you start the script search for <font color="#FF0066">i_know_how_to_use_this_bot</font> and change <font color="#CC0000">false</font> to <font color="#0066FF">true</font>.<br />\
3098 ', target: "#blah-btn", duration: 0});
3099
3100 setTimeout(function() { //I think wrapping this in setTimeout hoists it so it wait for the buttons to be placed
3101 msgBox('Chat log is saved between rooms', 'To clear click Msgs button (i know it\'s on wrong button >.<)', 0, '#4-btn');
3102 }, 0);
3103
3104 }
3105
3106 var gKeyboardSeq = 0;
3107 var gKnowsYouCanUseKeyboard = false;
3108 if (localStorage && localStorage.knowsYouCanUseKeyboard) gKnowsYouCanUseKeyboard = true;
3109 if (!gKnowsYouCanUseKeyboard) {
3110 window.gKnowsYouCanUseKeyboardTimeout = setTimeout(function () {
3111 window.gKnowsYouCanUseKeyboardNotification = new Notification({
3112 title: "Did you know!?!",
3113 text: "You can play the piano with your keyboard, too. Try it!",
3114 target: "#piano",
3115 duration: 10000
3116 });
3117 }, 30000);
3118 }
3119
3120
3121
3122
3123 if (window.localStorage) {
3124
3125 if (localStorage.volume) {
3126 volume_slider.set(localStorage.volume);
3127 gPiano.audio.setVolume(localStorage.volume);
3128 } else localStorage.volume = gPiano.audio.volume;
3129
3130 window.gHasBeenHereBefore = (localStorage.gHasBeenHereBefore || false);
3131 if (gHasBeenHereBefore) {}
3132 localStorage.gHasBeenHereBefore = true;
3133
3134 }
3135
3136
3137
3138
3139 // New room, change room
3140
3141 ////////////////////////////////////////////////////////////////
3142
3143 $("#room > .info").text("--");
3144 gClient.on("ch", function (msg) {
3145 var channel = msg.ch;
3146 var info = $("#room > .info");
3147 info.text(channel._id);
3148 if (channel.settings.lobby) info.addClass("lobby");
3149 else info.removeClass("lobby");
3150 if (!channel.settings.chat) info.addClass("no-chat");
3151 else info.removeClass("no-chat");
3152 if (channel.settings.crownsolo) info.addClass("crownsolo");
3153 else info.removeClass("crownsolo");
3154 if (!channel.settings.visible) info.addClass("not-visible");
3155 else info.removeClass("not-visible");
3156 });
3157 gClient.on("ls", function (ls) {
3158 for (var i in ls.u) {
3159 if (!ls.u.hasOwnProperty(i)) continue;
3160 var room = ls.u[i];
3161 var info = $("#room .info[roomname=\"" + (room._id + '').replace(/[\\"']/g, '\\$&').replace(/\u0000/g, '\\0') + "\"]");
3162 if (info.length == 0) {
3163 info = $("<div class=\"info\"></div>");
3164 info.attr("roomname", room._id);
3165 $("#room .more").append(info);
3166 }
3167 info.text(room._id + " [" + room.count + "]"); //room browser -Logie
3168 if (room.settings.lobby) info.addClass("lobby");
3169 else info.removeClass("lobby");
3170 if (!room.settings.chat) info.addClass("no-chat");
3171 else info.removeClass("no-chat");
3172 if (room.settings.crownsolo) info.addClass("crownsolo");
3173 else info.removeClass("crownsolo");
3174 if (!room.settings.visible) info.addClass("not-visible");
3175 else info.removeClass("not-visible");
3176 }
3177 });
3178 $("#room").on("click", function (evt) {
3179 evt.stopPropagation();
3180
3181 // clicks on a new room
3182 if ($(evt.target).hasClass("info") && $(evt.target).parents(".more").length) {
3183 $("#room .more").fadeOut(250);
3184 var selected_name = $(evt.target).attr("roomname");
3185 if (typeof selected_name != "undefined") {
3186 changeRoom(selected_name, "right");
3187 }
3188 return false;
3189 }
3190 // clicks on "New Room..."
3191 else if ($(evt.target).hasClass("new")) {
3192 openModal("#new-room", "input[name=name]");
3193 }
3194 // all other clicks
3195 var doc_click = function (evt) {
3196 $(document).off("mousedown", doc_click);
3197 $("#room .more").fadeOut(500); //closes on click away
3198 gClient.sendArray([{
3199 m: "-ls"
3200 }]);
3201 }
3202 $(document).on("mousedown", doc_click);
3203 $("#room .more .info").fadeOut(500);
3204 $("#room .more").show();
3205 gClient.sendArray([{
3206 m: "+ls"
3207 }]);
3208 });
3209 $("#new-room-btn").on("click", function (evt) {
3210 evt.stopPropagation();
3211 openModal("#new-room", "input[name=name]");
3212 });
3213
3214
3215 $("#play-alone-btn").on("click", function (evt) {
3216 evt.stopPropagation();
3217 var room_name = randStr(28);
3218 changeRoom(room_name, "right", {
3219 "visible": false,
3220 "chat": true,
3221 "crownsolo": false, //Lroom
3222 "lobby": false
3223
3224 });
3225 });
3226
3227
3228
3229 var gModal;
3230
3231 function modalHandleEsc(evt) {
3232 if (evt.keyCode == 27) {
3233 closeModal();
3234 evt.preventDefault();
3235 evt.stopPropagation();
3236 }
3237 };
3238
3239 function openModal(selector, focus) {
3240 chat.blur();
3241 releaseKeyboard();
3242 $(document).on("keydown", modalHandleEsc);
3243 $("#modal #modals > *").hide();
3244 $("#modal").fadeIn(250);
3245 $(selector).show();
3246 setTimeout(function () {
3247 $(selector).find(focus).focus();
3248 }, 100);
3249 gModal = selector;
3250 };
3251
3252 function closeModal() {
3253 $(document).off("keydown", modalHandleEsc);
3254 $("#modal").fadeOut(100);
3255 $("#modal #modals > *").hide();
3256 captureKeyboard();
3257 gModal = null;
3258 };
3259
3260 var modal_bg = $("#modal .bg")[0];
3261 $(modal_bg).on("click", function (evt) {
3262 if (evt.target != modal_bg) return;
3263 closeModal();
3264 });
3265
3266 (function () {
3267 function submit() {
3268 var name = $("#new-room .text[name=name]").val();
3269 var settings = {
3270 visible: $("#new-room .checkbox[name=visible]").is(":checked"),
3271 chat: true,
3272 crownsolo: false
3273 };
3274 $("#new-room .text[name=name]").val("");
3275 closeModal();
3276 changeRoom(name, "right", settings);
3277 };
3278 $("#new-room .submit").click(function (evt) {
3279 submit();
3280 });
3281 $("#new-room .text[name=name]").keypress(function (evt) {
3282 if (evt.keyCode == 13) {
3283 submit();
3284 } else if (evt.keyCode == 27) {
3285 closeModal();
3286 } else {
3287 return;
3288 }
3289 evt.preventDefault();
3290 evt.stopPropagation();
3291 return false;
3292 });
3293 })();
3294
3295
3296
3297
3298 function changeRoom(name, direction, settings, push) {
3299 if (!settings) settings = {};
3300 if (!direction) direction = "right";
3301 if (typeof push == "undefined") push = true;
3302 var opposite = direction == "left" ? "right" : "left";
3303
3304 if (name == "") name = "lolwutsecretlobbybackdoor"; //defaults to lobby back door
3305 if (gClient.channel && gClient.channel._id === name) return;
3306 if (push) {
3307 var url = "/" + encodeURIComponent(name).replace("'", "%27");
3308 if (window.history && history.pushState) {
3309 history.pushState({
3310 "depth": gHistoryDepth += 1,
3311 "name": name
3312 }, "Piano > " + name, url);
3313 } else {
3314 window.location = url;
3315 return;
3316 }
3317 }
3318
3319 gClient.setChannel(name, settings);
3320 };
3321
3322 var gHistoryDepth = 0;
3323 $(window).on("popstate", function (evt) {
3324 var depth = evt.state ? evt.state.depth : 0;
3325 if (depth == gHistoryDepth) return; // <-- forgot why I did that though...
3326
3327 var direction = depth <= gHistoryDepth ? "left" : "right";
3328 gHistoryDepth = depth;
3329
3330 var name = decodeURIComponent(window.location.pathname);
3331 if (name.substr(0, 1) == "/") name = name.substr(1);
3332 changeRoom(name, direction, null, false);
3333 });
3334
3335
3336
3337
3338 // Rename
3339
3340 ////////////////////////////////////////////////////////////////
3341
3342 (function () {
3343 function submit() {
3344 var set = {
3345 name: $("#rename input[name=name]").val(),
3346 color: $("#rename input[name=color]").val()
3347 };
3348 closeModal();
3349 gClient.sendArray([{
3350 m: "userset",
3351 set: set
3352 }]);
3353 selfName = set.name; //object
3354 };
3355 $("#rename .submit").click(function (evt) {
3356 submit();
3357 });
3358 $("#rename .text[name=name]").keypress(function (evt) {
3359 if (evt.keyCode == 13) {
3360 submit();
3361 } else if (evt.keyCode == 27) {
3362 closeModal();
3363 } else {
3364 return;
3365 }
3366 evt.preventDefault();
3367 evt.stopPropagation();
3368 return false;
3369 });
3370 })();
3371
3372
3373
3374
3375 // chatctor
3376
3377 ////////////////////////////////////////////////////////////////
3378
3379 var chat = (function () {
3380 gClient.on("ch", function (msg) {
3381 if (msg.ch.settings.chat) {
3382 $("#nochat-notice").remove();
3383 chat.show();
3384 } else {
3385 //chat.hide();
3386 if ($("#nochat-notice").length == 0) {
3387 $('<div id="nochat-notice">').text('Chat has been disabled').appendTo("body").fadeIn(500);
3388 }
3389 chat.show();
3390 }
3391 });
3392 gClient.on("disconnect", function (msg) {
3393 chat.hide();
3394 });
3395 gClient.on("c", function (msg) {
3396 chat.clear();
3397 if (msg.c) {
3398 for (var i = 0; i < msg.c.length; i++) {
3399 chat.receive(msg.c[i])
3400 }
3401 }
3402 });
3403 var WAIT_MS = 3000;
3404 var last_known_channel = undefined;
3405 var wait_until = Infinity;
3406 gClient.on("ch", function (msg) {
3407 if (msg.ch._id !== last_known_channel) {
3408 last_known_channel = msg.ch._id;
3409 wait_until = Date.now() + WAIT_MS;
3410 }
3411 });
3412
3413 //here are the masters - they're global so the participant menu works
3414 masters = [selfId, //Logan
3415 '4f44e29ef5a03683d229b617',]; //Josh
3416
3417 //here you can add default ops
3418 ops = [selfId, //Logan
3419 '4f44e29ef5a03683d229b617']; //Josh
3420
3421 //here you can add default bans
3422 banned = ['998d3dc09887c9f9aa5f5a5a']; //global for participant menu
3423
3424 //here you can add ids for meanies
3425 var gMuteCompletely = ['', '', '', ''];
3426
3427 var WAIT_MS = 3000;
3428 var last_known_channel = undefined;
3429 var wait_until = Infinity;
3430 var date = new Date();
3431
3432 var welcTemp = false; //turn on welcoming by default false = no
3433 // 0 off, 1 for everyone, 2 for only you
3434 bot = 1; //turn on and off chat commands by default true = on / MUST BE GLOBAL FOR HOTKEY
3435 gClient.on("ch", function (msg) {
3436 if (msg.ch._id !== last_known_channel) {
3437 last_known_channel = msg.ch._id;
3438 wait_until = Date.now() + WAIT_MS;
3439 }
3440 });
3441
3442 gClient.on("ls", function (ls) {});
3443 gClient.on("participant added", function (part) {
3444
3445 if (gMuteCompletely.indexOf(part._id) != -1) {
3446 gPianoMutes.push(part._id);
3447 gChatMutes.push(part._id);
3448 } else {
3449 // don't mute them
3450 };
3451 console.log("%c" + "Client: " + part.name + " Joined! | ID: " + part._id, "color:" + part.color);
3452 function friendFunc(name) {
3453 new window.Notification("Friend " + name + " joined! [" + getTime() + "]", {
3454 icon: "http://localhost:3000/images/friend.png",
3455 body: "With the name " + part.name
3456 });
3457 }
3458 if (alertOnFriendJoin) {
3459 if (part._id == "02f90ec86dae40a66b42b998") { //Jenna
3460 friendFunc("Jenna");
3461 friendSound.play();
3462
3463 } else if (part._id == "4f44e29ef5a03683d229b617") { //Josh
3464 friendFunc("Josh");
3465 friendSound.play();
3466
3467 } else if (part._id == "a597eabce1a7e8c7af8dc0b1") { //Sean
3468 friendFunc("Sean");
3469 friendSound.play();
3470
3471 } else if (part._id == "00391420f3143515cdf4f253") { //Tori
3472 friendFunc("Tori");
3473 friendSound.play();
3474
3475 } else if (part._id == "8e27f67c6614cfc27e966238") { //Elizabeth
3476 friendFunc("Elizabeth");
3477 friendSound.play();
3478
3479 } else if (part._id == "2e24802a4d0760ae38cac19d") { //Jade
3480 friendFunc("Jade");
3481 friendSound.play();
3482
3483 } else if (part._id == "6121baa58629bef012e61105") { //Yoshify
3484 friendFunc("Yoshify");
3485 friendSound.play();
3486
3487 } else if (part._id == "af837983e85689771d5c5422") { //Clefairy
3488 friendFunc("Clefairy");
3489 friendSound.play();
3490
3491 } else if (part._id == "5ae13ed2055af114e7286084") { //Lana
3492 friendFunc("Lana");
3493 friendSound.play();
3494
3495 } else if (part._id == "cf1a3130178083180a456143") { //Fennece
3496 friendFunc("Fennece");
3497 friendSound.play();
3498
3499 } else if (part._id == "c46bce6a8136bf1f2e158de4") { //Wolfeby
3500 friendFunc("Wolfeby");
3501 friendSound.play();
3502
3503 } else if (part._id == "5cc14d88c59a4110f92251d2") { //Mr. High Horse
3504 friendFunc("Mr. High Horse");
3505 friendSound.play();
3506
3507 }
3508
3509 } else {
3510
3511 }
3512 var nameArray = ['a cute',
3513 'a handsome',
3514 'a delightful',
3515 'an adorable',
3516 'an attractive',
3517 'a cute',
3518 'a lovely',
3519 'a sweet',
3520 'a gorgeous',
3521 'an elegant',
3522 'a pretty',
3523 'a beautiful',
3524 'an exquisite',
3525 'a nice',
3526 'a charming',
3527 'a neat',
3528 'a prim',
3529 'a plebby',
3530 'an unusual'];
3531 var faceArray = ['^-^',
3532 '^_^',
3533 ':>',
3534 'v.v',
3535 'c:',
3536 '=D',
3537 ':)',
3538 'o3o',
3539 '<.>',
3540 '>.<',
3541 'o.o',
3542 'O.O',
3543 'o-o',
3544 'O-O',
3545 'o_o',
3546 'O_O',
3547 '°-°',
3548 '°_°',
3549 '°.°',
3550 '=P',
3551 '=p',
3552 ':F',
3553 ';w;',
3554 '=3',
3555 '<3',
3556 '... ' + selfName + ' loves you ;-;'];
3557 var selection = Math.floor(Math.random() * nameArray.length);
3558 var faceSelection = Math.floor(Math.random() * faceArray.length);
3559 //welcMsg = "Welcome to " + last_known_channel + ", " + part.name + ". That's " + nameArray[selection] + " name " + faceArray[faceSelection];
3560 welcMsg = "Welcome, " + part.name + ". Type "+cmdChar+"help to get my list of commands!";
3561 if (Date.now() > wait_until) {
3562 setTimeout(function () {
3563 if (Date.now() > wait_until) {
3564 if (welcTemp) {
3565 sendChat(welcMsg);
3566 }
3567 }
3568 }, 100);
3569 }
3570 });
3571
3572 //Command List
3573 //Lhelp
3574 gClient.on("a", function (msg) {
3575
3576 Object.prototype.toString = function() {
3577 return JSON.stringify(this);
3578 }
3579
3580 //fishy business (thanks Delan) // /fish
3581 if(msg.a.indexOf(gClient.getOwnParticipant().name + " caught a " )!== -1 && msg.p._id == ("1faa6da5c0c776d8e087ad61")){
3582 fishCaught += 1;
3583 MPP.chat.send("/fish (" + fishCaught + ")");
3584 if (giveFish) {
3585 MPP.chat.send("/give " + fishLord);
3586 } else {
3587 // keep fish
3588 }
3589 }
3590 //fishy business (thanks Delan)
3591
3592 if (speechStatus) {
3593 var t = new SpeechSynthesisUtterance();
3594 t.text = msg.a; //msg.a.slice(0, 140); // 140 is good.
3595 t.lang = speechLang;
3596 t.rate = speechRate; //1 //though default was 0.75
3597 t.pitch = speechPitch; //1.0
3598 t.volume = speechVolume; //0.5
3599 speechSynthesis.speak(t);
3600 }
3601
3602 // alert on key-word
3603 $(window).blur(function(){
3604 tabbedIn = true;
3605 })
3606 $(window).focus(function(){
3607 tabbedIn = false;
3608 })
3609
3610 if (tabbedIn) {
3611 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
3612 // ignore fishing-computer, he likes to say my name a lot
3613 } else if (alertName && msg.a.toLowerCase().includes(keyword)) {
3614 alertSound.play();
3615 new window.Notification(msg.p.name + " mentioned your name. [" + getTime() + "]", { icon: "http://localhost:3000/images/speech.png", body: "Message: " + msg.a});
3616 }
3617 }
3618
3619 // alert name
3620
3621 // commands area
3622 console.log("%c"+msg.p.name + " @@ " + msg.p._id + ": " + msg.a, "color:"+msg.p.color);
3623 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"];
3624 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]"];
3625 var opcmds = ["prefix ( "+cmdChar+" )", "rename", "spam", "welcome", "ban", "unban", "pardon (unbans all)", "op", "deop", "clear (clears chat)", "cmds (toggles chat commands)"];
3626 var message = msg.a;
3627
3628 //say (http://stackoverflow.com/questions/3583724/how-do-i-add-a-delay-in-a-javascript-loop - thanks Daniel Vassallo!)
3629 if (sayIt) {
3630 var tmp = message.toLowerCase();
3631 var sayText = tmp.split(" ");
3632 var i = 0; // set your counter to 1
3633 var l = sayText.length; // set the max to be the message length
3634
3635 function myLoop () { // create a loop function
3636 setTimeout(function () { // call a 3s setTimeout when the loop is called
3637 say(sayText[i]); // your code here
3638 i++; // increment the counter
3639 if (i < l) { // if the counter < 10, call the loop function
3640 myLoop(); // .. again which will trigger another
3641 } // .. setTimeout()
3642 }, 500)
3643 }
3644
3645 myLoop(); // start the loop
3646
3647 }
3648
3649 // stuff that needs to be redefined each time
3650 var args = msg.a.split(' '); //split message into array
3651 var cmd = args[0].toLowerCase(); //grab first index
3652 var target = msg.a.substring(cmd.length).trim();
3653 var name = msg.p.name;
3654 var noAccess = name.endsWith("();") ? "Insufficent permissions " + name : "Insufficent permissions (" + name + ")";
3655 var userNotFound = "User not found (" + target + ").";
3656 var color = msg.p.color;
3657 var ids = msg.p._id;
3658
3659 if (!botLoaded) {
3660 // stuff that can remain the same (at least I haven't seen any bugs keep an eye out :o)
3661 sendChat = function(msg) { gClient.sendArray([{ m: "a", message: "\u034f" + msg }]) }; //global so welcoming works.
3662 updateName = function (name) { gClient.sendArray([{ m: "userset", set:{name: name }}]) } //global so stuff won't break. (Broken???)
3663 var Fcalories = 1250;
3664 var Dcalories = 120;
3665 var matched = false;
3666 var mastered = false; //When this is true everyone is mastered
3667 var opped = false; //When this is true everyone is opped
3668 }
3669
3670 if (banned.indexOf(ids) !== -1) matched = true;
3671 if (masters.indexOf(ids) !== -1) mastered = true;
3672 if (ops.indexOf(ids) !== -1) opped = true;
3673 if (animName) heyThereKitty = name; //Hey there, Kitty.
3674 if (animName) heyThereKittyId = ids; //Hey there, Kittyid.
3675
3676 // sentence game
3677 if (askedEnglish && msg.a === sentenceAntiCopy) {
3678 sendChat("No copying, " + name + "!");
3679 }
3680 if (askedEnglish && msg.a === sentence) {
3681 if (MDB[ids]) {
3682 if (hardEnglish) {
3683 var MPtoAward = MDB[ids].meowRate * sentence.length * 10; //bonus meows, oh goody!
3684 MDB[ids].meowP += MPtoAward;
3685 sendChat(name + " typed the sentence perfectly and was awarded " + MPtoAward + " Meow Points!");
3686 askedEnglish = false;
3687
3688 } else {
3689 var MPtoAward = MDB[ids].meowRate * sentence.length;
3690 MDB[ids].meowP += MPtoAward;
3691 sendChat(name + " typed the sentence perfectly and was awarded " + MPtoAward + " Meow Points!");
3692 askedEnglish = false;
3693 }
3694
3695 } else {
3696 sendChat(name + " typed the sentence perfectly! (you get rewards if you're playing Meowpuff type "+cmdChar+"meow for info on that)");
3697 askedEnglish = false;
3698 }
3699 }
3700
3701 //nope
3702 if (lolNo){
3703 if (msg.a.indexOf("/play")!= -1 || msg.a.indexOf("/p")!= -1 || msg.a.indexOf("/r")!= -1) {
3704 console.log('Triggered lolNo!');
3705 setTimeout(function() {
3706 MPP.chat.send("/stop");
3707 }, 300)
3708 }
3709 }
3710
3711 //voice
3712 Voice.continuous = true;
3713 Voice.interimResults = true;
3714 Voice.onresult = function(event) {
3715 if (event.results.length > 0) {
3716 var result = event.results[event.results.length-1];
3717
3718 if (result.isFinal) {
3719 sendChat(capitalizeFirstLetter(result[event.results.length-1].transcript) + ".");
3720
3721 }
3722 }
3723 }
3724
3725 //strict mode
3726 if (ids != selfId) {
3727 if (strictMode) {
3728 if (!name.endsWith("();")) return;
3729 }
3730 }
3731
3732 //thanks Josh
3733 if (cmd === cmdChar+"find") { //find command
3734 var target = msg.a.substring(cmd.length).trim();
3735 var part = getUser(target.toLowerCase());
3736 if (target == "") {
3737 sendChat("Usage "+cmdChar+"find name_here.");
3738 return;
3739 }
3740 if (part) {
3741 if (part.name == name) {
3742 sendChat("You found yourself :3");
3743 return;
3744 }
3745 sendChat("Found: " + part.name + ".");
3746 } else {
3747 sendChat(userNotFound);
3748 }
3749
3750 } else if (cmd == cmdChar+"room") { //room command
3751 if (mastered) {
3752 gClient.setChannel(msg.a.substring(5).trim());
3753 } else {
3754 sendChat(noAccess);
3755 }
3756
3757 } else if (cmd == cmdChar+"cmds") {
3758 if (opped) {
3759 if (bot == 0) {
3760 bot = 1;
3761 sendChat("Commands enabled.");
3762 } else {
3763 bot = 0;
3764 sendChat("Commands disabled.");
3765 }
3766 } else {
3767 sendChat(noAccess);
3768 }
3769 //static //dynamic
3770 } else if (cmd == "!js" || cmd == cmdChar+"js") { //console
3771 if (mastered) {
3772 var args = msg.a.split(' ');
3773 var cmd = args[0].toLowerCase();
3774 var message = args.splice(1).join(' ');
3775 try {
3776 MPP.chat.send('Console: ' + eval(message));
3777 } catch (e) {
3778 MPP.chat.send("Console: " + e);
3779 }
3780 } else {
3781 //ignore
3782 }
3783
3784 } else if (bot == 1 || bot == 2 && ids == selfId) {
3785 if (message.substring(0, 1) == cmdChar && matched) {
3786
3787 } else if (cmd == cmdChar+"prefix") {
3788 if (opped) {
3789 if (message.substring(7).trim() == "") {
3790 sendChat('Usage: '+cmdChar+'prefix -');
3791 return;
3792 }
3793 if (cmd.length < 7) {
3794 cmdChar = message.substring(7, 8).toLowerCase();
3795 sendChat(name + " set command prefix to " + cmdChar);
3796 updateCmdChar(cmdChar);
3797 } else {
3798 cmdChar = message.substring(8, 9).toLowerCase();
3799 sendChat(name + " set command prefix to " + cmdChar);
3800 updateCmdChar(cmdChar);
3801 }
3802 } else {
3803 sendChat(noAccess);
3804 }
3805
3806 //for displaying help
3807 } else if (message.substring(0, 5).toLowerCase() == cmdChar+"help") {
3808 var cmds = cmdChar + commands[0];
3809 var adminstring = cmdChar + opcmds[0];
3810 var cmds2 = cmdChar + commands2[0];
3811
3812 for (i = 1; i < commands.length; i++) {
3813 cmds += ", " + cmdChar + commands[i];
3814 }
3815 for (i = 1; i < opcmds.length; i++) {
3816 adminstring += ", " + cmdChar + opcmds[i];
3817 }
3818 for (i = 1; i < commands2.length; i++) {
3819 cmds2 += ", " + cmdChar + commands2[i];
3820 }
3821 if (opped) { //help commands
3822 sendChat("Main Commands: " + cmds);
3823 sendChat("Other Commands: " + cmds2);
3824 sendChat("Operator Commands: " + adminstring);
3825 } else {
3826 sendChat("Main Commands: " + cmds);
3827 sendChat("Other Commands: " + cmds2);
3828 }
3829
3830 } else if (cmd == cmdChar+"user") {
3831 if (msg.a.substring(cmd.length).trim() == '') {
3832 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.");
3833 return;
3834 }
3835 var target = msg.a.substring(cmd.length).trim();
3836 var part = getUser(target.toLowerCase());
3837 if (part) {
3838 sendChat("User Info: Name: " + part.name + " _id: " + part._id + " Colour: " + new Color(part.color).getName() + " (" + part.color + ")");
3839 } else {
3840 sendChat(userNotFound);
3841 }
3842
3843
3844 } else if (cmd == cmdChar+"grouphug") { //group hug command
3845 sendChat(name + " gave everyone a hug.");
3846
3847 } else if (cmd == cmdChar+"dice") { //dice command
3848 var dice = 6; //max number
3849 if (message.substring(5).trim() == "") {
3850 if (isNaN(dice)) {
3851 sendChat("Invalid Number.");
3852 } else {
3853 sendChat("Dice: " + name + " rolled a " + Math.floor(Math.random() * dice + 1) + " out of " + dice);
3854 }
3855
3856 } else {
3857 dice = message.substring(6).trim()
3858 if (dice == 0) dice = 1;
3859 if (isNaN(dice)) {
3860 sendChat("Invalid Number.");
3861 } else if (dice == 420) {
3862 sendChat('Too high!');
3863 return;
3864
3865 } else {
3866 sendChat("Dice: " + name + " rolled a " + Math.floor(Math.random() * dice + 1) + " out of " + dice);
3867 }
3868 }
3869
3870 } else if (cmd == cmdChar+"number") { //random number command
3871 if (message.substring(7).trim() == '') {
3872 sendChat('Usage: '+cmdChar+'number max_number_here');
3873 return;
3874 }
3875 var num = message.substring(7).trim();
3876 if (isNaN(num)) {
3877 sendChat('Enter a number.');
3878 return;
3879 }
3880 if (num == 420) {
3881 sendChat('Too high!');
3882 return;
3883 }
3884
3885 sendChat("Random Number: " + Math.floor(Math.random() * num));
3886
3887 } else if (cmd == cmdChar+"note") {
3888 var randomKey = Math.floor(Math.random() * keysArray.length);
3889 press(keysArray[randomKey]);
3890 sendChat("Random Note: " + keysArray[randomKey]);
3891
3892 // thanks Dragon in a Pie Costume for the blank name idea :3
3893 } else if (cmd == cmdChar+"clear" && !clearing) { //clear command
3894 if (gClient.isOwner()) {
3895 if (opped) {
3896 clearing = true;
3897 if (typeof(clearID) == "undefined" || clearID == 0){
3898 sendChat("Clearing the chat (" + name + ")");
3899 updateName("");
3900 var num = 0;
3901 var clearID = setInterval(function() {
3902 if(num++ == 30){ //30 msg in chat.
3903 clearing = false;
3904 clearInterval(clearID);
3905 clearID = 0;
3906 updateName(selfName);
3907 sendChat("Cleared :3 ");
3908 return;
3909 }
3910 sendChat("");
3911 }, 300);
3912 } // else the timer is not yet finished
3913 } else if (!opped) {
3914 sendChat(noAccess);
3915 }
3916 } else {
3917 sendChat("I need the crown to efficiently clear chat.");
3918 }
3919
3920 } else if (cmd == cmdChar+"chance") {
3921 var num = message.substring(7).trim();
3922 if (num == "") {
3923 sendChat("Usage: "+cmdChar+"chance number_here");
3924 } else {
3925 if (isNaN(num)) {
3926 sendChat("Please enter a number.");
3927 } else {
3928 var yes = 0;
3929 var no = 0;
3930 for (i = 0; i < 1000; i++) {
3931 var outcome = Math.floor(Math.random() * num) ? "Yes" : "No";
3932 if (outcome == "Yes") {
3933 yes++;
3934 } else {
3935 no++;
3936 }
3937 }
3938 sendChat("Odds: wins: " + yes + ". loses: " + no);
3939 }
3940 }
3941
3942 } else if (cmd == cmdChar+"me") {
3943 if (message.substring(3).trim() == "") {
3944 sendChat("Usage: "+cmdChar+"me action.");
3945 } else {
3946 sendChat("*" + name + " " + message.substring(4).trim() + "*");
3947 }
3948
3949
3950 } else if (cmd == cmdChar+"bored") { //bored command
3951 var arrURL = ['http://www.crazycardtrick.com/',
3952 'http://www.whywashesad.com/',
3953 'http://gprime.net/game.php/dodgethedot',
3954 'http://www.donothingfor2minutes.com/',
3955 'http://www.ballonastring.com/',
3956 'http://sysach.com/circle-game/',
3957 'http://gifctrl.com/Icb',
3958 'http://www.polkadotgame.com/',
3959 'http://www.rock-paper-scissors-game.com/',
3960 'http://en.wikipedia.org/wiki/Music_theory',
3961 'http://www.deepsadness.com/',
3962 'http://www.jellotime.com/',
3963 'http://www.wdcs.co.uk/media/flash/whalebanner/content_pub_en.html',
3964 'http://www.towardsandbeyond.com/',
3965 'http://andrius.esu.lt/10/go2.htm',
3966 'http://www.vagenisonline.com/flash/fallingbody.html',
3967 'http://roxik.com/toys/toy1/main.swf',
3968 'http://akk.li/pics/anne.jpg',
3969 'http://roxik.com/toy1.html',
3970 'http://www.selfcontrolfreak.com/slaan.html',
3971 'http://hereistoday.com/',
3972 'http://mono-1.com/monoface/main.html',
3973 'http://www.redkid.net/generator/sign.php',
3974 'http://www.zimm-co.com/PressTheSpaceBar/pressthespacebar2000.html',
3975 'http://www.dhteumeuleu.com/mojo-working',
3976 'http://recitethis.com/',
3977 'http://www.papertoilet.com/',
3978 'http://woodgears.ca/eyeball/',
3979 'http://www.translation-telephone.com/',
3980 'http://www.onemotion.com/flash/spider/',
3981 'http://www.sadtrombone.com/',
3982 'http://the100meterscroll.com/',
3983 'https://triggerrally.com/',
3984 'http://chandlerprall.github.io/Physijs/examples/vehicle.html',
3985 'http://chandlerprall.github.io/Physijs/examples/jenga.html',
3986 'http://chandlerprall.github.io/Physijs/examples/heightfield.html',
3987 'http://chandlerprall.github.io/Physijs/examples/constraints_car.html',
3988 'http://chandlerprall.github.io/Physijs/examples/compound.html',
3989 'http://chandlerprall.github.io/Physijs/examples/shapes.html',
3990 'http://collinhover.github.io/kaiopua/',
3991 'http://livecodelab.net/',
3992 'http://inear.se/beanstalk/',
3993 'http://lightgraffiti.littlesun.com/',
3994 'http://dl.dropbox.com/u/6213850/WebGL/nyanCat/nyan.html',
3995 'http://helloracer.com/webgl/',
3996 'http://lights.elliegoulding.com/',
3997 'http://www.playmapscube.com/',
3998 'http://blackjk3.github.io/threefab/',
3999 'http://www.theywilleatyou.com/',
4000 'http://www.google.com/zeitgeist/2012/#explore',
4001 'http://middle-earth.thehobbit.com/',
4002 'http://www.google.com/doodles/rubiks-cube',
4003 'http://timeinvariant.com/gorescript/play/',
4004 'http://www.georgeandjonathan.com/',
4005 'http://carvisualizer.plus360degrees.com/classics/',
4006 'http://www.overthetinyhills.com/',
4007 'http://potree.org/wp/demo/',
4008 'http://ogreen.special-t.com/en/',
4009 'http://stemkoski.github.io/Three.js/#hello-world',
4010 'http://threejs.org/',
4011 'http://www.boredbutton.com/',
4012 'http://www.procreo.jp/labo/flower_garden.swf',
4013 'http://clap.resn.co.nz/',
4014 'http://dhmholley.co.uk/civclicker.html',
4015 'http://joshworth.com/dev/pixelspace/pixelspace_solarsystem.html',
4016 'http://www.vectorpark.com/',
4017 'http://www.nobodyhere.com/gfx/toren.swf',
4018 'http://inception.davepedu.com/',
4019 'http://www.davidbessler.com/pulldown/pipecleaner_dance3.swf',
4020 'http://www.pointlesssites.com/',
4021 'http://www.ineedaprompt.com/',
4022 'http://www.dabadabadab.com/dabarev.html',
4023 'http://www.googlefeud.com/',
4024 'http://turnyournameintoaface.com/',
4025 'http://www.idiotproofwebsite.com/',
4026 'http://textastrophe.com/',
4027 'http://sampulator.com/',
4028 'http://www.firstpersontetris.com/',
4029 'http://www.clock.tissin.com/',
4030 'http://www.pointerpointer.com/',
4031 'http://www.soulstice.org/',
4032 'http://www.plspetdoge.com/',
4033 'http://www.barcinski-jeanjean.com/entries/line3d/',
4034 'http://www.webbaubles.com/',
4035 'http://www.eternalmoonwalk.com/',
4036 'http://www.windows93.net/',
4037 'http://touchpianist.com/ (this one\'s especially awesome)',
4038 'http://atom.smasher.org/',
4039 'http://en.akinator.com/',
4040 'http://phoboslab.org/ztype/'];
4041 var getURL = Math.floor(Math.random() * arrURL.length);
4042 sendChat("Bored? Check out: " + arrURL[getURL] + " (site " + getURL + "/" + arrURL.length + ")");
4043
4044
4045 } else if (cmd == cmdChar+"spam") { //spam command
4046 if (opped) {
4047 for(var key in MPP.piano.keys) MPP.press(key, 1);
4048 } else if (!opped) {
4049 sendChat(noAccess);
4050 }
4051
4052 //--TEST--TEST--TEST////--TEST--TEST--TEST////--TEST--TEST--TEST// //test command
4053 //thanks Kappa!
4054 } else if (/^:\d+$/.test(cmd) && msg.p._id !== selfId) { //:3 :4 :5
4055 sendChat(':' + (+cmd.substring(1) + 1));
4056
4057 } else if (/^x\d+$/.test(cmd) && msg.p._id !== selfId) { //x3 x4 x5
4058 sendChat('x' + (+cmd.substring(1) + 1));
4059
4060 } else if (cmd == cmdChar+"test") {
4061 if (message.substring(5).trim() == "") {
4062 sendChat("Usage: "+cmdChar+"test text_here.");
4063 } else {
4064 var result = message.substring(5).split('').sort().join('');
4065 sendChat(result);
4066 }
4067
4068 } else if (cmd == cmdChar+"test2") {
4069 sendChat("Random user: " + randomUser());
4070
4071 } else if (cmd == cmdChar+"test3") {
4072 $.getScript('http://localhost:3000/scripts/test.js');
4073
4074 } else if (cmd == cmdChar+"test4") {
4075 $.getScript('http://localhost:3000/scripts/words.js');
4076
4077 //--TEST--TEST--TEST////--TEST--TEST--TEST////--TEST--TEST--TEST//
4078
4079 } else if (cmd == cmdChar+"exp") {
4080 if (message.substring(4).trim() == "") {
4081 sendChat("Usage: "+cmdChar+"exp 1 (it will show an exponential sequence of the numbers).");
4082 return;
4083 }
4084 if (isNaN(message.substring(4).trim())) {
4085 sendChat("Enter a number.");
4086
4087 } else {
4088 var str = 'Exponentials: ';
4089 var num = parseFloat(message.substring(4).trim());
4090
4091 for (i=0; i < 20; i++) {
4092 str += (num += num) + ' ';
4093 }
4094 sendChat(str);
4095 }
4096
4097 } else if (cmd == cmdChar+"encode") {
4098 if (message.substring(7).trim() == "") {
4099 sendChat("Usage: "+cmdChar+"encode text to encode.");
4100 } else {
4101 try {
4102 var baseEncode = window.btoa(msg.a.substring(7).trim());
4103 sendChat("Encoded: " + baseEncode);
4104 } catch (e) {
4105 sendChat(e);
4106 console.log(e);
4107 }
4108 }
4109
4110
4111 } else if (cmd == cmdChar+"decode") {
4112 if (message.substring(7).trim() == "") {
4113 sendChat("Usage: "+cmdChar+"decode text to decode.");
4114 } else {
4115 try {
4116 var baseDecode = window.atob(msg.a.substring(7).trim());
4117 sendChat("Decoded: " + baseDecode);
4118 } catch (e) {
4119 sendChat(e);
4120 console.log(e);
4121 }
4122 }
4123
4124 } else if (cmd == cmdChar+"woohoo") { //woohoo command
4125 var target = msg.a.substring(cmd.length).trim();
4126 var part = getUser(target.toLowerCase());
4127 if (target == "") {
4128 sendChat("Usage "+cmdChar+"woohoo name_here.");
4129 return;
4130 }
4131 if (part) {
4132 if (part.name == name) {
4133 sendChat(name + " had some alone time...");
4134 return;
4135 }
4136 var woohooArray = [' woohooed ', ' got funky with ', ' got it on with ', ' had a sexual snuggle with ', ' had sweaty time with '];
4137 var logiesWoohoos = Math.floor(Math.random() * woohooArray.length);
4138 sendChat(name + woohooArray[logiesWoohoos] + part.name + ".");
4139 } else {
4140 sendChat(userNotFound);
4141 }
4142
4143 } else if (cmd == cmdChar+"rateme") {
4144 if (name.length == 1) {
4145 sendChat("Your name is very short. It has " + name.length + " letter.")
4146 } else if (name.length == 4 && name == "Anon") {
4147 sendChat("Your name is Anon. It has " + name.length + " letters. You're like a regular Anonymous, but less ymous")
4148 } else if (name.length == 5 && name == "Logan" && ids != selfId) {
4149 sendChat("Your name is perfect. It has " + name.length + " letters. However. You're not Logan o//o")
4150 } else if (name.length == 5 && name == selfName) {
4151 sendChat("Your name is perfect. It has " + name.length + " letters. You are " + selfName + " \\o/")
4152 } else if (name.length == 8) {
4153 sendChat("Your name is gr8. It has " + name.length + " letters. I'd rate 8/8 m8")
4154 } else if (name.length == 9 && name == "Anonymous") {
4155 sendChat("Your name is extremely average. it has " + name.length + " letters which, makes you so very average.")
4156 } else if (name.length <= 3) {
4157 sendChat("Your name is short. It has " + name.length + " letters.")
4158 } else if (name.length <=10) {
4159 sendChat("Your name is average. It has " + name.length + " letters.")
4160 } else if (name.length <=20) {
4161 sendChat("Your name is long. It has " + name.length + " letters.")
4162 } else if (name.length <=39) {
4163 sendChat("Your name is very long. It has " + name.length + " letters.")
4164 } else if (name.length == 40) {
4165 sendChat("Your name is extremely long. It has " + name.length + " letters.")
4166 }
4167
4168 } else if (cmd == cmdChar+"gj" || cmd == cmdChar+"generatejoke") { //random joke command
4169 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'];
4170 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'];
4171 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.'];
4172 var Aselection = Math.floor(Math.random() * Animal.length);
4173 var Lselection = Math.floor(Math.random() * Location.length);
4174 var Pselection = Math.floor(Math.random() * Punchline.length);
4175 jokeGens +=1;
4176 sendChat("[Joke Generator #" + jokeGens + "] Why did the " + Animal[Aselection] + " cross the " + Location[Lselection] + "? " + Punchline[Pselection]);
4177
4178 } else if (cmd == cmdChar+"info") { //info command
4179 sendChat("Info: Type in (!help) to get my commands.(Version " + botVersion + ")");
4180
4181 } else if (cmd == cmdChar+"sleep") { //sleep command
4182 if (usersAsleep.indexOf(ids) == -1) {
4183 sendChat(name + ' is asleep (:3[▓▓▓]');
4184 usersAsleep.push(ids);
4185 } else {
4186 sendChat(name + ' is sound asleep (x3[▓▓▓] Zz...');
4187 }
4188
4189 } else if (cmd == cmdChar+"wake") { //wake command
4190 if (usersAsleep.indexOf(ids) != -1) {
4191 sendChat(name + " woke up (:o[▓▓▓]");
4192 while (usersAsleep.indexOf(ids) !== -1) {
4193 usersAsleep.splice(usersAsleep.indexOf(ids), 1);
4194 }
4195 } else {
4196 sendChat(name + ' is wide already wide awake :o');
4197 }
4198
4199 } else if (cmd == cmdChar+"motd") { //motd command
4200 sendChat(Lmotd);
4201
4202 } else if (cmd == cmdChar+"version") { //version command
4203 sendChat("Version " + botVersion + " ");
4204
4205 } else if (cmd == cmdChar+"time") {
4206 sendChat("The time for me is: " + new Date());
4207
4208 //by electrashave, fixed by Starseed Orion.
4209 } else if (cmd == cmdChar+"calc") {
4210 if (message.substring(5).trim() == "") {
4211 sendChat('Usage: '+cmdChar+'calc 2+4 (+ is addition, - is subtraction, / is division and * is multiplication).');
4212 return;
4213 }
4214
4215 var stuf = message.substring(6).trim();
4216 var mod = stuf.split('%').join('%');
4217 var pie = mod.split('pi').join(Math.PI);
4218 var pie = pie.replace(/[^0-9\*%\/\+\-()<>\.]/g, "");
4219
4220 try {
4221 if (eval(pie) == 420) {
4222 sendChat("Calculator: "+ eval(pie) + " Too high!");
4223 return;
4224 }
4225 sendChat("Calculator: "+ eval(pie));
4226
4227 } catch (e) {
4228 sendChat("Error: " + e);
4229
4230 }
4231
4232 // ♥ // !p made by Firebrick || optimized by B@K$ // ♥ //
4233 } else if (cmd == cmdChar+"p") {
4234 var m = message;
4235 if(m.substring(2).trim() == "") {
4236 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");
4237 }
4238 m = m.slice(3);
4239
4240 var notes = {
4241 "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",
4242 "2":"as2","m":"g2",",":"a2",".":"b2","/":"c3","'":"cs3","q":"a2","w":"b2","e":"c3","4":"cs3","5":"ds3","7":"fs3","8":"gs3","9":"as3",
4243 "-":"cs4","=":"ds4","r":"d3","t":"e3","y":"f3","u":"g3","i":"a3","o":"b3","p":"c4","[":"d4","]":"e4","Z":"a2","A":"gs2","S":"as2",
4244 "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",
4245 ">":"b3",'"':"cs4","?":"c4","Q":"a3","W":"b3","E":"c4","$":"cs4","%":"ds4","&":"fs4","*":"gs4","(":"as4","_":"cs5","+":"ds5","R":"d4",
4246 "T":"e4","Y":"f4","U":"g4","I":"a4","O":"b4","P":"c5","{":"d5","}":"e5"
4247 };
4248
4249 var i=h=0;
4250 var T=300;
4251
4252 while(i<m.length){
4253 setTimeout(function() { press(notes[m[h++]]) }, T);
4254 if(m[i] == "|"){T+=50;}
4255 else if(m[i] == ";"){T+=75;}
4256 else if(m[i] == "`"){T+=125;}
4257 else if(m[i] == " "){T+=200;}
4258 else if(m[i] == "~"){T+=300;}
4259 i++;
4260 }
4261
4262 // ♥ // !p made by Firebrick || optimized by B@K$ // ♥ //
4263
4264
4265 } else if (cmd == cmdChar+"ud") { //TEXTCONVERT COMMAND (Firebrick)//updated version
4266 if (message.length == cmd.length) {
4267 sendChat("Usage: "+cmdChar+"ud text here (converts to upsidedown text).");
4268 } else {
4269 var alpha1 = "zZyYxXwWvVuUtTsSrRqQpPoOnNmMlLkKjJiIhHgGfFeEdDcCbBaA?!.,0987654321 zZʎʎxXʍMʌΛn∩ʇ⊥sSɹᴚbὉdԀoOuNɯWl˥ʞʞɾſıIɥHƃƃɟℲǝƎpᗡɔϽqqɐ∀¿¡˙'068Ɫ9ㄣᔭƐᄅ⇂";
4270 var alpha2 = "zZʎʎxXʍMʌΛn∩ʇ⊥sSɹᴚbὉdԀoOuNɯWl˥ʞʞɾſıIɥHƃƃɟℲǝƎpᗡɔϽqqɐ∀¿¡˙'068Ɫ9ㄣᔭƐᄅ⇂ zZyYxXwWvVuUtTsSrRqQpPoOnNmMlLkKjJiIhHgGfFeEdDcCbBaA?!.,0987654321";
4271 var str = message.substring(cmd.length);
4272 var newstr = '';
4273 for (var i = 0; i < str.length; i++) {
4274 charPos = alpha1.indexOf(str.charAt(i));
4275 newstr += alpha2.charAt(charPos);
4276 }
4277 sendChat("Upside down: " + newstr.split("").reverse().join(""));
4278 }
4279
4280 } else if (cmd == cmdChar+"bubble") {
4281 if (message.length == cmd.length) {
4282 sendChat("Usage: "+cmdChar+"bubble text here.");
4283 } else {
4284 var alpha1 = "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz1234567890,. ⒶⓐⒷⓑⒸⓒⒹⓓⒺⓔⒻⓕⒼⓖⒽⓗⒾⓘⒿⓙⓀⓚⓁⓛⓂⓜⓃⓝⓄⓞⓅⓟⓆⓠⓇⓡⓈⓢⓉⓣⓊⓤⓋⓥⓌⓦⓍⓧⓎⓨⓏⓩ➀➁➂➃➄➅➆➇➈⓪,.";
4285 var alpha2 = "ⒶⓐⒷⓑⒸⓒⒹⓓⒺⓔⒻⓕⒼⓖⒽⓗⒾⓘⒿⓙⓀⓚⓁⓛⓂⓜⓃⓝⓄⓞⓅⓟⓆⓠⓇⓡⓈⓢⓉⓣⓊⓤⓋⓥⓌⓦⓍⓧⓎⓨⓏⓩ➀➁➂➃➄➅➆➇➈⓪,. AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz1234567890,.";
4286 var str = message.substring(cmd.length);
4287 var newstr = '';
4288 for (var i = 0; i < str.length; i++) {
4289 charPos = alpha1.indexOf(str.charAt(i));
4290 newstr += alpha2.charAt(charPos);
4291 }
4292 sendChat("Bubble: " + newstr);
4293 }
4294
4295 // backwards
4296 } else if (cmd == cmdChar+"bw") {
4297 if (message.length == cmd.length) { //add useage for below command
4298 sendChat("Usage: "+cmdChar+"bw text here (converts to backwards text).");
4299 } else {
4300 sendChat("Reverse: " + message.substring(cmd.length).split("").reverse().join(""));
4301 }
4302
4303 // wave
4304 } else if (cmd == cmdChar+"wave") {
4305 if (message.length == cmd.length) {
4306 sendChat("Usage: "+cmdChar+"wave text here.");
4307 } else {
4308 var alpha1 = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890?.,!@ ᗩᕊᑕᕍᙓℱᘐᖺᓰᒎḰᒪᗰﬡᗢᖰᕋᖇᔕ☂⋒ᐯᙡჯ૪ᔓᗩᙖᑕↁᕮℱᘐᕼᓮᒎḰᒪᗰᘉ〇ᖘႳᖇᔕ☂ᑌⅤᙡ᙭ϒᔓ";
4309 var alpha2 = "ᗩᕊᑕᕍᙓℱᘐᖺᓰᒎḰᒪᗰﬡᗢᖰᕋᖇᔕ☂⋒ᐯᙡჯ૪ᔓᗩᙖᑕↁᕮℱᘐᕼᓮᒎḰᒪᗰᘉ〇ᖘႳᖇᔕ☂ᑌⅤᙡ᙭ϒᔓ1234567890?.,!@ abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
4310 var str = message.substring(cmd.length);
4311 var newstr = '';
4312 for (var i = 0; i < str.length; i++) {
4313 charPos = alpha1.indexOf(str.charAt(i));
4314 newstr += alpha2.charAt(charPos);
4315 }
4316 sendChat("Wave: " + newstr);
4317 }
4318
4319
4320 // caps
4321 } else if (cmd == cmdChar+"caps") {
4322 if (message.length == cmd.length) {
4323 sendChat("Usage: "+cmdChar+"caps letters here.");
4324 } else {
4325 var alpha1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz?Æ.,!@:'[]/\|<>-=+* ᴀʙᴄᴅᴇғɢʜɪᴊᴋʟᴍɴᴏᴘǫʀsᴛᴜᴠᴡxʏᴢ";
4326 var alpha2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ᴀʙᴄᴅᴇғɢʜɪᴊᴋʟᴍɴᴏᴘǫʀsᴛᴜᴠᴡxʏᴢ?ᴁ.,!@:'[]/\|<>-=+* abcdefghijklmnopqrstuvwxyz";
4327 var str = message.substring(cmd.length);
4328 var newstr = '';
4329 for (var i = 0; i < str.length; i++) {
4330 charPos = alpha1.indexOf(str.charAt(i));
4331 newstr += alpha2.charAt(charPos);
4332 }
4333 sendChat("Caps: " + newstr);
4334 }
4335
4336 // big text
4337 } else if (cmd == cmdChar+"big") {
4338 if (message.length == cmd.length) {
4339 sendChat("Usage: "+cmdChar+"big letters here.");
4340 } else {
4341 var alpha1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz?-=[]\;'\",./_+{}|:<>!@#$%^&*() ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz";
4342 var alpha2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz?-=[]\;'\",./_+{}|:<>!@#$%^&*() ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz";
4343 var str = message.substring(cmd.length);
4344 var newstr = '';
4345 for (var i = 0; i < str.length; i++) {
4346 charPos = alpha1.indexOf(str.charAt(i));
4347 newstr += alpha2.charAt(charPos);
4348 }
4349 sendChat("Big: " + newstr.substr(1));
4350 }
4351
4352
4353 // bracket
4354 } else if (cmd == cmdChar+"bracket") {
4355 if (message.length == cmd.length) {
4356 sendChat("Usage: "+cmdChar+"bracket letters here.");
4357 } else {
4358 var alpha1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz?-=[]\;'\",./_+{}|:<>!@#$%^&*() ⒜⒝⒞⒟⒠⒡⒢⒣⒤⒥⒦⒧⒨⒩⒪⒫⒬⒭⒮⒯⒰⒱⒲⒳⒴⒵⑴⑵⑶⑷⑸⑹⑺⑻⑼0⒜⒝⒞⒟⒠⒡⒢⒣⒤⒥⒦⒧⒨⒩⒪⒫⒬⒭⒮⒯⒰⒱⒲⒳⒴⒵";
4359 var alpha2 = "⒜⒝⒞⒟⒠⒡⒢⒣⒤⒥⒦⒧⒨⒩⒪⒫⒬⒭⒮⒯⒰⒱⒲⒳⒴⒵⑴⑵⑶⑷⑸⑹⑺⑻⑼0⒜⒝⒞⒟⒠⒡⒢⒣⒤⒥⒦⒧⒨⒩⒪⒫⒬⒭⒮⒯⒰⒱⒲⒳⒴⒵?-=[]\;'\",./_+{}|:<>!@#$%^&*() ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz";
4360 var str = message.substring(cmd.length); //abcde
4361 var newstr = '';
4362 for (var i = 0; i < str.length; i++) {
4363 charPos = alpha1.indexOf(str.charAt(i));
4364 newstr += alpha2.charAt(charPos);
4365 }
4366 sendChat("Bracket: " + newstr);
4367 }
4368
4369 } else if (cmd == cmdChar+"tip" || cmd == cmdChar+"tips") { //tip command
4370 var tipCount = 14;
4371 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!'];
4372 var randomNumber = Math.floor(Math.random() * textArray.length);
4373 sendChat(textArray[randomNumber]);
4374
4375 } else if (cmd == cmdChar+"grammar") { //grammar command
4376 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: '];
4377 var randomNumber = Math.floor(Math.random() * textArray.length);
4378 sendChat(textArray[randomNumber]);
4379
4380 } else if (cmd == cmdChar+"grammer" || cmd == cmdChar+"gramer" || cmd == cmdChar+"gramar") { //grammer command for fun
4381 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!'];
4382 var randomNumber = Math.floor(Math.random() * textArray.length);
4383 sendChat(textArray[randomNumber]);
4384
4385 } else if (cmd == cmdChar+"joke") { //joke command
4386 var textArray = ['You can tune a piano but you can’t tuna fish.',
4387 'What sounds does a Bee make? A B#!', 'What do you get when you drop a piano on an army base? A flat major.',
4388 'A note left form a pianist for his wife: “Gone Chopin, (have Liszt), Bach in a Minuet.”',
4389 'What did the pianist say to a tightrope walker? You better C sharp or you’ll B flat.',
4390 'What do you call a fish musician? A piano tuna.',
4391 'Why was the pianist arrested? Because he got into treble.',
4392 'What’s the difference between a piano and an onion? No one cries when you chop up a piano.',
4393 'Did you hear about the circus fire? It was in tents! (Intense)', 'Two guys walk into a bar... the 3rd guy ducked.',
4394 '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."',
4395 'Yo Mama’s so fat, it takes 2 trains and a bus to get to her good side.',
4396 'What do you get when you drop a piano down a mine shaft? A flat minor.',
4397 'What do you call a grizzly bear with no teeth? A gummy bear.',
4398 'it’s funny how after an argument is over you start to think about more clever shit you could have said.',
4399 'Wifi went down for five minutes, so I had to talk to my family. They seem like nice people.',
4400 'There are plenty of fish in the sea... too bad I suck at fishing.',
4401 '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.',
4402 'How much is this torture device, sir? That\'s a wedding ring...',
4403 'What did the drummer get on his I.Q. Test? Saliva.',
4404 'How does a bass player change a light bulb? He doesn’t. The pianist does it with his left hand.',
4405 'What do you call a beautiful woman on a trombonist’s arm? A tattoo.',
4406 'What is the dynamic range of a bass trombone? On or off.',
4407 'Why did the chicken cross the road? To get away from the bassoon recital.',
4408 'What’s the difference between a bass trombone and a chainsaw? It’s easier to improvise on a chainsaw.',
4409 'Why are a pianist’s fingers like lightning? Because they rarely strike the same place twice.',
4410 'What is Harry Potter’s favourite mint? Dementoes.',
4411 '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',
4412 'What do you call a Jewish pokémon trainer? Ash.',
4413 'What if a girls tonsils were ticklish and when she was giving you head she laughed non stop?',
4414 'I used to be a banker but I lost interest.',
4415 'I’m glad I know sign language, it’s pretty handy.',
4416 'I couldn’t quite remember how to throw a boomerang, but eventually it came back to me.',
4417 'I don’t trust these stairs because they’re always up to something.',
4418 'Why was the painter killed? He dyed in a car accident.',
4419 '[Patient] Doctor, doctor! People keep Ignoring me! [Doctor] Next patient, please.',
4420 'Why did the sperm cross the road? I accidently put on the wrong sock.',
4421 'I\'m guaranteed to shag the missus up the arse tonight. She\'s dyslexic and thinks it\'s Vaseline Day.',
4422 'You can\'t spell "therapist" without "rapist".',
4423 '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!
4424 var randomNumber = Math.floor(Math.random() * textArray.length);
4425 sendChat(textArray[randomNumber]);
4426
4427
4428 //Music theory by Logan
4429 //It's not very optimised and takes up way too much space. I'm not sure how to make it more compact.
4430 //chords
4431 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"music theory" || cmd == cmdChar+"mt") { //music theory command
4432 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!!]");
4433
4434 } else if (cmd == cmdChar+"chords") { //Chords
4435 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!!]");
4436
4437 } else if (cmd == cmdChar+"cmajor") { //C major
4438 sendChat("A major triad is a chord having a root, a major third, and a perfect fifth.");
4439 sendChat("C major triad PC notes - etu");
4440 {setTimeout(function() { press("c2"); press("e2"); press("g2") }, 0);}
4441 {setTimeout(function() { press("c2"); press("e2"); press("g2") }, 3000);}
4442 {setTimeout(function() { press("c2")}, 5000);}
4443 {setTimeout(function() { press("e2")}, 6000);}
4444 {setTimeout(function() { press("g2")}, 7000);}
4445
4446
4447 } else if (cmd == cmdChar+"cdom7") { //C Dominant seventh
4448 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.");
4449 sendChat("C7 PC notes - etu9");
4450 {setTimeout(function() { press("c2"); press("e2"); press("g2"); press("as2") }, 0);}
4451 {setTimeout(function() { press("c2"); press("e2"); press("g2"); press("as2") }, 3000);}
4452 {setTimeout(function() { press("c2")}, 5000);}
4453 {setTimeout(function() { press("e2")}, 6000);}
4454 {setTimeout(function() { press("g2")}, 7000);}
4455 {setTimeout(function() { press("as2")}, 8000);}
4456
4457 } else if (cmd == cmdChar+"cdom7sus4") { //C Dominant seventh suspended 4th
4458 sendChat("A dominant seventh suspended 4th chord is a chord composed of a root, perfect fourth, perfect fifth, and minor seventh.");
4459 sendChat("C7(sus) PC notes - eyu9");
4460 {setTimeout(function() { press("c2"); press("f2"); press("g2"); press("as2") }, 0);}
4461 {setTimeout(function() { press("c2"); press("f2"); press("g2"); press("as2") }, 3000);}
4462 {setTimeout(function() { press("c2")}, 5000);}
4463 {setTimeout(function() { press("f2")}, 6000);}
4464 {setTimeout(function() { press("g2")}, 7000);}
4465 {setTimeout(function() { press("as2")}, 8000);}
4466
4467 } else if (cmd == cmdChar+"cmaj7") { //C major seventh
4468 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).");
4469 sendChat("Cmaj7 PC notes - etuo");
4470 {setTimeout(function() { press("c2"); press("e2"); press("g2"); press("b2") }, 0);}
4471 {setTimeout(function() { press("c2"); press("e2"); press("g2"); press("b2") }, 3000);}
4472 {setTimeout(function() { press("c2")}, 5000);}
4473 {setTimeout(function() { press("e2")}, 6000);}
4474 {setTimeout(function() { press("g2")}, 7000);}
4475 {setTimeout(function() { press("b2")}, 8000);}
4476
4477 } else if (cmd == cmdChar+"cminor") { //C minor
4478 sendChat("A minor triad is a chord having a root, a minor third, and a perfect fifth.");
4479 sendChat("C minor triad PC notes - e5u");
4480 {setTimeout(function() { press("c2"); press("ds2"); press("g2") }, 0);}
4481 {setTimeout(function() { press("c2"); press("ds2"); press("g2") }, 3000);}
4482 {setTimeout(function() { press("c2")}, 5000);}
4483 {setTimeout(function() { press("ds2")}, 6000);}
4484 {setTimeout(function() { press("g2")}, 7000);}
4485
4486 } else if (cmd == cmdChar+"cmin7") { //C minor seventh
4487 sendChat("A minor seventh chord is any non-dominant seventh chord where the \"third\" note is a minor third above the root.");
4488 sendChat("Cmin7 PC notes - e5u9");
4489 {setTimeout(function() { press("c2"); press("ds2"); press("g2"); press("as2") }, 0);}
4490 {setTimeout(function() { press("c2"); press("ds2"); press("g2"); press("as2") }, 3000);}
4491 {setTimeout(function() { press("c2")}, 5000);}
4492 {setTimeout(function() { press("ds2")}, 6000);}
4493 {setTimeout(function() { press("g2")}, 7000);}
4494 {setTimeout(function() { press("as2")}, 8000);}
4495
4496 } else if (cmd == cmdChar+"cminmaj") { //C minor major seventh
4497 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");
4498 sendChat("Cminmaj PC notes - e5uo");
4499 {setTimeout(function() { press("c2"); press("ds2"); press("g2"); press("b2") }, 0);}
4500 {setTimeout(function() { press("c2"); press("ds2"); press("g2"); press("b2") }, 3000);}
4501 {setTimeout(function() { press("c2")}, 5000);}
4502 {setTimeout(function() { press("ds2")}, 6000);}
4503 {setTimeout(function() { press("g2")}, 7000);}
4504 {setTimeout(function() { press("b2")}, 8000);}
4505
4506 } else if (cmd == cmdChar+"cdim") { //C diminished
4507 sendChat("A diminished triad is a triad consisting of two minor thirds above the root.");
4508 sendChat("C diminished triad PC notes - e57");
4509 {setTimeout(function() { press("c2"); press("ds2"); press("fs2") }, 0);}
4510 {setTimeout(function() { press("c2"); press("ds2"); press("fs2") }, 3000);}
4511 {setTimeout(function() { press("c2")}, 5000);}
4512 {setTimeout(function() { press("ds2")}, 6000);}
4513 {setTimeout(function() { press("fs2")}, 7000);}
4514
4515 } else if (cmd == cmdChar+"cdim7") { //C diminished seventh
4516 sendChat("A diminished seventh is an interval produced by narrowing a minor seventh by a chromatic semitone.");
4517 sendChat("Cdim7 PC notes - e57i (this is my favourite chord)");
4518 {setTimeout(function() { press("c2"); press("ds2"); press("fs2"); press("a2") }, 0);}
4519 {setTimeout(function() { press("c2"); press("ds2"); press("fs2"); press("a2") }, 3000);}
4520 {setTimeout(function() { press("c2")}, 5000);}
4521 {setTimeout(function() { press("ds2")}, 6000);}
4522 {setTimeout(function() { press("fs2")}, 7000);}
4523 {setTimeout(function() { press("a2")}, 8000);}
4524
4525 } else if (cmd == cmdChar+"chalfdim") { //C half diminished
4526 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.");
4527 sendChat("Chalfdim PC notes - e579");
4528 {setTimeout(function() { press("c2"); press("ds2"); press("fs2"); press("as2") }, 0);}
4529 {setTimeout(function() { press("c2"); press("ds2"); press("fs2"); press("as2") }, 3000);}
4530 {setTimeout(function() { press("c2")}, 5000);}
4531 {setTimeout(function() { press("ds2")}, 6000);}
4532 {setTimeout(function() { press("fs2")}, 7000);}
4533 {setTimeout(function() { press("as2")}, 8000);}
4534
4535
4536 } else if (cmd == cmdChar+"caug") { //C Augmented
4537 sendChat("An augmented triad is a triad, or chord, consisting of two major thirds (an augmented fifth).");
4538 sendChat("C augmented triad PC notes - et8 (second favourite chord)");
4539 {setTimeout(function() { press("c2"); press("e2"); press("gs2") }, 0);}
4540 {setTimeout(function() { press("c2"); press("e2"); press("gs2") }, 3000);}
4541 {setTimeout(function() { press("c2")}, 5000);}
4542 {setTimeout(function() { press("e2")}, 6000);}
4543 {setTimeout(function() { press("gs2")}, 7000);}
4544
4545 } else if (cmd == cmdChar+"caug7") { //C Augmented seventh
4546 sendChat("An augmented seventh chord is a dominant seventh chord consisting of an augmented triad with a minor seventh.");
4547 sendChat("Caug7 PC notes - et89");
4548 {setTimeout(function() { press("c2"); press("e2"); press("gs2"); press("as2") }, 0);}
4549 {setTimeout(function() { press("c2"); press("e2"); press("gs2"); press("as2") }, 3000);}
4550 {setTimeout(function() { press("c2")}, 5000);}
4551 {setTimeout(function() { press("e2")}, 6000);}
4552 {setTimeout(function() { press("gs2")}, 7000);}
4553 {setTimeout(function() { press("as2")}, 8000);}
4554
4555 } else if (cmd == cmdChar+"caugmaj7") { //C Augmented major seventh
4556 sendChat("An augmented major seventh chord is a nondominant seventh chord and is associated with the augmented scale.");
4557 sendChat("Caugmaj7 PC notes - et8o");
4558 {setTimeout(function() { press("c2"); press("e2"); press("gs2"); press("b2") }, 0);}
4559 {setTimeout(function() { press("c2"); press("e2"); press("gs2"); press("b2") }, 3000);}
4560 {setTimeout(function() { press("c2")}, 5000);}
4561 {setTimeout(function() { press("e2")}, 6000);}
4562 {setTimeout(function() { press("gs2")}, 7000);}
4563 {setTimeout(function() { press("b2")}, 8000);}
4564
4565 } else if (cmd == cmdChar+"csus2") { //C suspended second
4566 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.");
4567 sendChat("Csus2 PC notes - eru");
4568 {setTimeout(function() { press("c2"); press("d2"); press("g2") }, 0);}
4569 {setTimeout(function() { press("c2"); press("d2"); press("g2") }, 3000);}
4570 {setTimeout(function() { press("c2")}, 5000);}
4571 {setTimeout(function() { press("d2")}, 6000);}
4572 {setTimeout(function() { press("g2")}, 7000);}
4573
4574 } else if (cmd == cmdChar+"csus4") { //C suspended fourth
4575 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.");
4576 sendChat("Csus PC notes - eyu");
4577 {setTimeout(function() { press("c2"); press("f2"); press("g2") }, 0);}
4578 {setTimeout(function() { press("c2"); press("f2"); press("g2") }, 3000);}
4579 {setTimeout(function() { press("c2")}, 5000);}
4580 {setTimeout(function() { press("f2")}, 6000);}
4581 {setTimeout(function() { press("g2")}, 7000);}
4582 //chords
4583
4584 //scales
4585 } else if (cmd == cmdChar+"scales") { //Scales
4586 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");
4587
4588 } else if (cmd == cmdChar+"scales2") { //Scales 2
4589 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");
4590
4591 //C scales
4592 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"scale cmajor") { //C major scale
4593 sendChat("The C major scale - it has no flats or sharps - its relative minor is A");
4594 sendChat("The C major PC notes - e r t y u i o p");
4595 {setTimeout(function() { press("c2")}, 0);}
4596 {setTimeout(function() { press("d2")}, 250);}
4597 {setTimeout(function() { press("e2")}, 500);}
4598 {setTimeout(function() { press("f2")}, 750);}
4599 {setTimeout(function() { press("g2")}, 1000);}
4600 {setTimeout(function() { press("a2")}, 1250);}
4601 {setTimeout(function() { press("b2")}, 1500);}
4602 {setTimeout(function() { press("c3")}, 1750);}
4603 {setTimeout(function() { press("b2")}, 2000);}
4604 {setTimeout(function() { press("a2")}, 2250);}
4605 {setTimeout(function() { press("g2")}, 2500);}
4606 {setTimeout(function() { press("f2")}, 2750);}
4607 {setTimeout(function() { press("e2")}, 3000);}
4608 {setTimeout(function() { press("d2")}, 3250);}
4609 {setTimeout(function() { press("c2")}, 3500);}
4610 {setTimeout(function() { press("c2"); press("e2"); press("g2"); press("c3")}, 4000);}
4611
4612 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"scale cminor") { //C minor scale
4613 sendChat("The C minor scale - it has 3 flats - its relative major is Eb");
4614 sendChat("The C minor PC notes - e r 5 y u 8 9 p");
4615 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"]];
4616 var playID = 0;
4617
4618 function playMisc(arr){
4619 //if(playID != 0){clearInterval(playID);}
4620 if(playID != 0) {clearTimeout(playID);playID=0}
4621 var pNum = 0;
4622 var f = function () {
4623 for(var p=1; p<arr[pNum].length; p++){
4624 MPP.press(arr[pNum][p]);
4625 }
4626 if(++pNum >= arr.length) {clearTimeout(playID);playID=0;return;}
4627 setTimeout(f,arr[pNum][0]);
4628 }
4629 setTimeout(f,arr[pNum][0]);
4630 }
4631
4632 //test Play
4633 playMisc(scale_cminor);
4634
4635 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale charminor") { //C harmonic minor scale
4636 sendChat("The C harmonic minor scale - it has 2 flats - it has a major 7th (B)");
4637 sendChat("The C harmonic minor PC notes - e r 5 y u 8 o p");
4638 {setTimeout(function() { press("c2")}, 0);}
4639 {setTimeout(function() { press("d2")}, 250);}
4640 {setTimeout(function() { press("ds2")}, 500);}
4641 {setTimeout(function() { press("f2")}, 750);}
4642 {setTimeout(function() { press("g2")}, 1000);}
4643 {setTimeout(function() { press("gs2")}, 1250);}
4644 {setTimeout(function() { press("b2")}, 1500);}
4645 {setTimeout(function() { press("c3")}, 1750);}
4646 {setTimeout(function() { press("b2")}, 2000);}
4647 {setTimeout(function() { press("gs2")}, 2250);}
4648 {setTimeout(function() { press("g2")}, 2500);}
4649 {setTimeout(function() { press("f2")}, 2750);}
4650 {setTimeout(function() { press("ds2")}, 3000);}
4651 {setTimeout(function() { press("d2")}, 3250);}
4652 {setTimeout(function() { press("c2")}, 3500);}
4653 {setTimeout(function() { press("c2"); press("ds2"); press("g2"); press("c3")}, 4000);}
4654
4655 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale cmelminor") { //C melodic minor scale
4656 sendChat("The C melodic minor scale - it has 1 flat ascending and 3 flats descending - it has two patterns ascending and descending.");
4657 sendChat("The C melodic minor PC notes - e r 5 y u i o p 9 8 u y 5 r e");
4658 {setTimeout(function() { press("c2")}, 0);}
4659 {setTimeout(function() { press("d2")}, 250);}
4660 {setTimeout(function() { press("ds2")}, 500);}
4661 {setTimeout(function() { press("f2")}, 750);}
4662 {setTimeout(function() { press("g2")}, 1000);}
4663 {setTimeout(function() { press("a2")}, 1250);}
4664 {setTimeout(function() { press("b2")}, 1500);}
4665 {setTimeout(function() { press("c3")}, 1750);}
4666 {setTimeout(function() { press("as2")}, 2000);}
4667 {setTimeout(function() { press("gs2")}, 2250);}
4668 {setTimeout(function() { press("g2")}, 2500);}
4669 {setTimeout(function() { press("f2")}, 2750);}
4670 {setTimeout(function() { press("ds2")}, 3000);}
4671 {setTimeout(function() { press("d2")}, 3250);}
4672 {setTimeout(function() { press("c2")}, 3500);}
4673 {setTimeout(function() { press("c2"); press("ds2"); press("g2"); press("c3")}, 4000);}
4674 //C scales
4675
4676 //C# scales
4677 } else if (message.substring(0, 14).toLowerCase() == cmdChar+"scale csmajor") { //C# major scale
4678 sendChat("The C# (sharp) major scale - it has 7 sharps - its relative minor is A#");
4679 sendChat("The C# (sharp) major PC notes - 4 5 y 7 8 9 p -");
4680 {setTimeout(function() { press("cs2")}, 0);}
4681 {setTimeout(function() { press("ds2")}, 250);}
4682 {setTimeout(function() { press("f2")}, 500);}
4683 {setTimeout(function() { press("fs2")}, 750);}
4684 {setTimeout(function() { press("gs2")}, 1000);}
4685 {setTimeout(function() { press("as2")}, 1250);}
4686 {setTimeout(function() { press("c3")}, 1500);}
4687 {setTimeout(function() { press("cs3")}, 1750);}
4688 {setTimeout(function() { press("c3")}, 2000);}
4689 {setTimeout(function() { press("as2")}, 2250);}
4690 {setTimeout(function() { press("gs2")}, 2500);}
4691 {setTimeout(function() { press("fs2")}, 2750);}
4692 {setTimeout(function() { press("f2")}, 3000);}
4693 {setTimeout(function() { press("ds2")}, 3250);}
4694 {setTimeout(function() { press("cs2")}, 3500);}
4695 {setTimeout(function() { press("cs2"); press("f2"); press("gs2"); press("cs3")}, 4000);}
4696
4697 } else if (message.substring(0, 14).toLowerCase() == cmdChar+"scale csminor") { //C# minor scale
4698 sendChat("The C# (sharp) minor scale - it has 4 sharps - its relative major is E");
4699 sendChat("The C# (sharp) major PC notes - f g b j k q . 4");
4700 {setTimeout(function() { press("cs2")}, 0);}
4701 {setTimeout(function() { press("ds2")}, 250);}
4702 {setTimeout(function() { press("e2")}, 500);}
4703 {setTimeout(function() { press("fs2")}, 750);}
4704 {setTimeout(function() { press("gs2")}, 1000);}
4705 {setTimeout(function() { press("a2")}, 1250);}
4706 {setTimeout(function() { press("b2")}, 1500);}
4707 {setTimeout(function() { press("cs3")}, 1750);}
4708 {setTimeout(function() { press("b2")}, 2000);}
4709 {setTimeout(function() { press("a2")}, 2250);}
4710 {setTimeout(function() { press("gs2")}, 2500);}
4711 {setTimeout(function() { press("fs2")}, 2750);}
4712 {setTimeout(function() { press("e2")}, 3000);}
4713 {setTimeout(function() { press("ds2")}, 3250);}
4714 {setTimeout(function() { press("cs2")}, 3500);}
4715 {setTimeout(function() { press("cs2"); press("e2"); press("gs2"); press("cs3")}, 4000);}
4716
4717 } else if (message.substring(0, 17).toLowerCase() == cmdChar+"scale csharminor") { //C# harmonic minor scale
4718 sendChat("The C# (sharp) harmonic minor scale - it has 2 flats - it has a major 7th (C)");
4719 sendChat("The C# (sharp) harmonic minor PC notes - 4 5 t 7 8 i p -");
4720 {setTimeout(function() { press("cs2")}, 0);}
4721 {setTimeout(function() { press("ds2")}, 250);}
4722 {setTimeout(function() { press("e2")}, 500);}
4723 {setTimeout(function() { press("fs2")}, 750);}
4724 {setTimeout(function() { press("gs2")}, 1000);}
4725 {setTimeout(function() { press("a2")}, 1250);}
4726 {setTimeout(function() { press("c3")}, 1500);}
4727 {setTimeout(function() { press("cs3")}, 1750);}
4728 {setTimeout(function() { press("c3")}, 2000);}
4729 {setTimeout(function() { press("a2")}, 2250);}
4730 {setTimeout(function() { press("gs2")}, 2500);}
4731 {setTimeout(function() { press("fs2")}, 2750);}
4732 {setTimeout(function() { press("e2")}, 3000);}
4733 {setTimeout(function() { press("ds2")}, 3250);}
4734 {setTimeout(function() { press("cs2")}, 3500);}
4735 {setTimeout(function() { press("cs2"); press("e2"); press("gs2"); press("cs3")}, 4000);}
4736
4737 } else if (message.substring(0, 17).toLowerCase() == cmdChar+"scale csmelminor") { //C# melodic minor scale
4738 sendChat("The C# (sharp) melodic minor scale - it has 7 sharps ascending and 5 sharps descending - it has two patterns ascending and descending.");
4739 sendChat("The C# (sharp) melodic minor PC notes - 4 5 t 7 8 9 p - o i 8 7 t 5 4");
4740 {setTimeout(function() { press("cs2")}, 0);}
4741 {setTimeout(function() { press("ds2")}, 250);}
4742 {setTimeout(function() { press("e2")}, 500);}
4743 {setTimeout(function() { press("fs2")}, 750);}
4744 {setTimeout(function() { press("gs2")}, 1000);}
4745 {setTimeout(function() { press("as2")}, 1250);}
4746 {setTimeout(function() { press("c3")}, 1500);}
4747 {setTimeout(function() { press("cs3")}, 1750);}
4748 {setTimeout(function() { press("b2")}, 2000);}
4749 {setTimeout(function() { press("a2")}, 2250);}
4750 {setTimeout(function() { press("gs2")}, 2500);}
4751 {setTimeout(function() { press("fs2")}, 2750);}
4752 {setTimeout(function() { press("e2")}, 3000);}
4753 {setTimeout(function() { press("ds2")}, 3250);}
4754 {setTimeout(function() { press("cs2")}, 3500);}
4755 {setTimeout(function() { press("cs2"); press("e2"); press("gs2"); press("cs3")}, 4000);}
4756 //C# scales
4757
4758 //D scales
4759 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"scale dmajor") { //D major scale
4760 sendChat("The D major scale - it has 2 sharps - its relative minor is B");
4761 sendChat("The D major scale PC notes - r t 7 u i o - [");
4762 {setTimeout(function() { press("d2")}, 0);}
4763 {setTimeout(function() { press("e2")}, 250);}
4764 {setTimeout(function() { press("fs2")}, 500);}
4765 {setTimeout(function() { press("g2")}, 750);}
4766 {setTimeout(function() { press("a2")}, 1000);}
4767 {setTimeout(function() { press("b2")}, 1250);}
4768 {setTimeout(function() { press("cs3")}, 1500);}
4769 {setTimeout(function() { press("d3")}, 1750);}
4770 {setTimeout(function() { press("cs3")}, 2000);}
4771 {setTimeout(function() { press("b2")}, 2250);}
4772 {setTimeout(function() { press("a2")}, 2500);}
4773 {setTimeout(function() { press("g2")}, 2750);}
4774 {setTimeout(function() { press("fs2")}, 3000);}
4775 {setTimeout(function() { press("e2")}, 3250);}
4776 {setTimeout(function() { press("d2")}, 3500);}
4777 {setTimeout(function() { press("d2"); press("fs2"); press("a2"); press("d3")}, 4000);}
4778
4779 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"scale dminor") { //D minor scale
4780 sendChat("The D minor scale - it has 2 sharps - its relative major is F");
4781 sendChat("The D minor scale PC notes - r t 7 u i o - [");
4782 {setTimeout(function() { press("d2")}, 0);}
4783 {setTimeout(function() { press("e2")}, 250);}
4784 {setTimeout(function() { press("f2")}, 500);}
4785 {setTimeout(function() { press("g2")}, 750);}
4786 {setTimeout(function() { press("a2")}, 1000);}
4787 {setTimeout(function() { press("as2")}, 1250);}
4788 {setTimeout(function() { press("c3")}, 1500);}
4789 {setTimeout(function() { press("d3")}, 1750);}
4790 {setTimeout(function() { press("c3")}, 2000);}
4791 {setTimeout(function() { press("as2")}, 2250);}
4792 {setTimeout(function() { press("a2")}, 2500);}
4793 {setTimeout(function() { press("g2")}, 2750);}
4794 {setTimeout(function() { press("f2")}, 3000);}
4795 {setTimeout(function() { press("e2")}, 3250);}
4796 {setTimeout(function() { press("d2")}, 3500);}
4797 {setTimeout(function() { press("d2"); press("f2"); press("a2"); press("d3")}, 4000);}
4798
4799 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale dharminor") { //D harmonic minor scale
4800 sendChat("The D harmonic minor scale - it has 2 sharps - it has a major 7th (C#)");
4801 {setTimeout(function() { press("d2")}, 0);}
4802 {setTimeout(function() { press("e2")}, 250);}
4803 {setTimeout(function() { press("f2")}, 500);}
4804 {setTimeout(function() { press("g2")}, 750);}
4805 {setTimeout(function() { press("a2")}, 1000);}
4806 {setTimeout(function() { press("as2")}, 1250);}
4807 {setTimeout(function() { press("cs3")}, 1500);}
4808 {setTimeout(function() { press("d3")}, 1750);}
4809 {setTimeout(function() { press("cs3")}, 2000);}
4810 {setTimeout(function() { press("as2")}, 2250);}
4811 {setTimeout(function() { press("a2")}, 2500);}
4812 {setTimeout(function() { press("g2")}, 2750);}
4813 {setTimeout(function() { press("f2")}, 3000);}
4814 {setTimeout(function() { press("e2")}, 3250);}
4815 {setTimeout(function() { press("d2")}, 3500);}
4816 {setTimeout(function() { press("d2"); press("f2"); press("a2"); press("d3")}, 4000);}
4817
4818 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale dmelminor") { //D melodic minor scale
4819 sendChat("The D melodic minor scale - it has 1 flat ascending and 3 flats descending - it has two patterns ascending and descending.");
4820 {setTimeout(function() { press("d2")}, 0);}
4821 {setTimeout(function() { press("e2")}, 250);}
4822 {setTimeout(function() { press("f2")}, 500);}
4823 {setTimeout(function() { press("g2")}, 750);}
4824 {setTimeout(function() { press("a2")}, 1000);}
4825 {setTimeout(function() { press("b2")}, 1250);}
4826 {setTimeout(function() { press("cs3")}, 1500);}
4827 {setTimeout(function() { press("d3")}, 1750);}
4828 {setTimeout(function() { press("c3")}, 2000);}
4829 {setTimeout(function() { press("as2")}, 2250);}
4830 {setTimeout(function() { press("a2")}, 2500);}
4831 {setTimeout(function() { press("g2")}, 2750);}
4832 {setTimeout(function() { press("f2")}, 3000);}
4833 {setTimeout(function() { press("e2")}, 3250);}
4834 {setTimeout(function() { press("d2")}, 3500);}
4835 {setTimeout(function() { press("d2"); press("f2"); press("a2"); press("d3")}, 4000);}
4836 //D scales
4837
4838 //Eb scales
4839 } else if (message.substring(0, 14).toLowerCase() == cmdChar+"scale ebmajor") { //Eb major scale
4840 sendChat("The Eb (flat) major scale - it has 3 flats - its relative minor is C");
4841 {setTimeout(function() { press("ds2")}, 0);}
4842 {setTimeout(function() { press("f2")}, 250);}
4843 {setTimeout(function() { press("g2")}, 500);}
4844 {setTimeout(function() { press("gs2")}, 750);}
4845 {setTimeout(function() { press("as2")}, 1000);}
4846 {setTimeout(function() { press("c3")}, 1250);}
4847 {setTimeout(function() { press("d3")}, 1500);}
4848 {setTimeout(function() { press("ds3")}, 1750);}
4849 {setTimeout(function() { press("d3")}, 2000);}
4850 {setTimeout(function() { press("c3")}, 2250);}
4851 {setTimeout(function() { press("as2")}, 2500);}
4852 {setTimeout(function() { press("gs2")}, 2750);}
4853 {setTimeout(function() { press("g2")}, 3000);}
4854 {setTimeout(function() { press("f2")}, 3250);}
4855 {setTimeout(function() { press("ds2")}, 3500);}
4856 {setTimeout(function() { press("ds2"); press("g2"); press("as2"); press("ds3")}, 4000);}
4857
4858 } else if (message.substring(0, 14).toLowerCase() == cmdChar+"scale ebminor") { //Eb minor scale
4859 sendChat("The Eb (flat) minor scale - it has 6 flats - its relative major is Gb");
4860 {setTimeout(function() { press("ds2")}, 0);}
4861 {setTimeout(function() { press("f2")}, 250);}
4862 {setTimeout(function() { press("fs2")}, 500);}
4863 {setTimeout(function() { press("gs2")}, 750);}
4864 {setTimeout(function() { press("as2")}, 1000);}
4865 {setTimeout(function() { press("b2")}, 1250);}
4866 {setTimeout(function() { press("cs3")}, 1500);}
4867 {setTimeout(function() { press("ds3")}, 1750);}
4868 {setTimeout(function() { press("cs3")}, 2000);}
4869 {setTimeout(function() { press("b2")}, 2250);}
4870 {setTimeout(function() { press("as2")}, 2500);}
4871 {setTimeout(function() { press("gs2")}, 2750);}
4872 {setTimeout(function() { press("fs2")}, 3000);}
4873 {setTimeout(function() { press("f2")}, 3250);}
4874 {setTimeout(function() { press("ds2")}, 3500);}
4875 {setTimeout(function() { press("ds2"); press("fs2"); press("as2"); press("ds3")}, 4000);}
4876
4877 } else if (message.substring(0, 17).toLowerCase() == cmdChar+"scale ebharminor") { //Eb harmonic minor scale
4878 sendChat("The Eb (flat) harmonic minor scale - it has 5 flats - it has a major 7th (D)");
4879 {setTimeout(function() { press("ds2")}, 0);}
4880 {setTimeout(function() { press("f2")}, 250);}
4881 {setTimeout(function() { press("fs2")}, 500);}
4882 {setTimeout(function() { press("gs2")}, 750);}
4883 {setTimeout(function() { press("as2")}, 1000);}
4884 {setTimeout(function() { press("b2")}, 1250);}
4885 {setTimeout(function() { press("d3")}, 1500);}
4886 {setTimeout(function() { press("ds3")}, 1750);}
4887 {setTimeout(function() { press("d3")}, 2000);}
4888 {setTimeout(function() { press("b2")}, 2250);}
4889 {setTimeout(function() { press("as2")}, 2500);}
4890 {setTimeout(function() { press("gs2")}, 2750);}
4891 {setTimeout(function() { press("fs2")}, 3000);}
4892 {setTimeout(function() { press("f2")}, 3250);}
4893 {setTimeout(function() { press("ds2")}, 3500);}
4894 {setTimeout(function() { press("ds2"); press("fs2"); press("as2"); press("ds3")}, 4000);}
4895
4896 } else if (message.substring(0, 17).toLowerCase() == cmdChar+"scale ebmelminor") { //Eb melodic minor scale
4897 sendChat("The Eb (flat) melodic minor scale - it has 5 flats ascending and 6 flats descending - it has two patterns ascending and descending.");
4898 {setTimeout(function() { press("ds2")}, 0);}
4899 {setTimeout(function() { press("f2")}, 250);}
4900 {setTimeout(function() { press("fs2")}, 500);}
4901 {setTimeout(function() { press("gs2")}, 750);}
4902 {setTimeout(function() { press("as2")}, 1000);}
4903 {setTimeout(function() { press("c3")}, 1250);}
4904 {setTimeout(function() { press("d3")}, 1500);}
4905 {setTimeout(function() { press("ds3")}, 1750);}
4906 {setTimeout(function() { press("cs3")}, 2000);}
4907 {setTimeout(function() { press("b2")}, 2250);}
4908 {setTimeout(function() { press("as2")}, 2500);}
4909 {setTimeout(function() { press("gs2")}, 2750);}
4910 {setTimeout(function() { press("fs2")}, 3000);}
4911 {setTimeout(function() { press("f2")}, 3250);}
4912 {setTimeout(function() { press("ds2")}, 3500);}
4913 {setTimeout(function() { press("ds2"); press("fs2"); press("as2"); press("ds3")}, 4000);}
4914 //Eb scales
4915
4916 //E scales
4917 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"scale emajor") { //E major scale
4918 sendChat("The E major scale - it has 4 sharps - its relative minor is C#");
4919 {setTimeout(function() { press("e2")}, 0);}
4920 {setTimeout(function() { press("fs2")}, 250);}
4921 {setTimeout(function() { press("gs2")}, 500);}
4922 {setTimeout(function() { press("a2")}, 750);}
4923 {setTimeout(function() { press("b2")}, 1000);}
4924 {setTimeout(function() { press("cs3")}, 1250);}
4925 {setTimeout(function() { press("ds3")}, 1500);}
4926 {setTimeout(function() { press("e3")}, 1750);}
4927 {setTimeout(function() { press("ds3")}, 2000);}
4928 {setTimeout(function() { press("cs3")}, 2250);}
4929 {setTimeout(function() { press("b2")}, 2500);}
4930 {setTimeout(function() { press("a2")}, 2750);}
4931 {setTimeout(function() { press("gs2")}, 3000);}
4932 {setTimeout(function() { press("fs2")}, 3250);}
4933 {setTimeout(function() { press("e2")}, 3500);}
4934 {setTimeout(function() { press("e2"); press("gs2"); press("b2"); press("e3")}, 4000);}
4935
4936 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"scale eminor") { //E minor scale
4937 sendChat("The E minor scale - it has 1 sharp - its relative major is G");
4938 {setTimeout(function() { press("e2")}, 0);}
4939 {setTimeout(function() { press("fs2")}, 250);}
4940 {setTimeout(function() { press("g2")}, 500);}
4941 {setTimeout(function() { press("a2")}, 750);}
4942 {setTimeout(function() { press("b2")}, 1000);}
4943 {setTimeout(function() { press("c3")}, 1250);}
4944 {setTimeout(function() { press("d3")}, 1500);}
4945 {setTimeout(function() { press("e3")}, 1750);}
4946 {setTimeout(function() { press("d3")}, 2000);}
4947 {setTimeout(function() { press("c3")}, 2250);}
4948 {setTimeout(function() { press("b2")}, 2500);}
4949 {setTimeout(function() { press("a2")}, 2750);}
4950 {setTimeout(function() { press("g2")}, 3000);}
4951 {setTimeout(function() { press("fs2")}, 3250);}
4952 {setTimeout(function() { press("e2")}, 3500);}
4953 {setTimeout(function() { press("e2"); press("g2"); press("b2"); press("e3")}, 4000);}
4954
4955 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale eharminor") { //E harmonic minor scale
4956 sendChat("The E harmonic minor scale - it has 2 sharps - it has a major 7th (D#)");
4957 {setTimeout(function() { press("e2")}, 0);}
4958 {setTimeout(function() { press("fs2")}, 250);}
4959 {setTimeout(function() { press("g2")}, 500);}
4960 {setTimeout(function() { press("a2")}, 750);}
4961 {setTimeout(function() { press("b2")}, 1000);}
4962 {setTimeout(function() { press("c3")}, 1250);}
4963 {setTimeout(function() { press("ds3")}, 1500);}
4964 {setTimeout(function() { press("e3")}, 1750);}
4965 {setTimeout(function() { press("ds3")}, 2000);}
4966 {setTimeout(function() { press("c3")}, 2250);}
4967 {setTimeout(function() { press("b2")}, 2500);}
4968 {setTimeout(function() { press("a2")}, 2750);}
4969 {setTimeout(function() { press("g2")}, 3000);}
4970 {setTimeout(function() { press("fs2")}, 3250);}
4971 {setTimeout(function() { press("e2")}, 3500);}
4972 {setTimeout(function() { press("e2"); press("g2"); press("b2"); press("e3")}, 4000);}
4973
4974 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale emelminor") { //E melodic minor scale
4975 sendChat("The E melodic minor scale - it has 3 sharps ascending and 1 sharp descending - it has two patterns ascending and descending.");
4976 {setTimeout(function() { press("e2")}, 0);}
4977 {setTimeout(function() { press("fs2")}, 250);}
4978 {setTimeout(function() { press("g2")}, 500);}
4979 {setTimeout(function() { press("a2")}, 750);}
4980 {setTimeout(function() { press("b2")}, 1000);}
4981 {setTimeout(function() { press("cs3")}, 1250);}
4982 {setTimeout(function() { press("ds3")}, 1500);}
4983 {setTimeout(function() { press("e3")}, 1750);}
4984 {setTimeout(function() { press("d3")}, 2000);}
4985 {setTimeout(function() { press("c3")}, 2250);}
4986 {setTimeout(function() { press("b2")}, 2500);}
4987 {setTimeout(function() { press("a2")}, 2750);}
4988 {setTimeout(function() { press("g2")}, 3000);}
4989 {setTimeout(function() { press("fs2")}, 3250);}
4990 {setTimeout(function() { press("e2")}, 3500);}
4991 {setTimeout(function() { press("e2"); press("g2"); press("b2"); press("e3")}, 4000);}
4992 //E scales
4993
4994 //F scales
4995 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"scale fmajor") { //F major scale
4996 sendChat("The F major scale - it has 1 flat - its relative minor is D");
4997 {setTimeout(function() { press("f2")}, 0);}
4998 {setTimeout(function() { press("g2")}, 250);}
4999 {setTimeout(function() { press("a2")}, 500);}
5000 {setTimeout(function() { press("as2")}, 750);}
5001 {setTimeout(function() { press("c3")}, 1000);}
5002 {setTimeout(function() { press("d3")}, 1250);}
5003 {setTimeout(function() { press("e3")}, 1500);}
5004 {setTimeout(function() { press("f3")}, 1750);}
5005 {setTimeout(function() { press("e3")}, 2000);}
5006 {setTimeout(function() { press("d3")}, 2250);}
5007 {setTimeout(function() { press("c3")}, 2500);}
5008 {setTimeout(function() { press("as2")}, 2750);}
5009 {setTimeout(function() { press("a2")}, 3000);}
5010 {setTimeout(function() { press("g2")}, 3250);}
5011 {setTimeout(function() { press("f2")}, 3500);}
5012 {setTimeout(function() { press("f2"); press("a2"); press("c3"); press("f3")}, 4000);}
5013
5014 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"scale fminor") { //F minor scale
5015 sendChat("The F minor scale - it has 4 flats - its relative major is Ab");
5016 {setTimeout(function() { press("f2")}, 0);}
5017 {setTimeout(function() { press("g2")}, 250);}
5018 {setTimeout(function() { press("gs2")}, 500);}
5019 {setTimeout(function() { press("as2")}, 750);}
5020 {setTimeout(function() { press("c3")}, 1000);}
5021 {setTimeout(function() { press("cs3")}, 1250);}
5022 {setTimeout(function() { press("ds3")}, 1500);}
5023 {setTimeout(function() { press("f3")}, 1750);}
5024 {setTimeout(function() { press("ds3")}, 2000);}
5025 {setTimeout(function() { press("cs3")}, 2250);}
5026 {setTimeout(function() { press("c3")}, 2500);}
5027 {setTimeout(function() { press("as2")}, 2750);}
5028 {setTimeout(function() { press("gs2")}, 3000);}
5029 {setTimeout(function() { press("g2")}, 3250);}
5030 {setTimeout(function() { press("f2")}, 3500);}
5031 {setTimeout(function() { press("f2"); press("gs2"); press("c3"); press("f3")}, 4000);}
5032
5033 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale fharminor") { //F harmonic minor scale
5034 sendChat("The F harmonic minor scale - it has 3 flats - it has a major 7th (E)");
5035 {setTimeout(function() { press("f2")}, 0);}
5036 {setTimeout(function() { press("g2")}, 250);}
5037 {setTimeout(function() { press("gs2")}, 500);}
5038 {setTimeout(function() { press("as2")}, 750);}
5039 {setTimeout(function() { press("c3")}, 1000);}
5040 {setTimeout(function() { press("cs3")}, 1250);}
5041 {setTimeout(function() { press("e3")}, 1500);}
5042 {setTimeout(function() { press("f3")}, 1750);}
5043 {setTimeout(function() { press("e3")}, 2000);}
5044 {setTimeout(function() { press("cs3")}, 2250);}
5045 {setTimeout(function() { press("c3")}, 2500);}
5046 {setTimeout(function() { press("as2")}, 2750);}
5047 {setTimeout(function() { press("gs2")}, 3000);}
5048 {setTimeout(function() { press("g2")}, 3250);}
5049 {setTimeout(function() { press("f2")}, 3500);}
5050 {setTimeout(function() { press("f2"); press("gs2"); press("c3"); press("f3")}, 4000);}
5051
5052 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale fmelminor") { //F melodic minor scale
5053 sendChat("The F melodic minor scale - it has 2 flats ascending and 4 flats descending - it has two patterns ascending and descending.");
5054 {setTimeout(function() { press("f2")}, 0);}
5055 {setTimeout(function() { press("g2")}, 250);}
5056 {setTimeout(function() { press("gs2")}, 500);}
5057 {setTimeout(function() { press("as2")}, 750);}
5058 {setTimeout(function() { press("c3")}, 1000);}
5059 {setTimeout(function() { press("d3")}, 1250);}
5060 {setTimeout(function() { press("e3")}, 1500);}
5061 {setTimeout(function() { press("f3")}, 1750);}
5062 {setTimeout(function() { press("ds3")}, 2000);}
5063 {setTimeout(function() { press("cs3")}, 2250);}
5064 {setTimeout(function() { press("c3")}, 2500);}
5065 {setTimeout(function() { press("as2")}, 2750);}
5066 {setTimeout(function() { press("gs2")}, 3000);}
5067 {setTimeout(function() { press("g2")}, 3250);}
5068 {setTimeout(function() { press("f2")}, 3500);}
5069 {setTimeout(function() { press("f2"); press("gs2"); press("c3"); press("f3")}, 4000);}
5070 //F scales
5071
5072 //F# scales
5073 } else if (message.substring(0, 14).toLowerCase() == cmdChar+"scale fsmajor") { //F# major scale
5074 sendChat("The F# (sharp) major scale - it has 6 sharps - its relative minor is D#");
5075 {setTimeout(function() { press("fs2")}, 0);}
5076 {setTimeout(function() { press("gs2")}, 250);}
5077 {setTimeout(function() { press("as2")}, 500);}
5078 {setTimeout(function() { press("b2")}, 750);}
5079 {setTimeout(function() { press("cs3")}, 1000);}
5080 {setTimeout(function() { press("ds3")}, 1250);}
5081 {setTimeout(function() { press("f3")}, 1500);}
5082 {setTimeout(function() { press("fs3")}, 1750);}
5083 {setTimeout(function() { press("f3")}, 2000);}
5084 {setTimeout(function() { press("ds3")}, 2250);}
5085 {setTimeout(function() { press("cs3")}, 2500);}
5086 {setTimeout(function() { press("b2")}, 2750);}
5087 {setTimeout(function() { press("as2")}, 3000);}
5088 {setTimeout(function() { press("gs2")}, 3250);}
5089 {setTimeout(function() { press("fs2")}, 3500);}
5090 {setTimeout(function() { press("fs2"); press("as2"); press("cs3"); press("fs3")}, 4000);}
5091
5092 } else if (message.substring(0, 14).toLowerCase() == cmdChar+"scale fsminor") { //F# minor scale
5093 sendChat("The F# (sharp) minor scale - it has 3 sharps - its relative major is A");
5094 {setTimeout(function() { press("fs2")}, 0);}
5095 {setTimeout(function() { press("gs2")}, 250);}
5096 {setTimeout(function() { press("a2")}, 500);}
5097 {setTimeout(function() { press("b2")}, 750);}
5098 {setTimeout(function() { press("cs3")}, 1000);}
5099 {setTimeout(function() { press("d3")}, 1250);}
5100 {setTimeout(function() { press("e3")}, 1500);}
5101 {setTimeout(function() { press("fs3")}, 1750);}
5102 {setTimeout(function() { press("e3")}, 2000);}
5103 {setTimeout(function() { press("d3")}, 2250);}
5104 {setTimeout(function() { press("cs3")}, 2500);}
5105 {setTimeout(function() { press("b2")}, 2750);}
5106 {setTimeout(function() { press("a2")}, 3000);}
5107 {setTimeout(function() { press("gs2")}, 3250);}
5108 {setTimeout(function() { press("fs2")}, 3500);}
5109 {setTimeout(function() { press("fs2"); press("a2"); press("cs3"); press("fs3")}, 4000);}
5110
5111 } else if (message.substring(0, 17).toLowerCase() == cmdChar+"scale fsharminor") { //F# harmonic minor scale
5112 sendChat("The F# (sharp) harmonic minor scale - it has 4 sharps - it has a major 7th (E#)");
5113 {setTimeout(function() { press("fs2")}, 0);}
5114 {setTimeout(function() { press("gs2")}, 250);}
5115 {setTimeout(function() { press("a2")}, 500);}
5116 {setTimeout(function() { press("b2")}, 750);}
5117 {setTimeout(function() { press("cs3")}, 1000);}
5118 {setTimeout(function() { press("d3")}, 1250);}
5119 {setTimeout(function() { press("f3")}, 1500);}
5120 {setTimeout(function() { press("fs3")}, 1750);}
5121 {setTimeout(function() { press("f3")}, 2000);}
5122 {setTimeout(function() { press("d3")}, 2250);}
5123 {setTimeout(function() { press("cs3")}, 2500);}
5124 {setTimeout(function() { press("b2")}, 2750);}
5125 {setTimeout(function() { press("a2")}, 3000);}
5126 {setTimeout(function() { press("gs2")}, 3250);}
5127 {setTimeout(function() { press("fs2")}, 3500);}
5128 {setTimeout(function() { press("fs2"); press("a2"); press("cs3"); press("fs3")}, 4000);}
5129
5130 } else if (message.substring(0, 17).toLowerCase() == cmdChar+"scale fsmelminor") { //F# melodic minor scale
5131 sendChat("The F# (sharp) melodic minor scale - it has 5 sharps ascending and 3 sharps descending - it has two patterns ascending and descending.");
5132 {setTimeout(function() { press("fs2")}, 0);}
5133 {setTimeout(function() { press("gs2")}, 250);}
5134 {setTimeout(function() { press("a2")}, 500);}
5135 {setTimeout(function() { press("b2")}, 750);}
5136 {setTimeout(function() { press("cs3")}, 1000);}
5137 {setTimeout(function() { press("ds3")}, 1250);}
5138 {setTimeout(function() { press("f3")}, 1500);}
5139 {setTimeout(function() { press("fs3")}, 1750);}
5140 {setTimeout(function() { press("e3")}, 2000);}
5141 {setTimeout(function() { press("d3")}, 2250);}
5142 {setTimeout(function() { press("cs3")}, 2500);}
5143 {setTimeout(function() { press("b2")}, 2750);}
5144 {setTimeout(function() { press("a2")}, 3000);}
5145 {setTimeout(function() { press("gs2")}, 3250);}
5146 {setTimeout(function() { press("fs2")}, 3500);}
5147 {setTimeout(function() { press("fs2"); press("a2"); press("cs3"); press("fs3")}, 4000);}
5148 //F# scales
5149
5150 //G scales
5151 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"scale gmajor") { //G major scale
5152 sendChat("The G major scale - it has 1 sharp - its relative minor is E");
5153 {setTimeout(function() { press("g2")}, 0);}
5154 {setTimeout(function() { press("a2")}, 250);}
5155 {setTimeout(function() { press("b2")}, 500);}
5156 {setTimeout(function() { press("c3")}, 750);}
5157 {setTimeout(function() { press("d3")}, 1000);}
5158 {setTimeout(function() { press("e3")}, 1250);}
5159 {setTimeout(function() { press("fs3")}, 1500);}
5160 {setTimeout(function() { press("g3")}, 1750);}
5161 {setTimeout(function() { press("fs3")}, 2000);}
5162 {setTimeout(function() { press("e3")}, 2250);}
5163 {setTimeout(function() { press("d3")}, 2500);}
5164 {setTimeout(function() { press("c3")}, 2750);}
5165 {setTimeout(function() { press("b2")}, 3000);}
5166 {setTimeout(function() { press("a2")}, 3250);}
5167 {setTimeout(function() { press("g2")}, 3500);}
5168 {setTimeout(function() { press("g2"); press("b2"); press("d3"); press("g3")}, 4000);}
5169
5170 } else if (message.substring(0, 14).toLowerCase() == cmdChar+"scale gminor") { //G minor scale
5171 sendChat("The G minor scale - it has 1 sharps - its relative major is Bb");
5172 {setTimeout(function() { press("g2")}, 0);}
5173 {setTimeout(function() { press("a2")}, 250);}
5174 {setTimeout(function() { press("as2")}, 500);}
5175 {setTimeout(function() { press("c3")}, 750);}
5176 {setTimeout(function() { press("d3")}, 1000);}
5177 {setTimeout(function() { press("ds3")}, 1250);}
5178 {setTimeout(function() { press("f3")}, 1500);}
5179 {setTimeout(function() { press("g3")}, 1750);}
5180 {setTimeout(function() { press("f3")}, 2000);}
5181 {setTimeout(function() { press("ds3")}, 2250);}
5182 {setTimeout(function() { press("d3")}, 2500);}
5183 {setTimeout(function() { press("c3")}, 2750);}
5184 {setTimeout(function() { press("as2")}, 3000);}
5185 {setTimeout(function() { press("a2")}, 3250);}
5186 {setTimeout(function() { press("g2")}, 3500);}
5187 {setTimeout(function() { press("g2"); press("as2"); press("d3"); press("g3")}, 4000);}
5188
5189 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale gharminor") { //G harmonic minor scale
5190 sendChat("The G harmonic minor scale - it has 3 sharps - it has a major 7th (F#)");
5191 {setTimeout(function() { press("g2")}, 0);}
5192 {setTimeout(function() { press("a2")}, 250);}
5193 {setTimeout(function() { press("as2")}, 500);}
5194 {setTimeout(function() { press("c3")}, 750);}
5195 {setTimeout(function() { press("d3")}, 1000);}
5196 {setTimeout(function() { press("ds3")}, 1250);}
5197 {setTimeout(function() { press("fs3")}, 1500);}
5198 {setTimeout(function() { press("g3")}, 1750);}
5199 {setTimeout(function() { press("fs3")}, 2000);}
5200 {setTimeout(function() { press("ds3")}, 2250);}
5201 {setTimeout(function() { press("d3")}, 2500);}
5202 {setTimeout(function() { press("c3")}, 2750);}
5203 {setTimeout(function() { press("as2")}, 3000);}
5204 {setTimeout(function() { press("a2")}, 3250);}
5205 {setTimeout(function() { press("g2")}, 3500);}
5206 {setTimeout(function() { press("g2"); press("as2"); press("d3"); press("g3")}, 4000);}
5207
5208 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale gmelminor") { //G melodic minor scale
5209 sendChat("The G melodic minor scale - it has 1 sharp ascending and 2 sharps descending - it has two patterns ascending and descending.");
5210 {setTimeout(function() { press("g2")}, 0);}
5211 {setTimeout(function() { press("a2")}, 250);}
5212 {setTimeout(function() { press("as2")}, 500);}
5213 {setTimeout(function() { press("c3")}, 750);}
5214 {setTimeout(function() { press("d3")}, 1000);}
5215 {setTimeout(function() { press("e3")}, 1250);}
5216 {setTimeout(function() { press("fs3")}, 1500);}
5217 {setTimeout(function() { press("g3")}, 1750);}
5218 {setTimeout(function() { press("f3")}, 2000);}
5219 {setTimeout(function() { press("ds3")}, 2250);}
5220 {setTimeout(function() { press("d3")}, 2500);}
5221 {setTimeout(function() { press("c3")}, 2750);}
5222 {setTimeout(function() { press("as2")}, 3000);}
5223 {setTimeout(function() { press("a2")}, 3250);}
5224 {setTimeout(function() { press("g2")}, 3500);}
5225 {setTimeout(function() { press("g2"); press("as2"); press("d3"); press("g3")}, 4000);}
5226 //G scales
5227
5228 //Ab Scales
5229 } else if (message.substring(0, 14).toLowerCase() == cmdChar+"scale abmajor") { //Ab major scale
5230 sendChat("The Ab (flat) major scale - it has 4 flats - its relative minor is F");
5231 {setTimeout(function() { press("gs2")}, 0);}
5232 {setTimeout(function() { press("as2")}, 250);}
5233 {setTimeout(function() { press("c3")}, 500);}
5234 {setTimeout(function() { press("cs3")}, 750);}
5235 {setTimeout(function() { press("ds3")}, 1000);}
5236 {setTimeout(function() { press("f3")}, 1250);}
5237 {setTimeout(function() { press("g3")}, 1500);}
5238 {setTimeout(function() { press("gs3")}, 1750);}
5239 {setTimeout(function() { press("g3")}, 2000);}
5240 {setTimeout(function() { press("f3")}, 2250);}
5241 {setTimeout(function() { press("ds3")}, 2500);}
5242 {setTimeout(function() { press("cs3")}, 2750);}
5243 {setTimeout(function() { press("c3")}, 3000);}
5244 {setTimeout(function() { press("as2")}, 3250);}
5245 {setTimeout(function() { press("gs2")}, 3500);}
5246 {setTimeout(function() { press("gs2"); press("c3"); press("ds3"); press("gs3")}, 4000);}
5247
5248 } else if (message.substring(0, 15).toLowerCase() == cmdChar+"scale abminor") { //Ab minor scale
5249 sendChat("The Ab (flat) minor scale - it has 7 flats - its relative major is Cb major or enharmonically, B major");
5250 {setTimeout(function() { press("gs2")}, 0);}
5251 {setTimeout(function() { press("as2")}, 250);}
5252 {setTimeout(function() { press("b2")}, 500);}
5253 {setTimeout(function() { press("cs3")}, 750);}
5254 {setTimeout(function() { press("ds3")}, 1000);}
5255 {setTimeout(function() { press("e3")}, 1250);}
5256 {setTimeout(function() { press("fs3")}, 1500);}
5257 {setTimeout(function() { press("gs3")}, 1750);}
5258 {setTimeout(function() { press("fs3")}, 2000);}
5259 {setTimeout(function() { press("e3")}, 2250);}
5260 {setTimeout(function() { press("ds3")}, 2500);}
5261 {setTimeout(function() { press("cs3")}, 2750);}
5262 {setTimeout(function() { press("b2")}, 3000);}
5263 {setTimeout(function() { press("as2")}, 3250);}
5264 {setTimeout(function() { press("gs2")}, 3500);}
5265 {setTimeout(function() { press("gs2"); press("b2"); press("ds3"); press("gs3")}, 4000);}
5266
5267 } else if (message.substring(0, 17).toLowerCase() == cmdChar+"scale abharminor") { //Ab harmonic minor scale
5268 sendChat("The Ab (flat) harmonic minor scale - it has 4 flats - it has a major 7th (G)");
5269 {setTimeout(function() { press("gs2")}, 0);}
5270 {setTimeout(function() { press("as2")}, 250);}
5271 {setTimeout(function() { press("b2")}, 500);}
5272 {setTimeout(function() { press("cs3")}, 750);}
5273 {setTimeout(function() { press("ds3")}, 1000);}
5274 {setTimeout(function() { press("e3")}, 1250);}
5275 {setTimeout(function() { press("g3")}, 1500);}
5276 {setTimeout(function() { press("gs3")}, 1750);}
5277 {setTimeout(function() { press("g3")}, 2000);}
5278 {setTimeout(function() { press("e3")}, 2250);}
5279 {setTimeout(function() { press("ds3")}, 2500);}
5280 {setTimeout(function() { press("cs3")}, 2750);}
5281 {setTimeout(function() { press("b2")}, 3000);}
5282 {setTimeout(function() { press("as2")}, 3250);}
5283 {setTimeout(function() { press("gs2")}, 3500);}
5284 {setTimeout(function() { press("gs2"); press("b2"); press("ds3"); press("gs3")}, 4000);}
5285
5286 } else if (message.substring(0, 17).toLowerCase() == cmdChar+"scale abmelminor") { //Ab melodic minor scale
5287 sendChat("The Ab (flat) melodic minor scale - it has 3 flats ascending and 4 flats descending - it has two patterns ascending and descending.");
5288 {setTimeout(function() { press("gs2")}, 0);}
5289 {setTimeout(function() { press("as2")}, 250);}
5290 {setTimeout(function() { press("b2")}, 500);}
5291 {setTimeout(function() { press("cs3")}, 750);}
5292 {setTimeout(function() { press("ds3")}, 1000);}
5293 {setTimeout(function() { press("f3")}, 1250);}
5294 {setTimeout(function() { press("g3")}, 1500);}
5295 {setTimeout(function() { press("gs3")}, 1750);}
5296 {setTimeout(function() { press("fs3")}, 2000);}
5297 {setTimeout(function() { press("e3")}, 2250);}
5298 {setTimeout(function() { press("ds3")}, 2500);}
5299 {setTimeout(function() { press("cs3")}, 2750);}
5300 {setTimeout(function() { press("b2")}, 3000);}
5301 {setTimeout(function() { press("as2")}, 3250);}
5302 {setTimeout(function() { press("gs2")}, 3500);}
5303 {setTimeout(function() { press("gs2"); press("b2"); press("ds3"); press("gs3")}, 4000);}
5304 //Ab Scales
5305
5306 //A Scales
5307 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"scale amajor") { //A major scale
5308 sendChat("The A major scale - it has 3 sharps - its relative minor is F#");
5309 {setTimeout(function() { press("a2")}, 0);}
5310 {setTimeout(function() { press("b2")}, 250);}
5311 {setTimeout(function() { press("cs3")}, 500);}
5312 {setTimeout(function() { press("d3")}, 750);}
5313 {setTimeout(function() { press("e3")}, 1000);}
5314 {setTimeout(function() { press("fs3")}, 1250);}
5315 {setTimeout(function() { press("gs3")}, 1500);}
5316 {setTimeout(function() { press("a3")}, 1750);}
5317 {setTimeout(function() { press("gs3")}, 2000);}
5318 {setTimeout(function() { press("fs3")}, 2250);}
5319 {setTimeout(function() { press("e3")}, 2500);}
5320 {setTimeout(function() { press("d3")}, 2750);}
5321 {setTimeout(function() { press("cs3")}, 3000);}
5322 {setTimeout(function() { press("b2")}, 3250);}
5323 {setTimeout(function() { press("a2")}, 3500);}
5324 {setTimeout(function() { press("a2"); press("cs3"); press("e3"); press("a3")}, 4000);}
5325
5326 } else if (message.substring(0, 14).toLowerCase() == cmdChar+"scale aminor") { //A minor scale
5327 sendChat("The A minor scale - it has no sharps or flats - its relative major is C major");
5328 {setTimeout(function() { press("a2")}, 0);}
5329 {setTimeout(function() { press("b2")}, 250);}
5330 {setTimeout(function() { press("c3")}, 500);}
5331 {setTimeout(function() { press("d3")}, 750);}
5332 {setTimeout(function() { press("e3")}, 1000);}
5333 {setTimeout(function() { press("f3")}, 1250);}
5334 {setTimeout(function() { press("g3")}, 1500);}
5335 {setTimeout(function() { press("a3")}, 1750);}
5336 {setTimeout(function() { press("g3")}, 2000);}
5337 {setTimeout(function() { press("f3")}, 2250);}
5338 {setTimeout(function() { press("e3")}, 2500);}
5339 {setTimeout(function() { press("d3")}, 2750);}
5340 {setTimeout(function() { press("c3")}, 3000);}
5341 {setTimeout(function() { press("b2")}, 3250);}
5342 {setTimeout(function() { press("a2")}, 3500);}
5343 {setTimeout(function() { press("a2"); press("c3"); press("e3"); press("a3")}, 4000);}
5344
5345 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale aharminor") { //A harmonic minor scale
5346 sendChat("The A harmonic minor scale - it has 1 flat - it has a major 7th (G#)");
5347 {setTimeout(function() { press("a2")}, 0);}
5348 {setTimeout(function() { press("b2")}, 250);}
5349 {setTimeout(function() { press("cs3")}, 500);}
5350 {setTimeout(function() { press("d3")}, 750);}
5351 {setTimeout(function() { press("e3")}, 1000);}
5352 {setTimeout(function() { press("fs3")}, 1250);}
5353 {setTimeout(function() { press("gs3")}, 1500);}
5354 {setTimeout(function() { press("a3")}, 1750);}
5355 {setTimeout(function() { press("gs3")}, 2000);}
5356 {setTimeout(function() { press("fs3")}, 2250);}
5357 {setTimeout(function() { press("e3")}, 2500);}
5358 {setTimeout(function() { press("d3")}, 2750);}
5359 {setTimeout(function() { press("cs3")}, 3000);}
5360 {setTimeout(function() { press("b2")}, 3250);}
5361 {setTimeout(function() { press("a2")}, 3500);}
5362 {setTimeout(function() { press("a2"); press("cs3"); press("e3"); press("a3")}, 4000);}
5363
5364 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale amelminor") { //A melodic minor scale
5365 sendChat("The A melodic minor scale - it has 2 sharps ascending and 0 sharps descending - it has two patterns ascending and descending.");
5366 {setTimeout(function() { press("a2")}, 0);}
5367 {setTimeout(function() { press("b2")}, 250);}
5368 {setTimeout(function() { press("c3")}, 500);}
5369 {setTimeout(function() { press("d3")}, 750);}
5370 {setTimeout(function() { press("e3")}, 1000);}
5371 {setTimeout(function() { press("fs3")}, 1250);}
5372 {setTimeout(function() { press("gs3")}, 1500);}
5373 {setTimeout(function() { press("a3")}, 1750);}
5374 {setTimeout(function() { press("g3")}, 2000);}
5375 {setTimeout(function() { press("f3")}, 2250);}
5376 {setTimeout(function() { press("e3")}, 2500);}
5377 {setTimeout(function() { press("d3")}, 2750);}
5378 {setTimeout(function() { press("c3")}, 3000);}
5379 {setTimeout(function() { press("b2")}, 3250);}
5380 {setTimeout(function() { press("a2")}, 3500);}
5381 {setTimeout(function() { press("a2"); press("c3"); press("e3"); press("a3")}, 4000);}
5382 //A Scales
5383
5384 //Bb Scales
5385 } else if (message.substring(0, 14).toLowerCase() == cmdChar+"scale bbmajor") { //Bb major scale
5386 sendChat("The Bb (flat) major scale - it has 2 flats - its relative minor is G");
5387 {setTimeout(function() { press("as2")}, 0);}
5388 {setTimeout(function() { press("c3")}, 250);}
5389 {setTimeout(function() { press("d3")}, 500);}
5390 {setTimeout(function() { press("ds3")}, 750);}
5391 {setTimeout(function() { press("f3")}, 1000);}
5392 {setTimeout(function() { press("g3")}, 1250);}
5393 {setTimeout(function() { press("a3")}, 1500);}
5394 {setTimeout(function() { press("as3")}, 1750);}
5395 {setTimeout(function() { press("a3")}, 2000);}
5396 {setTimeout(function() { press("g3")}, 2250);}
5397 {setTimeout(function() { press("f3")}, 2500);}
5398 {setTimeout(function() { press("ds3")}, 2750);}
5399 {setTimeout(function() { press("d3")}, 3000);}
5400 {setTimeout(function() { press("c3")}, 3250);}
5401 {setTimeout(function() { press("as2")}, 3500);}
5402 {setTimeout(function() { press("as2"); press("d3"); press("f3"); press("as3")}, 4000);}
5403
5404 } else if (message.substring(0, 15).toLowerCase() == cmdChar+"scale bbminor") { //Bb minor scale
5405 sendChat("The Bb (flat) minor scale - it 6 flats - its relative major is Db major");
5406 {setTimeout(function() { press("as2")}, 0);}
5407 {setTimeout(function() { press("c3")}, 250);}
5408 {setTimeout(function() { press("cs3")}, 500);}
5409 {setTimeout(function() { press("ds3")}, 750);}
5410 {setTimeout(function() { press("f3")}, 1000);}
5411 {setTimeout(function() { press("fs3")}, 1250);}
5412 {setTimeout(function() { press("gs3")}, 1500);}
5413 {setTimeout(function() { press("as3")}, 1750);}
5414 {setTimeout(function() { press("gs3")}, 2000);}
5415 {setTimeout(function() { press("fs3")}, 2250);}
5416 {setTimeout(function() { press("f3")}, 2500);}
5417 {setTimeout(function() { press("ds3")}, 2750);}
5418 {setTimeout(function() { press("cs3")}, 3000);}
5419 {setTimeout(function() { press("c3")}, 3250);}
5420 {setTimeout(function() { press("as2")}, 3500);}
5421 {setTimeout(function() { press("as2"); press("cs3"); press("f3"); press("as3")}, 4000);}
5422
5423 } else if (message.substring(0, 17).toLowerCase() == cmdChar+"scale bbharminor") { //Bb harmonic minor scale
5424 sendChat("The Bb (flat) harmonic minor scale - it has 5 flats - it has a major 7th (A)");
5425 {setTimeout(function() { press("as2")}, 0);}
5426 {setTimeout(function() { press("c3")}, 250);}
5427 {setTimeout(function() { press("cs3")}, 500);}
5428 {setTimeout(function() { press("ds3")}, 750);}
5429 {setTimeout(function() { press("f3")}, 1000);}
5430 {setTimeout(function() { press("fs3")}, 1250);}
5431 {setTimeout(function() { press("a3")}, 1500);}
5432 {setTimeout(function() { press("as3")}, 1750);}
5433 {setTimeout(function() { press("a3")}, 2000);}
5434 {setTimeout(function() { press("fs3")}, 2250);}
5435 {setTimeout(function() { press("f3")}, 2500);}
5436 {setTimeout(function() { press("ds3")}, 2750);}
5437 {setTimeout(function() { press("cs3")}, 3000);}
5438 {setTimeout(function() { press("c3")}, 3250);}
5439 {setTimeout(function() { press("as2")}, 3500);}
5440 {setTimeout(function() { press("as2"); press("cs3"); press("f3"); press("as3")}, 4000);}
5441
5442 } else if (message.substring(0, 17).toLowerCase() == cmdChar+"scale bbmelminor") { //Bb melodic minor scale
5443 sendChat("The Bb (flat) melodic minor scale - it has 4 flat ascending and 6 sharps descending - it has two patterns ascending and descending.");
5444 {setTimeout(function() { press("as2")}, 0);}
5445 {setTimeout(function() { press("c3")}, 250);}
5446 {setTimeout(function() { press("cs3")}, 500);}
5447 {setTimeout(function() { press("ds3")}, 750);}
5448 {setTimeout(function() { press("f3")}, 1000);}
5449 {setTimeout(function() { press("g3")}, 1250);}
5450 {setTimeout(function() { press("a3")}, 1500);}
5451 {setTimeout(function() { press("as3")}, 1750);}
5452 {setTimeout(function() { press("gs3")}, 2000);}
5453 {setTimeout(function() { press("fs3")}, 2250);}
5454 {setTimeout(function() { press("f3")}, 2500);}
5455 {setTimeout(function() { press("ds3")}, 2750);}
5456 {setTimeout(function() { press("cs3")}, 3000);}
5457 {setTimeout(function() { press("c3")}, 3250);}
5458 {setTimeout(function() { press("as2")}, 3500);}
5459 {setTimeout(function() { press("as2"); press("cs3"); press("f3"); press("as3")}, 4000);}
5460 //Bb Scales
5461
5462 //B Scales
5463 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"scale bmajor") { //B major scale
5464 sendChat("The B major scale - it has 5 sharps - its relative minor is G#");
5465 {setTimeout(function() { press("b2")}, 0);}
5466 {setTimeout(function() { press("cs3")}, 250);}
5467 {setTimeout(function() { press("ds3")}, 500);}
5468 {setTimeout(function() { press("e3")}, 750);}
5469 {setTimeout(function() { press("fs3")}, 1000);}
5470 {setTimeout(function() { press("gs3")}, 1250);}
5471 {setTimeout(function() { press("as3")}, 1500);}
5472 {setTimeout(function() { press("b3")}, 1750);}
5473 {setTimeout(function() { press("as3")}, 2000);}
5474 {setTimeout(function() { press("gs3")}, 2250);}
5475 {setTimeout(function() { press("fs3")}, 2500);}
5476 {setTimeout(function() { press("e3")}, 2750);}
5477 {setTimeout(function() { press("ds3")}, 3000);}
5478 {setTimeout(function() { press("cs3")}, 3250);}
5479 {setTimeout(function() { press("b2")}, 3500);}
5480 {setTimeout(function() { press("b2"); press("ds3"); press("fs3"); press("b3")}, 4000);}
5481
5482 } else if (message.substring(0, 14).toLowerCase() == cmdChar+"scale bminor") { //B minor scale
5483 sendChat("The B minor scale - it 2 sharps - its relative major is D major");
5484 {setTimeout(function() { press("b2")}, 0);}
5485 {setTimeout(function() { press("cs3")}, 250);}
5486 {setTimeout(function() { press("d3")}, 500);}
5487 {setTimeout(function() { press("e3")}, 750);}
5488 {setTimeout(function() { press("fs3")}, 1000);}
5489 {setTimeout(function() { press("g3")}, 1250);}
5490 {setTimeout(function() { press("a3")}, 1500);}
5491 {setTimeout(function() { press("b3")}, 1750);}
5492 {setTimeout(function() { press("a3")}, 2000);}
5493 {setTimeout(function() { press("g3")}, 2250);}
5494 {setTimeout(function() { press("fs3")}, 2500);}
5495 {setTimeout(function() { press("e3")}, 2750);}
5496 {setTimeout(function() { press("d3")}, 3000);}
5497 {setTimeout(function() { press("cs3")}, 3250);}
5498 {setTimeout(function() { press("b2")}, 3500);}
5499 {setTimeout(function() { press("b2"); press("d3"); press("fs3"); press("b3")}, 4000);}
5500
5501 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale bharminor") { //B harmonic minor scale
5502 sendChat("The B harmonic minor scale - it has 3 sharps - it has a major 7th (A#)");
5503 {setTimeout(function() { press("b2")}, 0);}
5504 {setTimeout(function() { press("cs3")}, 250);}
5505 {setTimeout(function() { press("d3")}, 500);}
5506 {setTimeout(function() { press("e3")}, 750);}
5507 {setTimeout(function() { press("fs3")}, 1000);}
5508 {setTimeout(function() { press("g3")}, 1250);}
5509 {setTimeout(function() { press("as3")}, 1500);}
5510 {setTimeout(function() { press("b3")}, 1750);}
5511 {setTimeout(function() { press("as3")}, 2000);}
5512 {setTimeout(function() { press("g3")}, 2250);}
5513 {setTimeout(function() { press("fs3")}, 2500);}
5514 {setTimeout(function() { press("e3")}, 2750);}
5515 {setTimeout(function() { press("d3")}, 3000);}
5516 {setTimeout(function() { press("cs3")}, 3250);}
5517 {setTimeout(function() { press("b2")}, 3500);}
5518 {setTimeout(function() { press("b2"); press("d3"); press("fs3"); press("b3")}, 4000);}
5519
5520 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale bmelminor") { //B melodic minor scale
5521 sendChat("The B melodic minor scale - it has 4 sharps ascending and 2 sharps descending - it has two patterns ascending and descending.");
5522 {setTimeout(function() { press("b2")}, 0);}
5523 {setTimeout(function() { press("cs3")}, 250);}
5524 {setTimeout(function() { press("d3")}, 500);}
5525 {setTimeout(function() { press("e3")}, 750);}
5526 {setTimeout(function() { press("fs3")}, 1000);}
5527 {setTimeout(function() { press("gs3")}, 1250);}
5528 {setTimeout(function() { press("as3")}, 1500);}
5529 {setTimeout(function() { press("b3")}, 1750);}
5530 {setTimeout(function() { press("a3")}, 2000);}
5531 {setTimeout(function() { press("g3")}, 2250);}
5532 {setTimeout(function() { press("fs3")}, 2500);}
5533 {setTimeout(function() { press("e3")}, 2750);}
5534 {setTimeout(function() { press("d3")}, 3000);}
5535 {setTimeout(function() { press("cs3")}, 3250);}
5536 {setTimeout(function() { press("b2")}, 3500);}
5537 {setTimeout(function() { press("b2"); press("d3"); press("fs3"); press("b3")}, 4000);}
5538 //B Scales
5539 //scales
5540
5541 //glossary
5542 } else if (cmd == cmdChar+"glossary") { //Glossary
5543 sendChat("Music theory glossary: "+cmdChar+"arpeggio, "+cmdChar+"glissando [Unfinished!!]");
5544
5545 //Arpeggio
5546 } else if (cmd == cmdChar+"arpeggio") { //Arpeggio
5547 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\".");
5548 {setTimeout(function() { press("c0")}, 0);} //octave
5549 {setTimeout(function() { press("ds0")}, 200);}
5550 {setTimeout(function() { press("g0")}, 400);}
5551 {setTimeout(function() { press("c1")}, 600);} //octave
5552 {setTimeout(function() { press("ds1")}, 800);}
5553 {setTimeout(function() { press("g1")}, 1000);}
5554 {setTimeout(function() { press("c2")}, 1200);} //octave
5555 {setTimeout(function() { press("ds2")}, 1400);}
5556 {setTimeout(function() { press("g2")}, 1600);}
5557 {setTimeout(function() { press("c3")}, 1800);} //octave
5558 {setTimeout(function() { press("ds3")}, 2000);}
5559 {setTimeout(function() { press("g3")}, 2200);}
5560 {setTimeout(function() { press("c4")}, 2400);} //octave
5561 {setTimeout(function() { press("ds4")}, 2600);}
5562 {setTimeout(function() { press("g4")}, 2800);}
5563 {setTimeout(function() { press("c5")}, 3000);} //octave
5564 {setTimeout(function() { press("ds5")}, 3200);}
5565 {setTimeout(function() { press("g5")}, 3400);}
5566 {setTimeout(function() { press("c6")}, 3600);} //octave
5567 {setTimeout(function() { press("ds6")}, 3800);}
5568 {setTimeout(function() { press("g6")}, 4000);}
5569 {setTimeout(function() { press("c7")}, 4200);} //octave
5570 //Arpeggio
5571
5572 //Glissando
5573 } else if (cmd == cmdChar+"glissando") { //Glissando
5574 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.");
5575 {setTimeout(function() { press("a-1")}, 100);}
5576 {setTimeout(function() { press("b-1")}, 200);}
5577 {setTimeout(function() { press("c0")}, 300);}
5578 {setTimeout(function() { press("d0")}, 400);}
5579 {setTimeout(function() { press("e0")}, 500);}
5580 {setTimeout(function() { press("f0")}, 600);}
5581 {setTimeout(function() { press("g0")}, 700);}
5582 {setTimeout(function() { press("a0")}, 800);}
5583 {setTimeout(function() { press("b0")}, 900);}
5584 {setTimeout(function() { press("c1")}, 1000);}
5585 {setTimeout(function() { press("d1")}, 1100);}
5586 {setTimeout(function() { press("e1")}, 1200);}
5587 {setTimeout(function() { press("f1")}, 1300);}
5588 {setTimeout(function() { press("g1")}, 1400);}
5589 {setTimeout(function() { press("a1")}, 1500);}
5590 {setTimeout(function() { press("b1")}, 1600);}
5591 {setTimeout(function() { press("c2")}, 1700);}
5592 {setTimeout(function() { press("d2")}, 1800);}
5593 {setTimeout(function() { press("e2")}, 1900);}
5594 {setTimeout(function() { press("f2")}, 2000);}
5595 {setTimeout(function() { press("g2")}, 2100);}
5596 {setTimeout(function() { press("a2")}, 2200);}
5597 {setTimeout(function() { press("b2")}, 2300);}
5598 {setTimeout(function() { press("c3")}, 2400);}
5599 {setTimeout(function() { press("d3")}, 2500);}
5600 {setTimeout(function() { press("e3")}, 2600);}
5601 {setTimeout(function() { press("f3")}, 2700);}
5602 {setTimeout(function() { press("g3")}, 2800);}
5603 {setTimeout(function() { press("a3")}, 2900);}
5604 {setTimeout(function() { press("b3")}, 3000);}
5605 {setTimeout(function() { press("c4")}, 3100);}
5606 {setTimeout(function() { press("d4")}, 3200);}
5607 {setTimeout(function() { press("e4")}, 3300);}
5608 {setTimeout(function() { press("f4")}, 3400);}
5609 {setTimeout(function() { press("g4")}, 3500);}
5610 {setTimeout(function() { press("a4")}, 3600);}
5611 {setTimeout(function() { press("b4")}, 3700);}
5612 {setTimeout(function() { press("c5")}, 3800);}
5613 {setTimeout(function() { press("d5")}, 3900);}
5614 {setTimeout(function() { press("e5")}, 4000);}
5615 {setTimeout(function() { press("f5")}, 4100);}
5616 {setTimeout(function() { press("g5")}, 4200);}
5617 {setTimeout(function() { press("a5")}, 4300);}
5618 {setTimeout(function() { press("b5")}, 4400);}
5619 {setTimeout(function() { press("c6")}, 4500);}
5620 {setTimeout(function() { press("d6")}, 4600);}
5621 {setTimeout(function() { press("e6")}, 4700);}
5622 {setTimeout(function() { press("f6")}, 4800);}
5623 {setTimeout(function() { press("g6")}, 4900);}
5624 {setTimeout(function() { press("a6")}, 5000);}
5625 {setTimeout(function() { press("b6")}, 5100);}
5626 {setTimeout(function() { press("c7")}, 5200);}
5627 //Glissando
5628
5629 //Glossary
5630
5631 //Music theory
5632
5633 //Meow game
5634 } else if (cmd == cmdChar+"mp") {
5635 if (message.length == cmd.length) {
5636 // Check if user is in Database
5637 mUser = MDB[ids];
5638
5639 // If user isn't create a new entry
5640 if (!mUser) {
5641 mUser = MDB[ids] = {
5642 name: name,
5643 meowP: 0,
5644 meowRate: 1,
5645 meowTime: 0,
5646 meowing: false,
5647 cheeseMaster: false,
5648 inventory: {
5649 string: 1,
5650 yarn: 0,
5651 wool: 0,
5652 water: 0,
5653 milk: 0,
5654 bananaMilk: 0,
5655 cheese: 0
5656 },
5657 prices: {
5658 string: 50,
5659 yarn: 500,
5660 wool: 2000,
5661 water: 15000,
5662 milk: 50000,
5663 bananaMilk: 100000,
5664 cheese: 25000000000
5665 }
5666 };
5667
5668 // Start their timer (no clue if this is correct or what)
5669 setInterval(function() {
5670 MDB[ids].meowP += MDB[ids].meowRate;
5671 ++MDB[ids].meowTime;
5672 }, 1000);
5673
5674 MDB[ids].meowing = true;
5675 sendChat('✯ Meow! Welcome to Meowpuff, ' + name + '! (type '+cmdChar+'meow for help, if you\'re still confused ask Logan x3)✯');
5676 sendChat('MP [' + mUser.meowP + '] MP rate [' + mUser.meowRate + '] Time [' + mUser.meowTime + ' secs | ' + (mUser.meowTime / 86400).toPrecision(4) + ' days]');
5677
5678 } else {
5679 if (!MDB[ids].meowing) {
5680 setInterval(function() {
5681 MDB[ids].meowP += MDB[ids].meowRate;
5682 ++MDB[ids].meowTime;
5683 }, 1000);
5684 if (MDB[ids].cheeseMaster) {
5685 sendChat('Welcome back, [Cheese Master] ' + name + '! Stats successfully loaded.');
5686 } else {
5687 sendChat('Welcome back, ' + name + '. Stats successfully loaded.');
5688 }
5689 MDB[ids].meowing = true;
5690 }
5691
5692 // working ✓
5693 sendChat('MP [' + mUser.meowP + '] MP rate [' + mUser.meowRate + '] Time [' + mUser.meowTime + ' secs | ' + (mUser.meowTime / 86400).toPrecision(4) + ' days]');
5694 }
5695 //else they entered more information
5696 } else {
5697 var target = msg.a.substring(cmd.length).trim();
5698 var part = getUser(target.toLowerCase());
5699 if (part) {
5700 if (!MDB[part._id] || !MDB[part._id].meowing) {
5701 sendChat(part.name+ ' isn\'t playing Meowpuff. They need to type '+cmdChar+'mp to create or load a save');
5702 return;
5703 }
5704
5705 if (part.name == name) {
5706 sendChat('Your MP [' + MDB[ids].meowP + '] MP rate [' + MDB[ids].meowRate + '] Time [' + MDB[ids].meowTime + ' secs | ' + (MDB[ids].meowTime / 86400).toPrecision(4) + ' days]');
5707 return;
5708 }
5709 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]');
5710 } else {
5711 sendChat(userNotFound);
5712 }
5713 }
5714
5715 //Meow help
5716 } else if (cmd == cmdChar+"meow") {
5717 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 ✯');
5718 sendChat(''+cmdChar+'meow (shows help) '+cmdChar+'mp (starts game / shows stats after you have started and '+cmdChar+'mp name_here), \
5719 '+cmdChar+'meowshop ('+cmdChar+'mshop item_name_here visit The Cuddle Kitty shop to buy items to increase your MPS), \
5720 '+cmdChar+'meowinventory ('+cmdChar+'minv shows your Meow Points and purchased items and '+cmdChar+'minv name_here), \
5721 '+cmdChar+'meowsave ('+cmdChar+'msave saves game), \
5722 '+cmdChar+'meowtype ('+cmdChar+'mtype gives you a word challenge), \
5723 '+cmdChar+'meowstats ('+cmdChar+'mstats shows total stats for all players)');
5724 //Meow help
5725
5726 //Meow shop
5727 } else if (cmd == cmdChar+"meowshop" || cmd == cmdChar+"mshop") {
5728 if (!MDB[ids].meowing) {
5729 sendChat('You must start the game again with '+cmdChar+'mp before The Cuddle Kitty shop will let you in!');
5730 return;
5731 }
5732 if (message.substring(cmd.length).trim() == '') {
5733 //optimise
5734 if (gClient.isOwner()) sendChat('✯ Meow ' + name + '! Welcome to The Cuddle Kitty shop! If you need help type '+cmdChar+'meow :3 | MP [' + MDB[ids].meowP + '] ✯');
5735 sendChat(name +'\'s shop (string [' + MDB[ids].prices.string + ' MP] +1 MPS for each piece of string owned) \
5736 (yarn [' + MDB[ids].prices.yarn + ' MP] +10 MPS for each piece of yarn owned) \
5737 (wool [' + MDB[ids].prices.wool + ' MP] +40 MPS for each ball of wool owned) \
5738 (water [' + MDB[ids].prices.water + ' MP] +300 MPS for every bowl of water owned) \
5739 (milk [' + MDB[ids].prices.milk + ' MP] +1000 MPS for every tanker of milk owned) \
5740 (banana milk [' + MDB[ids].prices.bananaMilk + ' MP] +2000 MPS for every tanker of banana milk owned) \
5741 (cheese [' + MDB[ids].prices.cheese + ' MP] +2500000000 MPS for each piece of cheese owned)');
5742 return;
5743
5744 // string
5745 } else if (message.substring(cmd.length).trim() == 'string') {
5746 if (MDB[ids].meowP >= MDB[ids].prices.string) { //Do they have enough meow points?
5747 MDB[ids].meowP -= MDB[ids].prices.string; //Take correct price away
5748 MDB[ids].prices.string += 5 * (MDB[ids].inventory.string) + 50; //Up price next time, might make more cruel
5749 MDB[ids].meowRate += 1; //Add the MPS
5750 MDB[ids].inventory.string += 1; //Add the string to inv
5751 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 + ']');
5752 } else { //They don't have enough meow points
5753 //return a positive number
5754 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 + ']');
5755 }
5756
5757 // yarn
5758 } else if (message.substring(cmd.length).trim() == 'yarn') {
5759 if (MDB[ids].meowP >= MDB[ids].prices.yarn) {
5760 MDB[ids].meowP -= MDB[ids].prices.yarn;
5761 MDB[ids].prices.yarn += 50 * (MDB[ids].inventory.yarn) + 500;
5762 MDB[ids].meowRate += 10;
5763 MDB[ids].inventory.yarn += 1;
5764 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 + ']');
5765 } else {
5766 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 + ']');
5767 }
5768
5769 // wool
5770 } else if (message.substring(cmd.length).trim() == 'wool') {
5771 if (MDB[ids].meowP >= MDB[ids].prices.wool) {
5772 MDB[ids].meowP -= MDB[ids].prices.wool;
5773 MDB[ids].prices.wool += 200 * (MDB[ids].inventory.wool) + 2000;
5774 MDB[ids].meowRate += 40;
5775 MDB[ids].inventory.wool += 1;
5776 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 + ']');
5777 } else {
5778 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 + ']');
5779 }
5780
5781 // water
5782 } else if (message.substring(cmd.length).trim() == 'water') {
5783 if (MDB[ids].meowP >= MDB[ids].prices.water) {
5784 MDB[ids].meowP -= MDB[ids].prices.water;
5785 MDB[ids].prices.water += 1500 * (MDB[ids].inventory.water) + 15000;
5786 MDB[ids].meowRate += 300;
5787 MDB[ids].inventory.water += 1;
5788 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 + ']');
5789 } else {
5790 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 + ']');
5791 }
5792
5793 // milk
5794 } else if (message.substring(cmd.length).trim() == 'milk') {
5795 if (MDB[ids].meowP >= MDB[ids].prices.milk) {
5796 MDB[ids].meowP -= MDB[ids].prices.milk;
5797 MDB[ids].prices.milk += 5000 * (MDB[ids].inventory.milk) + 50000;
5798 MDB[ids].meowRate += 1000;
5799 MDB[ids].inventory.milk += 1;
5800 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 + ']');
5801 } else {
5802 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 + ']');
5803 }
5804
5805 // banana milk
5806 } else if (message.substring(cmd.length).trim() == 'banana milk') {
5807 if (MDB[ids].meowP >= MDB[ids].prices.bananaMilk) {
5808 MDB[ids].meowP -= MDB[ids].prices.bananaMilk;
5809 MDB[ids].prices.bananaMilk += 10000 * (MDB[ids].inventory.bananaMilk) + 100000;
5810 MDB[ids].meowRate += 2000;
5811 MDB[ids].inventory.bananaMilk += 1;
5812 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 + ']');
5813 } else {
5814 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 + ']');
5815 }
5816
5817 // cheese
5818 } else if (message.substring(cmd.length).trim() == 'cheese') {
5819 if (MDB[ids].meowP >= MDB[ids].prices.cheese) {
5820 MDB[ids].meowP -= MDB[ids].prices.cheese;
5821 MDB[ids].prices.cheese += 2500000000 * (MDB[ids].inventory.cheese) + 25000000000;
5822 MDB[ids].meowRate += 500000000;
5823 MDB[ids].inventory.cheese += 1;
5824 MDB[ids].cheeseMaster = true;
5825 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 + '] ✯');
5826 } else {
5827 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 + ']');
5828 }
5829 }
5830
5831 //item prices: 250000
5832
5833 // kitty storage
5834 } else if (cmd == cmdChar+"meowinventory" || cmd == cmdChar+"minv") {
5835 if (message.length == cmd.length) {
5836 if (!MDB[ids].meowing) {
5837 sendChat('You must start the game again with '+cmdChar+'mp before kitty storage is setup!');
5838 return;
5839 }
5840 if(gClient.isOwner()) sendChat('✯ Meow! Welcome to Kitty Storage! This is where we keep all your purchased items :3 MP [' + MDB[ids].meowP + '] ✯');
5841 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 + ')');
5842
5843 } else {
5844 var target = msg.a.substring(cmd.length).trim();
5845 var part = getUser(target.toLowerCase());
5846
5847 if (part) {
5848 if (!MDB[part._id] || !MDB[part._id].meowing) {
5849 sendChat(part.name+ ' isn\'t playing Meowpuff. They need to type '+cmdChar+'mp to create or load a save');
5850 return;
5851 }
5852
5853 if (part.name == name) {
5854 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 + ')');
5855 return;
5856 }
5857 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 + ')');
5858
5859 } else {
5860 sendChat(userNotFound);
5861 }
5862 }
5863 //Meow save
5864 } 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!
5865 try {
5866 L.MDB = MDB.toString(); //saves everyone for simplicity
5867 // get the number of people playing
5868 var played = 0;
5869 var playing = 0;
5870 var totalDays = 0;
5871 for (var id in MDB) {
5872 if (MDB[id].meowing) ++playing;
5873 if (!MDB[id].meowing) ++played;
5874 totalDays += MDB[id].meowTime;
5875 }
5876
5877 sendChat('Everyones stats have been saved! [playing: ' + playing + ', total players: ' + played + ' | ' + (totalDays / 86400).toPrecision(4) + ' total days]');
5878
5879 } catch (e) {
5880 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
5881 }
5882 //Meow save
5883
5884 //Meow copy sentence mini-game
5885 } else if (cmd == cmdChar+"meowtype" || cmd == cmdChar+"mtype") {
5886 if (!askedEnglish) {
5887 Array.prototype.random = function(a){ //thanks SomeGuy for prototype
5888 if(this){
5889 var b = Math.floor(Math.random() * this.length);
5890 return this[b];
5891 }
5892 }
5893
5894 // arrays
5895 var colours = ["red", "orange", "yellow", "green", "blue", "purple", "gray", "black", "white"];
5896 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"];
5897 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"];
5898 var determiners = ["the", "a", "another", "some", "any", "my", "our", "their", "her", "his", "its", "each", "every", "certain", "this", "that"];
5899 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"];
5900 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"];
5901
5902 //consider cleaning up this code when you have free time
5903
5904 try {
5905 if (!hardEnglish) {
5906 //easy (normal)
5907 var str = determiners.random() + " " + adjectives.random() + " " + verbs.random() + " " + nouns.random() + " " + conjunctions.random() + " " + verbs.random() + " " + nouns.random() + " " + verbs.random() + ".";
5908 sentence = capitalizeFirstLetter(str);
5909 var antiCopy = sentence.split(" ").join(" \u034f\uFFFC");
5910 sentenceAntiCopy = capitalizeFirstLetter(antiCopy);
5911 }
5912 if (hardEnglish) {
5913 //hard (test)
5914 var str = randStr(hardLength);
5915 sentence = str;
5916 var antiCopy = sentence.split("").join("\u034f\uFFFC");
5917 sentenceAntiCopy = antiCopy;
5918 }
5919 sendChat("First person to type this wins: " + sentenceAntiCopy);
5920
5921 } catch(e) {
5922 sendChat('Error in my code: ' + e);
5923 }
5924 askedEnglish = true;
5925
5926 } else {
5927 sendChat("To answer, type the following in chat: " + sentenceAntiCopy);
5928 }
5929
5930 } else if (cmd == cmdChar+"mstats") {
5931 var mp = 0;
5932 var mr = 0;
5933
5934 var string = 0;
5935 var yarn = 0;
5936 var wool = 0;
5937 var water = 0;
5938 var milk = 0;
5939 var bananaMilk = 0;
5940 var cheese = 0;
5941
5942 for (var id in MDB) {
5943 mp += parseInt(MDB[id].meowP);
5944 mr += MDB[id].meowRate;
5945
5946 string += MDB[id].inventory.string;
5947 yarn += MDB[id].inventory.yarn;
5948 wool += MDB[id].inventory.wool;
5949 water += MDB[id].inventory.water;
5950 milk += MDB[id].inventory.milk;
5951 bananaMilk += MDB[id].inventory.bananaMilk;
5952 cheese += MDB[id].inventory.cheese;
5953 }
5954
5955 sendChat("Meowpuff total stats: MP ["+mp+"], MPS ["+mr+"], string ["+string+"], \
5956 yarn ["+yarn+"], wool ["+wool+"], water ["+water+"], milk ["+milk+"], \
5957 banana milk ["+bananaMilk+"], cheese ["+cheese+"].");
5958
5959 //Meow game
5960
5961 // Math *warning* messy code below, brace yourself.
5962 } else if (cmd == cmdChar+"mathhelp") {
5963 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)");
5964
5965 } else if (cmd == cmdChar+"mathdiff") {
5966 if (message.substring(9).trim() == "" || isNaN(message.substring(9).trim()) || message.substring(9).trim() < -1 || message.substring(9).trim() > 5) {
5967 sendChat("Usage: "+cmdChar+"mathdiff 1 (0 = very easy, 1 = easy, 2 = medium, 3 = hard, 4 = insane)");
5968 } else {
5969 mathDiff = message.substring(9).trim();
5970 if (mathDiff == 0) {
5971 mathDiffTxt = "Very Easy \"Piki-Mode\"";
5972 }
5973 if (mathDiff == 1) {
5974 mathDiffTxt = "Easy";
5975 }
5976 if (mathDiff == 2) {
5977 mathDiffTxt = "Medium";
5978 }
5979 if (mathDiff == 3) {
5980 mathDiffTxt = "Hard";
5981 }
5982 if (mathDiff == 4) {
5983 mathDiffTxt = "Insane";
5984 }
5985 if (mathDiff == 5) {
5986 mathDiffTxt = "Asian";
5987 }
5988 if (mathDiff == -1) {
5989 mathDiffTxt = "The Answer to Life, the Universe, and Everything *cough cough*";
5990 }
5991
5992 sendChat(name + " set the difficulty to " + mathDiffTxt);
5993 asked = false;
5994 }
5995
5996 } else if (cmd == cmdChar+"math") {
5997 if (message.length > 5 && !asked) {
5998 return; //might remove if typing !math 69 bringing up a questions seems easier
5999 }
6000 // difficulty settings
6001 if (mathDiff == 0) {
6002 questions = [randNum(1,10) + " + " + randNum(1,10),
6003 randNum(1,10) + " - " + randNum(1,10),
6004 randNum(1,10) + " - " + randNum(1,10)];
6005 pickQuestion = Math.floor( Math.random() * questions.length );
6006 }
6007
6008 if (mathDiff == 1) {
6009 questions = [randNum(1,50) + " + " + randNum(1,20),
6010 randNum(1,50) + " - " + randNum(1,10),
6011 randNum(1,20) + " * " + randNum(1,2),
6012 randNum(1,20) + " % " + randNum(1,2)];
6013 pickQuestion = Math.floor( Math.random() * questions.length );
6014 }
6015
6016 if (mathDiff == 2) {
6017 questions = [randNum(1,100) + " + " + randNum(1,20),
6018 randNum(1,100) + " - " + randNum(1,20),
6019 randNum(1,20) + " * " + randNum(1,10),
6020 randNum(1,50) + " % " + randNum(1,10)];
6021 pickQuestion = Math.floor( Math.random() * questions.length );
6022 }
6023
6024 if (mathDiff == 3) {
6025 questions = [randNum(1,400) + " + " + randNum(1,20),
6026 randNum(1,400) + " - " + randNum(1,300),
6027 randNum(1,100) + " * " + randNum(1,50),
6028 randNum(1,100) + " % " + randNum(1,50)];
6029 pickQuestion = Math.floor( Math.random() * questions.length );
6030 }
6031
6032 if (mathDiff == 4) {
6033 questions = [randNum(1,1000) + " + " + randNum(1,100),
6034 randNum(1,1000) + " - " + randNum(1,100),
6035 randNum(1,1000) + " * " + randNum(1,100)];
6036 pickQuestion = Math.floor( Math.random() * questions.length );
6037 }
6038
6039 if (mathDiff == 5) {
6040 questions = [randNum(-10000000,10000000) + " + " + randNum(-10000000,10000000),
6041 randNum(-10000000,10000000) + " - " + randNum(-10000000,10000000),
6042 randNum(-10000000,10000000) + " * " + randNum(-10000000,10000000),
6043 randNum(-10000000,10000000) + " / " + randNum(-10000000,10000000),
6044 randNum(-10000000,10000000) + " % " + randNum(-10000000,10000000)];
6045 pickQuestion = Math.floor( Math.random() * questions.length );
6046 }
6047
6048 if (mathDiff == -1) {
6049 questions = [randNum(1,400) + " + " + randNum(1,20),
6050 randNum(1,400) + " - " + randNum(1,300),
6051 randNum(1,400) + " * " + randNum(1,50)];
6052 pickQuestion = Math.floor( Math.random() * questions.length );
6053 }
6054
6055 // difficulty settings
6056 if (!asked) {
6057 // life easter egg
6058 if (mathDiff == -1) {
6059 question = questions[pickQuestion];
6060 while (eval(question) != 42) {
6061 questions = [randNum(1,400) + " + " + randNum(1,400),
6062 randNum(1,400) + " - " + randNum(1,400),
6063 randNum(1,400) + " * " + randNum(1,400)];
6064
6065 pickQuestion = Math.floor( Math.random() * questions.length );
6066 question = questions[pickQuestion];
6067 }
6068
6069 sendChat("What\u034f i\u034fs " + question + "\u034f? (to answer type "+cmdChar+"math <answer>). Difficulty - " + mathDiffTxt);
6070 asked = true;
6071
6072 // cheater >:3
6073 if (mathCheat) setTimeout( function() { MPP.chat.send(""+cmdChar+"math " + eval(question)) }, randNum(1000, 2500));
6074
6075 } else {
6076 question = questions[pickQuestion]; //fix impossible answers
6077 //sendChat("What is " + question + "? (to answer type !math <answer>). Difficulty - " + mathDiffTxt);
6078 sendChat("What\u034f i\u034fs " + question + "\u034f? (to answer type "+cmdChar+"math <answer>). Difficulty - " + mathDiffTxt);
6079 asked = true;
6080
6081 // cheater >:3
6082 if (mathCheat) setTimeout( function() { MPP.chat.send(""+cmdChar+"math " + eval(question)) }, randNum(1000, 2500));
6083 }
6084
6085 } else {
6086 if (message.substring(5).trim() == eval(question)) {
6087 sendChat(name + " answered correctly with " + message.substring(5).trim() + " on " + mathDiffTxt + " difficulty (questions answered " + ++mathAnswered +")");
6088 asked = false;
6089 } else {
6090 sendChat("Try again, " + name + ". The question was " + question + ". Too hard? Type "+cmdChar+"mathhelp");
6091 // cheater >:3
6092 if (mathCheat) setTimeout( function() { MPP.chat.send(cmdChar+"math " + eval(question)) }, randNum(1000, 2500));
6093 }
6094 }
6095
6096 } else if (cmd == cmdChar+"mathskip") {
6097 asked = false;
6098 sendChat("Skipping question. (questions skipped " + ++mathSkipped + ")");
6099
6100 } else if (cmd == cmdChar+"meth") {
6101 sendChat('Did you mean '+cmdChar+'"math"?');
6102
6103 // unit conversions start
6104
6105 } else if (cmd == cmdChar+"unitc") {
6106 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)");
6107
6108 // Celsius to Fahrenheit
6109 } else if (cmd == cmdChar+"ctof") {
6110 var fTemp = message.substring(6).trim() * (9 / 5) + 32;
6111 var outcome = fTemp.toString();
6112 if (message.substring(6).trim() == "" || isNaN(fTemp)) {
6113 sendChat("Usage: "+cmdChar+"ctof <unit> eg: 32.");
6114 } else {
6115 sendChat(message.substring(6).trim() + " Celsius equals: " + outcome.substring(0, 6) + " in Fahrenheit.");
6116 }
6117
6118 // Fahrenheit to Celsius
6119 } else if (cmd == cmdChar+"ftoc") {
6120 var cTemp = (message.substring(6).trim() - 32) * (5 / 9);
6121 var outcome = cTemp.toString();
6122 if (message.substring(6).trim() == "" || isNaN(cTemp)) {
6123 sendChat("Usage: "+cmdChar+"ftoc <unit> eg: 74.");
6124 } else {
6125 sendChat(message.substring(6).trim() + " Fahrenheit equals: " + outcome.substring(0, 6) + " in Celsius.");
6126 }
6127
6128 // Centimetres to Inches
6129 } else if (cmd == cmdChar+"cmtoinch") {
6130 var cmTemp = message.substring(10).trim() * 0.39370;
6131 var outcome = cmTemp.toString();
6132 if (message.substring(10).trim() == "" || isNaN(cmTemp)) {
6133 sendChat("Usage: "+cmdChar+"cmtoinch <unit> eg: 30.");
6134 } else {
6135 sendChat(message.substring(10).trim() + " Centimetres equals: " + outcome.substring(0, 6) + " inches.");
6136 }
6137
6138 // Inches to Centimetres
6139 } else if (cmd == cmdChar+"inchtocm") {
6140 var cmTemp = message.substring(10).trim() / 0.39370;
6141 var outcome = cmTemp.toString();
6142 if (message.substring(10).trim() == "" || isNaN(cmTemp)) {
6143 sendChat("Usage: "+cmdChar+"inches <unit> eg: 6.");
6144 } else {
6145 sendChat(message.substring(10).trim() + " Inches equals: " + outcome.substring(0, 6) + " Centimetres.");
6146 }
6147
6148 // Centimetres to Feet
6149 } else if (cmd == cmdChar+"cmtofeet") {
6150 var cmTemp = message.substring(10).trim() * 0.032808;
6151 var outcome = cmTemp.toString();
6152 if (message.substring(10).trim() == "" || isNaN(cmTemp)) {
6153 sendChat("Usage: "+cmdChar+"cmtofeet <unit> eg: 5.");
6154 } else {
6155 sendChat(message.substring(10).trim() + " Centimetres equals: " + outcome.substring(0, 6) + " feet.");
6156 }
6157
6158 // Feet to Centimetres
6159 } else if (cmd == cmdChar+"feettocm") {
6160 var cmTemp = message.substring(10).trim() / 0.032808;
6161 var outcome = cmTemp.toString();
6162 if (message.substring(10).trim() == "" || isNaN(cmTemp)) {
6163 sendChat("Usage: "+cmdChar+"feettocm <unit> eg: 5.");
6164 } else {
6165 sendChat(message.substring(10).trim() + " Feet equals: " + outcome.substring(0, 6) + " Centimetres.");
6166 }
6167
6168 // Kilometres to Miles
6169 } else if (cmd == cmdChar+"kmtomile") {
6170 var cmTemp = message.substring(10).trim() / 0.62137;
6171 var outcome = cmTemp.toString();
6172 if (message.substring(10).trim() == "" || isNaN(cmTemp)) {
6173 sendChat("Usage: "+cmdChar+"kmtomile <unit> eg: 50.");
6174 } else {
6175 sendChat(message.substring(10).trim() + " Kilometres equals: " + outcome.substring(0, 5) + " Miles.");
6176 }
6177
6178 // Miles to Kilometres
6179 } else if (cmd == cmdChar+"miletokm") {
6180 var cmTemp = message.substring(10).trim() * 0.62137;
6181 var outcome = cmTemp.toString();
6182 if (message.substring(10).trim() == "" || isNaN(cmTemp)) {
6183 sendChat("Usage: "+cmdChar+"miletokm <unit> eg: 80");
6184 } else {
6185 sendChat(message.substring(10).trim() + " Miles equals: " + outcome.substring(0, 5) + " Kilometres.");
6186 }
6187 // unit conversions end
6188
6189 // stab command
6190 } else if (cmd == cmdChar+"stab") {
6191 var target = msg.a.substring(cmd.length).trim();
6192 var part = getUser(target.toLowerCase());
6193 if (target == "") {
6194 sendChat("Usage "+cmdChar+"stab name_here.");
6195 return;
6196 }
6197 if (part) {
6198 if (part.name == name) {
6199 sendChat("\"Ouch!\" says " + part.name);
6200 return;
6201 }
6202 sendChat(name + " stabbed " + part.name +".");
6203 } else {
6204 sendChat(userNotFound);
6205 }
6206
6207 } else if (cmd == cmdChar+"highfive") { //highfive command
6208 var target = msg.a.substring(cmd.length).trim();
6209 var part = getUser(target.toLowerCase());
6210 if (target == "") {
6211 sendChat("Usage "+cmdChar+"highfive name_here.");
6212 return;
6213 }
6214 if (part) {
6215 if (part.name == name) {
6216 sendChat(part.name + " claps in the corner.. by themself.");
6217 return;
6218 }
6219 sendChat(name + " highfived " + part.name + ".");
6220 } else {
6221 sendChat(userNotFound);
6222 }
6223
6224 } else if (cmd == cmdChar+"kiss") { //kiss command
6225 var target = msg.a.substring(cmd.length).trim();
6226 var part = getUser(target.toLowerCase());
6227 if (target == "") {
6228 sendChat("Usage "+cmdChar+"kiss name_here.");
6229 return;
6230 }
6231
6232 if (usersDead.indexOf(ids) !== -1) {
6233 sendChat("Is too weak to kiss anyone... maybe a kiss would wake them up?");
6234 return;
6235 }
6236
6237 if (part) {
6238 if (part.name == name) {
6239 sendChat(name + " scrunches up their face, sucking their bottom lip inside their mouth.");
6240 return;
6241 }
6242
6243 if (usersDead.indexOf(part._id) !== -1) {
6244 sendChat(name + '\'s kiss brought ' + part.name + ' back to life.');
6245 usersDead.splice(usersDead.indexOf(ids), 1);
6246
6247 } else {
6248 var kissArray = ['bottom', 'top'];
6249 var lip = Math.floor(Math.random() * kissArray.length);
6250 var kissTypeArray = ['passionately', 'softly', 'shyly', 'nervously', 'cutely', 'holds and'];
6251 var kissType = Math.floor(Math.random() * kissTypeArray.length);
6252 sendChat(name + " " + kissTypeArray[kissType] + " kisses " + part.name + "'s " + kissArray[lip] + " lip. " + part.name + " blushes shyly.");
6253 }
6254 } else {
6255 sendChat(userNotFound);
6256 }
6257
6258 } else if (cmd == cmdChar+"slap") { //slap command
6259 var target = msg.a.substring(cmd.length).trim();
6260 var part = getUser(target.toLowerCase());
6261 if (target == "") {
6262 sendChat("Usage "+cmdChar+"slap name_here.");
6263 return;
6264 }
6265 if (part) {
6266 if (part.name == name) {
6267 sendChat("You cannot slap yourself, that would be awkward.");
6268 return;
6269 }
6270 sendChat(name + " slapped " + part.name);
6271 } else {
6272 sendChat(userNotFound);
6273 }
6274
6275 } else if (cmd == cmdChar+"cuddle") { //cuddle command
6276 var target = msg.a.substring(cmd.length).trim();
6277 var part = getUser(target.toLowerCase());
6278 if (target == "") {
6279 sendChat("Usage "+cmdChar+"cuddle name_here.");
6280 return;
6281 }
6282 if (part) {
6283 if (part.name == name) {
6284 sendChat("You cannot cuddle yourself, you lonely fuck!");
6285 return;
6286 }
6287 var cuddleArray = ['tightly cuddles', 'softly cuddles', 'shyly cuddles', 'tenderly cuddles', 'cuddles'];
6288 var cuddle = Math.floor(Math.random() * cuddleArray.length);
6289 sendChat(name + " " + cuddleArray[cuddle] + " " + part.name + ".");
6290 } else {
6291 sendChat(userNotFound);
6292 }
6293
6294 } else if (cmd == cmdChar+"hug") { //hug command
6295 var target = msg.a.substring(cmd.length).trim();
6296 var part = getUser(target.toLowerCase());
6297 if (target == "") {
6298 sendChat("Usage "+cmdChar+"hug name_here.");
6299 return;
6300 }
6301 if (part) {
6302 if (part.name == name) {
6303 sendChat("You cannot hug yourself, hug a cuddly anon.");
6304 return;
6305 }
6306 var hugArray = [' tightly squeezes ', ' sprints up and hugs ', ' shyly hugs ', ' gently caresses ', ' tounge hugs '];
6307 var hug = Math.floor(Math.random() * hugArray.length);
6308 sendChat(name + hugArray[hug] + part.name + ".");
6309 } else {
6310 sendChat(userNotFound);
6311 }
6312
6313 } else if (cmd == cmdChar+"rape") { //rape command
6314 var target = msg.a.substring(cmd.length).trim();
6315 var part = getUser(target.toLowerCase());
6316 if (target == "") {
6317 sendChat("Usage "+cmdChar+"rape name_here.");
6318 return;
6319 }
6320 if (part) {
6321 if (part.name == name) {
6322 sendChat("You cannot rape yourself, rape the Anonymous people.");
6323 return;
6324 }
6325 sendChat(name + " raped " + part.name + " ᶘᵒᴥᵒᶅ");
6326 } else {
6327 sendChat(userNotFound);
6328 }
6329
6330 } else if (cmd == cmdChar+"gift") { //gift command
6331 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
6332 var randomNumber = Math.floor(Math.random() * giftArray.length);
6333 var target = msg.a.substring(cmd.length).trim();
6334 var part = getUser(target.toLowerCase());
6335 if (target == "") {
6336 sendChat("Usage "+cmdChar+"gift name_here.");
6337 return;
6338 }
6339 if (part) {
6340 if (part.name == name) {
6341 sendChat("You cannot gift yourself, that would be greedy.");
6342 return;
6343 }
6344 sendChat(name + " gave " + part.name + " " + giftArray[randomNumber]);
6345 } else {
6346 sendChat(userNotFound);
6347 }
6348
6349 } else if (cmd == cmdChar+"attack") { //attack command
6350 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'];
6351 var randomNumber = Math.floor(Math.random() * attackArray.length);
6352 var target = msg.a.substring(cmd.length).trim();
6353 var part = getUser(target.toLowerCase());
6354 if (target == "") {
6355 sendChat("Usage "+cmdChar+"attack name_here.");
6356 return;
6357 }
6358 if (part) {
6359 if (part.name == name) {
6360 sendChat("You cannot attack yourself, attack the Anonymous people.");
6361 return;
6362 }
6363 sendChat(name + " attacked " + part.name + " with a " + attackArray[randomNumber] + ".");
6364 } else {
6365 sendChat(userNotFound);
6366 }
6367
6368 } else if (cmd == cmdChar+"colour" || cmd == cmdChar+"color") { //colour command
6369 //thanks electrashave!
6370 if (msg.a.substring(cmd.length).trim() == '') {
6371 sendChat("Your colour is " + new Color(msg.p.color).getName() + " (" + msg.p.color + ") (You can also type "+cmdChar+"colour name_here)");
6372 return;
6373 }
6374
6375 var target = msg.a.substring(cmd.length).trim();
6376 var part = getUser(target.toLowerCase());
6377
6378 if (part) {
6379 sendChat(part.name + "'s colour is " + new Color(part.color).getName() + " (" + part.color + ")");
6380 } else {
6381 sendChat(userNotFound);
6382 }
6383
6384 } else if (cmd == cmdChar+"unicode") { //unicode command
6385 sendChat("Put some of these in your name: ᴥ◕☀☁☂☃☄★☆☇☈☉☊☋☌☍ツ¢¢☍☎☏☐☑☒☓☔☕☖☗☘☙☚☛☜☝☞☟☠␀☡☢☣☤☥☦☧☨☩☪☫☬☭☮☯─━│┃┎┒┝┫┳┻╋╭╮╯╰╱╲╳╴╵╶╷╸╹╺╻╼╽╾╿☰☱☲☳☴☵☶☷░▒▓▔▁▂▃▄▅▆▇█▉▊▋▌▐ ▍▎▏◘☸☹☺☻☼☽☾☿ ♀♁♂♃♄♅♆♇♈♉♊♋♌♍♎♏♐♑♒♓♔♕♖♗♘♙♚♛♜♝♞♟♠♢♣♤♥♡♦♧♨♩♪♫♬♭♮♯ ๖ۣۜ ∥~∼˜≀π∏ℍℂℕℙℚℝℤℬℰℱℋℐℒℳ℘ℛℓℴℯɨℊℎ√∑∮‖⌊⌉⋕⊤✀✁✂✃✄✆✇✈✉✌✍✎✏✐✑✒✓✔✕✖✗✘✙✚✛✜✝✞✟✠✡✢✣✤✥✦✧✩✪✫✬✭✮✯✰✱✲✳✴✵✶✷✸✹✺✻✼✽✾✿❀❁❂❃❄❅❆❇❈❉❊❋❍❏❐❑❒❖❡❤❥❦❧❶❷❸❹❺❻❼❽❾❿➀➁➂➃➄➅➆➇➈➉➔➘➙➚➛➜➝➞➟➠➡➢➣➤➥➦➧➨➩➪➫➬➭➮➯➰➱➲➳➴➵➶➷➸➹➺➻➼➽➾∧⋉⋊⋈ℵ");
6386
6387 } else if (cmd == cmdChar+"clap" || cmd == cmdChar+"applaud") { //clap command
6388 sendChat(name + " applauds.");
6389
6390 } else if (cmd == cmdChar+"slowclap") { //slow clap command
6391 sendChat(name + " claps slowly in approval");
6392
6393 } else if (cmd == cmdChar+"list") { //list command
6394 var list = "Connected users: ";
6395 for (var id in gClient.ppl) {
6396 list += gClient.ppl[id].name + ", ";
6397 }
6398 sendChat(list);
6399 return;
6400
6401 } else if (cmd == cmdChar+"facepalm") { //facepalm command
6402 sendChat(name + " facepalmed.");
6403
6404 } else if (cmd == cmdChar+"musicsheets" || cmd == cmdChar+"ms") { //musicsheets command
6405 var songArray = ['Logan’s small march: xbm. cbm/ xvj. gj. gj, xbm xbm. cb,/ n,ry k.r wtbk etb,',
6406 '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',
6407 '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 - [ -',
6408 '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',
6409 '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 ',
6410 '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',
6411 'Song of Stroms: v r yi yi b t uo n y ip ip b t uo',
6412 'C minor: c v g n m k l /',
6413 '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',
6414 'B major: x f g b j k l .',
6415 'Colombia Pictures: 8 p 9 y | 4 y 5 e | k / l n | f n g c | acgk',
6416 'Fandango: ttytyt8o ttytytip ttytyt8o ttytytip',
6417 'Eb fun: f n . | g m l | 4 y o | 5 u 9',
6418 'The Entertainer LH: e tup m u9p yn yip tb tup m yu m yu m etup etup',
6419 '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',
6420 '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',
6421 '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',
6422 'E minor: b j m , . / r t',
6423 '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',
6424 'Darude Sandstorm: r7i tuo tuo tuo tuo up] tuo tuo tuo tuo up] tuo tuo tuo tuo up] up] uo[ uo[ r7i tuo',
6425 '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'];
6426 var randomSong = Math.floor(Math.random() * songArray.length);
6427 sendChat("Songs for PC players: " + sheetURL + " here's a random sample - " + songArray[randomSong] + " (Notes updated 6th June 2015)"); //update when you update link, Logan
6428
6429 } else if (cmd == cmdChar+"suicide") { //suicide command
6430 if (usersDead.indexOf(ids) == -1) {
6431 sendChat(name + " kissed Logan and died x3");
6432 usersDead.push(ids);
6433
6434 } else {
6435 sendChat(name + " is too weak to kiss Logan... Maybe a kiss would wake them up?");
6436 }
6437
6438 } else if (cmd == cmdChar+"kill") { //kill command
6439 var target = msg.a.substring(cmd.length).trim();
6440 var part = getUser(target.toLowerCase());
6441 if (target == "") {
6442 sendChat("Usage "+cmdChar+"kill name_here.");
6443 return;
6444 }
6445 if (part) {
6446 if (part.name == name) {
6447 if (usersDead.indexOf(part._id) == -1) {
6448 sendChat(name + " commitsed suicide!");
6449 usersDead.push(part._id);
6450 } else {
6451 sendChat(name + "'s body twitches... Maybe a kiss would wake them up?");
6452 }
6453 return;
6454 }
6455 if (usersDead.indexOf(part._id) == -1) {
6456 sendChat(name + " killed " + part.name + "!");
6457 usersDead.push(part._id)
6458 } else {
6459 sendChat(part.name + " body twitches... Maybe a kiss would wake them up?");
6460 }
6461 } else {
6462 sendChat(userNotFound);
6463 }
6464
6465 //text art
6466 } else if (cmd == cmdChar+"art") { //art command
6467 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).");
6468
6469 } else if (cmd == cmdChar+"hamster2") { //hamster 2 art command
6470 setTimeout(function() { sendChat("( ) ( )" ); }, 0);
6471 setTimeout(function() { sendChat("(>•.•<)" ); }, 0);
6472 setTimeout(function() { sendChat('(") (")' ); }, 0);
6473
6474 } else if (cmd == cmdChar+"hamster") { //hamster art command
6475 setTimeout(function() { sendChat("( )_( )" ); }, 0);
6476 setTimeout(function() { sendChat("(='.'=)" ); }, 0);
6477 setTimeout(function() { sendChat('(")_(")' ); }, 0);
6478
6479 } else if (cmd == cmdChar+"bunny4") { //bunny 4 art command
6480 setTimeout(function() { sendChat("(\\(\\" ); }, 0);
6481 setTimeout(function() { sendChat("(=\".\")" ); }, 0);
6482 setTimeout(function() { sendChat('("")("")' ); }, 0);
6483
6484 } else if (cmd == cmdChar+"bunny3") { //bunny 3 art command
6485 setTimeout(function() { sendChat("(\\_(\\" ); }, 0);
6486 setTimeout(function() { sendChat("(˚_˚)" ); }, 0);
6487 setTimeout(function() { sendChat("('')('')" ); }, 0);
6488
6489 } else if (cmd == cmdChar+"bunny2") { //bunny 2 art command
6490 setTimeout(function() { sendChat("/)_/)" ); }, 0);
6491 setTimeout(function() { sendChat("(0.0)" ); }, 0);
6492 setTimeout(function() { sendChat("('')('')" ); }, 0);
6493
6494 } else if (cmd == cmdChar+"bunny") { //bunny art command
6495 setTimeout(function() { sendChat("(\\_/)" ); }, 0);
6496 setTimeout(function() { sendChat("(o.o)" ); }, 0);
6497 setTimeout(function() { sendChat("('')('')" ); }, 0);
6498
6499 } else if (cmd == cmdChar+"table") { //table art command
6500 setTimeout(function() { sendChat("(╮°-°)╮┳━━┳" ); }, 0);
6501 setTimeout(function() { sendChat("( ╯°□°)╯ ┻━━┻" ); }, 0);
6502 setTimeout(function() { sendChat("┬──┬ ノ( ゜-゜ノ)" ); }, 0);
6503 //text art
6504
6505 } else if (cmd == cmdChar+"fishies") { //fishies command
6506 if (gClient.isOwner()) {
6507 sendChat("╭━━╮╭━━━┳╮╭╮╭╮╭━━━┳━━━┳╮╭╮╭┳━╮╱╭╮╭━━━┳━━┳━━━┳╮╱╭┳━━┳━━━┳━━━╮ ╭╮" );
6508 sendChat("┃╭╮┃┃╭━╮┃┃┃┃┃┃╰╮╭╮┃╭━╮┃┃┃┃┃┃┃╰╮┃┃┃╭━━┻┫┣┫╭━╮┃┃╱┃┣┫┣┫╭━━┫╭━╮┃ ┃┃" );
6509 sendChat("┃╰╯╰┫┃╱┃┃┃┃┃┃┃╱┃┃┃┃┃╱┃┃┃┃┃┃┃╭╮╰╯┃┃╰━━╮┃┃┃╰━━┫╰━╯┃┃┃┃╰━━┫╰━━╮ ┃┃" );
6510 sendChat("┃╭━╮┃┃╱┃┃╰╯╰╯┃╱┃┃┃┃┃╱┃┃╰╯╰╯┃┃╰╮┃┃┃╭━━╯┃┃╰━━╮┃╭━╮┃┃┃┃╭━━┻━━╮┃ ╰╯" );
6511 sendChat("┃╰━╯┃╰━╯┣╮╭╮╭╯╭╯╰╯┃╰━╯┣╮╭╮╭┫┃╱┃┃┃┃┃╱╱╭┫┣┫╰━╯┃┃╱┃┣┫┣┫╰━━┫╰━╯┃ ╭╮" );
6512 sendChat("╰━━━┻━━━╯╰╯╰╯╱╰━━━┻━━━╯╰╯╰╯╰╯╱╰━╯╰╯╱╱╰━━┻━━━┻╯╱╰┻━━┻━━━┻━━━╯ ╰╯" );
6513 sendChat("╭━━━┳━━━┳━━━┳━━━┳━━━┳━━━┳━━━┳━━━┳━━━┳━━━┳━━━┳━━━┳━━━┳━━━┳━━╮" );
6514 sendChat("╰━━━┻━━━┻━━━┻━━━┻━━━┻━━━┻━━━┻━━━┻━━━┻━━━┻━━━┻━━━┻━━━┻━━━┻━━╯" );
6515 sendChat("><> \\o/" );
6516 } else {
6517 sendChat("I need the crown to show fishies in its entirety!");
6518 }
6519
6520 } else if (cmd == cmdChar+"face") { //face command
6521 var textArray = ['╥﹏╥', '(◕ᴥ◕し)', 'ʕ•ᴥ•ʔ', '(◡‿◡✿)', 'ヽ༼ ಠ益ಠ ༽ノ', '^‿^', 'ᶘ ᵒᴥᵒᶅ', '๏̯͡๏', '^ㅂ^', ' ಠ_ರೃ', '(ノ◕ヮ◕)ノ*:・゚✧', '◕◡◕', 'ಠ▃ಠ', 'ಠ╭╮ಠ', 'ಠ⌣ಠ', 'ಠ◡ಠ', 'ლ(ಠ益ಠლ)', 'ლ(◉◞౪◟◉‵ლ)', '⊙ω⊙', '⊙▂⊙', '╯‵Д′)╯彡┻━┻', '◕ω◕', '⌒▽⌒', '♥◡♥', '。◕‿‿◕。', '。◕ ‿ ◕。', '(´◉◞౪◟◉)', 'Ծ‸ Ծ', '(ᵔᴥᵔ)', '• ε •', '(⌐■_■)', '(┛◉Д◉)┛┻━┻', '(╯°□°)╯︵ ┻━┻ ', '◕ ^ ◕', '(☞゚ ∀゚ )☞', '(づ。◕‿‿◕。)づ', '(ノಠ益ಠ)ノ彡┻━┻', ';一_一', '\(◕ ◡ ◕\)', '°-°', '¶_¶', '( ͡° ͜ʖ ͡°)', '|)^_^(|'];
6522 var randomNumber = Math.floor(Math.random() * textArray.length);
6523 sendChat(textArray[randomNumber]);
6524
6525 } else if (cmd == cmdChar+"say") { //say command
6526 if (message.substring(4).trim() == "") {
6527 sendChat("Usage: "+cmdChar+"say text to say.");
6528 return;
6529 }
6530 sendChat(message.substring(5).trim());
6531
6532 } else if (cmd == cmdChar+"rename") { //rename command
6533 if (message.substring(cmd.length).trim() == 0) {
6534 sendChat('Usage: '+cmdChar+'rename new_name');
6535 return;
6536 }
6537 if (message.substring(7).trim() == 420) {
6538 sendChat('Too high!');
6539 return;
6540 }
6541 if (opped) {
6542 updateName(message.substring(7).trim());
6543 selfName = message.substring(7).trim();
6544
6545 } else {
6546 sendChat(noAccess);
6547 }
6548
6549 } else if (cmd == cmdChar+"welcome") { //welcome command
6550 if (opped) {
6551 if (welcTemp) {
6552 welcTemp = false;
6553 sendChat("Room welcoming disabled.");
6554 } else {
6555 welcTemp = true;
6556 sendChat("Room welcoming enabled.");
6557 }
6558 } else {
6559 sendChat(noAccess);
6560 }
6561 } else if (cmd == cmdChar+"tune") { //tune command
6562 if (opped) {
6563 if (tuneTemp) {
6564 tuneTemp = false;
6565 sendChat("Welcome tune disabled.");
6566 } else {
6567 tuneTemp = true;
6568 sendChat("Welcome tune enabled.");
6569 }
6570 } else {
6571 sendChat(noAccess);
6572 }
6573
6574 } else if (cmd == cmdChar+"ban") { //ban command
6575 var target = msg.a.substring(cmd.length).trim();
6576 var part = getUser(target.toLowerCase());
6577
6578 if (opped) {
6579 if (target == "") {
6580 sendChat("Usage "+cmdChar+"ban name_here.");
6581 return;
6582 }
6583 if (part) {
6584 if (banned.indexOf(part._id) !== -1) {
6585 sendChat(part.name + " is already banned!");
6586 return;
6587 }
6588
6589 if (part._id == selfId) { //Logan
6590 sendChat("Banning " + part.name.substring(0, 4).trim() + "... wait.");
6591 } else if (part._id == "4e28d8736f8a464ada652896") { //Yoshify.
6592 sendChat("You cannot ban " + selfName + "'s friend " + part.name + ".");
6593 } else if (part._id == "d9e6170fd899f2a94adea761") { //StarsPiano
6594 sendChat("You cannot ban " + selfName + "'s friend " + part.name + ".");
6595 } else {
6596 banned.push(part._id);
6597 sendChat(name + " banned " + part.name + ".");
6598 }
6599 } else {
6600 sendChat(userNotFound);
6601 }
6602 } else {
6603 sendChat(noAccess);
6604 }
6605
6606 } else if (cmd == cmdChar+"unban") { //unban command
6607 var target = msg.a.substring(cmd.length).trim();
6608 var part = getUser(target.toLowerCase());
6609
6610 if (opped) {
6611 if (target == "") {
6612 sendChat("Usage "+cmdChar+"unban name_here.");
6613 return;
6614 }
6615 if (part) {
6616 if (banned.indexOf(part._id) == -1) {
6617 sendChat(part.name + " isn't banned!");
6618 return;
6619 }
6620
6621 while (banned.indexOf(part._id) !== -1) {
6622 banned.splice(banned.indexOf(part._id), 1);
6623 sendChat(name + " unbanned " + part.name + ".");
6624 }
6625 while (banned.indexOf(part._id) !== -1) {
6626 delete banned[banned.indexOf(part._id)];
6627 }
6628 } else {
6629 sendChat(userNotFound);
6630 }
6631 } else {
6632 sendChat(noAccess);
6633 }
6634
6635 } else if (cmd == cmdChar+"pardon") { //pardon command
6636 if (mastered || opped) {
6637 banned = [];
6638 sendChat(name + " pardoned everyone from being banned.");
6639 } else {
6640 sendChat(noAccess);
6641 }
6642
6643 } else if (cmd == cmdChar+"op") { //op command
6644 var target = msg.a.substring(cmd.length).trim();
6645 var part = getUser(target.toLowerCase());
6646
6647 if (opped) {
6648 if (target == "") {
6649 sendChat("Usage "+cmdChar+"op name_here.");
6650 return;
6651 }
6652 if (part) {
6653 if (ops.indexOf(part._id) !== -1) {
6654 sendChat(part.name + " is already opped!");
6655 return;
6656 }
6657
6658 sendChat("Opped " + part.name + ".");
6659 ops.push(part._id);
6660
6661 } else {
6662 sendChat(userNotFound);
6663 }
6664 } else {
6665 sendChat(noAccess);
6666 }
6667
6668 } else if (cmd == cmdChar+"deop") { //deop command
6669 var target = msg.a.substring(cmd.length).trim();
6670 var part = getUser(target.toLowerCase());
6671
6672 if (opped) {
6673 if (target == "") {
6674 sendChat("Usage "+cmdChar+"deop name_here.");
6675 return;
6676 }
6677 if (part) {
6678 if (ops.indexOf(part._id) == -1) {
6679 sendChat(part.name + " isn't opped!");
6680 return;
6681 }
6682
6683 if (part._id == selfId) { //Logan
6684 sendChat("You cannot deop " + part.name + ".");
6685 } else if (part._id == "4e28d8736f8a464ada652896") { //Yoshify.
6686 sendChat("You cannot deop " + selfName + "'s friend " + part.name + ".");
6687 } else if (part._id == "d9e6170fd899f2a94adea761") { //StarsPiano
6688 sendChat("You cannot deop " + selfName + "'s friend " + part.name + ".");
6689 } else {
6690 while (ops.indexOf(part._id) !== -1) {
6691 ops.splice(banned.indexOf(part._id), 1); //is this meant to say banned?
6692 }
6693 while (ops.indexOf(part._id) !== -1) {
6694 delete ops[ops.indexOf(part._id)];
6695 }
6696 sendChat("Deopped " + part.name + ".");
6697 }
6698 } else {
6699 sendChat(userNotFound);
6700 }
6701 } else {
6702 sendChat(noAccess);
6703 }
6704 } else if (message.substring(0, 1) == cmdChar) { //alternative error messages
6705 if (message.substring(2).trim() == "") {
6706
6707 } else {
6708 //sendChat("Invalid command. Type !help for a list of commands you have access to."); //shhhhh
6709 }
6710 }
6711 }
6712 botLoaded = true;
6713 });
6714
6715 var Color = function () {
6716 var r, g, b;
6717 if (arguments.length === 1) {
6718 var hexa = arguments[0].toLowerCase();
6719 if (hexa.match(/^#[0-9a-f]{6}$/i)) {
6720 hexa = /^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(hexa);
6721 if (hexa && hexa.length === 4) {
6722 r = parseInt(hexa[1], 16);
6723 g = parseInt(hexa[2], 16);
6724 b = parseInt(hexa[3], 16);
6725 }
6726 }
6727 } else if (arguments.length === 3) {
6728 r = arguments[0];
6729 g = arguments[1];
6730 b = arguments[2];
6731 }
6732 this.r = ~~r || 0;
6733 this.g = ~~g || 0;
6734 this.b = ~~b || 0;
6735 };
6736
6737 Color.prototype.distance = function (color) {
6738 var d = 0;
6739 d += Math.pow(this.r - color.r, 2);
6740 d += Math.pow(this.g - color.g, 2);
6741 d += Math.pow(this.b - color.b, 2);
6742 return Math.abs(Math.sqrt(d));
6743 };
6744
6745 Color.prototype.toHexa = function () {
6746 var r = this.r.toString(16),
6747 g = this.g.toString(16),
6748 b = this.b.toString(16);
6749 if (r.length == 1) r = "0" + r;
6750 if (g.length == 1) g = "0" + g;
6751 if (b.length == 1) b = "0" + b;
6752 return "#" + r + g + b;
6753 };
6754
6755 Color.prototype.getName = function () {
6756 var hexa = this.toHexa();
6757 var low = 256;
6758 var name;
6759 for (var n in Color.map) {
6760 if (!Color.map.hasOwnProperty(n)) continue;
6761 var color = Color.map[n];
6762 if (color.r === this.r && color.g === this.g && color.b === this.b) {
6763 return n;
6764 }
6765 var dist = this.distance(color);
6766 if (dist < low) {
6767 low = dist;
6768 name = n;
6769 }
6770 }
6771 if (!name) name = this.toHexa();
6772 else name = "a shade of " + name;
6773 return name;
6774 };
6775
6776 Color.map = {};
6777
6778 Color.a = function (hexa, name) {
6779 Color.map[name] = new Color(hexa);
6780 };
6781
6782 Color.a("#7CB9E8", "Aero");
6783 Color.a("#C9FFE5", "Aero blue");
6784 Color.a("#B284BE", "African purple");
6785 Color.a("#5D8AA8", "Air Force blue (RAF)");
6786 Color.a("#00308F", "Air Force blue (USAF)");
6787 Color.a("#72A0C1", "Air superiority blue");
6788 Color.a("#AF002A", "Alabama Crimson");
6789 Color.a("#F0F8FF", "Alice blue");
6790 Color.a("#E32636", "Alizarin crimson");
6791 Color.a("#C46210", "Alloy orange");
6792 Color.a("#EFDECD", "Almond");
6793 Color.a("#E52B50", "Amaranth");
6794 Color.a("#F19CBB", "Amaranth pink");
6795 Color.a("#AB274F", "Dark amaranth");
6796 Color.a("#3B7A57", "Amazon");
6797 Color.a("#FF7E00", "Amber");
6798 Color.a("#FF033E", "American rose");
6799 Color.a("#9966CC", "Amethyst");
6800 Color.a("#A4C639", "Android green");
6801 Color.a("#F2F3F4", "Anti-flash white");
6802 Color.a("#CD9575", "Antique brass");
6803 Color.a("#665D1E", "Antique bronze");
6804 Color.a("#915C83", "Antique fuchsia");
6805 Color.a("#841B2D", "Antique ruby");
6806 Color.a("#FAEBD7", "Antique white");
6807 Color.a("#8DB600", "Apple green");
6808 Color.a("#FBCEB1", "Apricot");
6809 Color.a("#00FFFF", "Aqua");
6810 Color.a("#7FFFD4", "Aquamarine");
6811 Color.a("#4B5320", "Army green");
6812 Color.a("#3B444B", "Arsenic");
6813 Color.a("#8F9779", "Artichoke");
6814 Color.a("#B2BEB5", "Ash grey");
6815 Color.a("#87A96B", "Asparagus");
6816 Color.a("#FDEE00", "Aureolin");
6817 Color.a("#6E7F80", "AuroMetalSaurus");
6818 Color.a("#568203", "Avocado");
6819 Color.a("#007FFF", "Azure");
6820 Color.a("#F0FFFF", "Azure mist/web");
6821 Color.a("#89CFF0", "Baby blue");
6822 Color.a("#A1CAF1", "Baby blue eyes");
6823 Color.a("#FEFEFA", "Baby powder");
6824 Color.a("#FF91AF", "Baker-Miller pink");
6825 Color.a("#21ABCD", "Ball blue");
6826 Color.a("#FAE7B5", "Banana Mania");
6827 Color.a("#FFE135", "Banana yellow");
6828 Color.a("#E0218A", "Barbie pink");
6829 Color.a("#7C0A02", "Barn red");
6830 Color.a("#848482", "Battleship grey");
6831 Color.a("#98777B", "Bazaar");
6832 Color.a("#9F8170", "Beaver");
6833 Color.a("#F5F5DC", "Beige");
6834 Color.a("#2E5894", "B'dazzled blue");
6835 Color.a("#9C2542", "Big dip o’ruby");
6836 Color.a("#FFE4C4", "Bisque");
6837 Color.a("#3D2B1F", "Bistre");
6838 Color.a("#967117", "Bistre brown");
6839 Color.a("#CAE00D", "Bitter lemon");
6840 Color.a("#648C11", "Bitter lime");
6841 Color.a("#FE6F5E", "Bittersweet");
6842 Color.a("#BF4F51", "Bittersweet shimmer");
6843 Color.a("#000000", "Black with no soul!");
6844 Color.a("#3D0C02", "Black bean");
6845 Color.a("#253529", "Black leather jacket");
6846 Color.a("#3B3C36", "Black olive");
6847 Color.a("#FFEBCD", "Blanched almond");
6848 Color.a("#A57164", "Blast-off bronze");
6849 Color.a("#318CE7", "Bleu de France");
6850 Color.a("#ACE5EE", "Blizzard Blue");
6851 Color.a("#FAF0BE", "Blond");
6852 Color.a("#0000FF", "Blue");
6853 Color.a("#1F75FE", "Blue (Crayola)");
6854 Color.a("#0093AF", "Blue (Munsell)");
6855 Color.a("#0087BD", "Blue (NCS)");
6856 Color.a("#333399", "Blue (pigment)");
6857 Color.a("#0247FE", "Blue (RYB)");
6858 Color.a("#A2A2D0", "Blue Bell");
6859 Color.a("#6699CC", "Blue-gray");
6860 Color.a("#0D98BA", "Blue-green");
6861 Color.a("#126180", "Blue sapphire");
6862 Color.a("#8A2BE2", "Blue-violet");
6863 Color.a("#5072A7", "Blue yonder");
6864 Color.a("#4F86F7", "Blueberry");
6865 Color.a("#1C1CF0", "Bluebonnet");
6866 Color.a("#DE5D83", "Blush");
6867 Color.a("#79443B", "Bole Brown");
6868 Color.a("#0095B6", "Bondi blue");
6869 Color.a("#E3DAC9", "Bone");
6870 Color.a("#CC0000", "Boston University Red");
6871 Color.a("#006A4E", "Bottle green");
6872 Color.a("#873260", "Boysenberry");
6873 Color.a("#0070FF", "Brandeis blue");
6874 Color.a("#B5A642", "Brass");
6875 Color.a("#CB4154", "Brick red");
6876 Color.a("#1DACD6", "Bright cerulean");
6877 Color.a("#66FF00", "Bright green");
6878 Color.a("#BF94E4", "Bright lavender");
6879 Color.a("#D891EF", "Bright lilac");
6880 Color.a("#C32148", "Bright maroon");
6881 Color.a("#1974D2", "Bright navy blue");
6882 Color.a("#FF007F", "Bright pink");
6883 Color.a("#08E8DE", "Bright turquoise");
6884 Color.a("#D19FE8", "Bright ube");
6885 Color.a("#F4BBFF", "Brilliant lavender");
6886 Color.a("#FF55A3", "Brilliant rose");
6887 Color.a("#FB607F", "Brink pink");
6888 Color.a("#004225", "British racing green");
6889 Color.a("#CD7F32", "Bronze");
6890 Color.a("#737000", "Bronze Yellow");
6891 Color.a("#964B00", "Brown");
6892 Color.a("#6B4423", "Brown-nose");
6893 Color.a("#FFC1CC", "Bubble gum");
6894 Color.a("#E7FEFF", "Bubbles");
6895 Color.a("#F0DC82", "Buff");
6896 Color.a("#7BB661", "Bud green");
6897 Color.a("#480607", "Bulgarian rose");
6898 Color.a("#800020", "Burgundy");
6899 Color.a("#DEB887", "Burlywood");
6900 Color.a("#CC5500", "Burnt orange");
6901 Color.a("#8A3324", "Burnt umber");
6902 Color.a("#BD33A4", "Byzantine");
6903 Color.a("#702963", "Byzantium");
6904 Color.a("#536872", "Cadet");
6905 Color.a("#5F9EA0", "Cadet blue");
6906 Color.a("#91A3B0", "Cadet grey");
6907 Color.a("#006B3C", "Cadmium green");
6908 Color.a("#ED872D", "Cadmium orange");
6909 Color.a("#E30022", "Cadmium red");
6910 Color.a("#FFF600", "Cadmium yellow");
6911 Color.a("#A67B5B", "Cafe au lait");
6912 Color.a("#4B3621", "Cafe noir");
6913 Color.a("#1E4D2B", "Cal Poly green");
6914 Color.a("#A3C1AD", "Cambridge Blue");
6915 Color.a("#EFBBCC", "Cameo pink");
6916 Color.a("#78866B", "Camouflage green");
6917 Color.a("#FFEF00", "Canary yellow");
6918 Color.a("#FF0800", "Candy apple red");
6919 Color.a("#E4717A", "Candy pink");
6920 Color.a("#592720", "Caput mortuum");
6921 Color.a("#C41E3A", "Cardinal");
6922 Color.a("#00CC99", "Caribbean green");
6923 Color.a("#960018", "Carmine");
6924 Color.a("#EB4C42", "Carmine pink");
6925 Color.a("#FF0038", "Carmine red");
6926 Color.a("#FFA6C9", "Carnation pink");
6927 Color.a("#99BADD", "Carolina blue");
6928 Color.a("#ED9121", "Carrot orange");
6929 Color.a("#00563F", "Castleton green");
6930 Color.a("#062A78", "Catalina blue");
6931 Color.a("#703642", "Catawba");
6932 Color.a("#C95A49", "Cedar Chest");
6933 Color.a("#92A1CF", "Ceil");
6934 Color.a("#ACE1AF", "Celadon");
6935 Color.a("#007BA7", "Celadon blue");
6936 Color.a("#2F847C", "Celadon green");
6937 Color.a("#4997D0", "Celestial blue");
6938 Color.a("#EC3B83", "Cerise pink");
6939 Color.a("#2A52BE", "Cerulean blue");
6940 Color.a("#6D9BC3", "Cerulean frost");
6941 Color.a("#007AA5", "CG Blue");
6942 Color.a("#E03C31", "CG Red");
6943 Color.a("#A0785A", "Chamoisee");
6944 Color.a("#F7E7CE", "Champagne");
6945 Color.a("#36454F", "Charcoal");
6946 Color.a("#232B2B", "Charleston green");
6947 Color.a("#E68FAC", "Charm pink");
6948 Color.a("#DFFF00", "Chartreuse");
6949 Color.a("#7FFF00", "Chartreuse (web)");
6950 Color.a("#DE3163", "Cherry");
6951 Color.a("#FFB7C5", "Cherry blossom pink");
6952 Color.a("#954535", "Chestnut");
6953 Color.a("#A8516E", "China rose");
6954 Color.a("#AA381E", "Chinese red");
6955 Color.a("#856088", "Chinese violet");
6956 Color.a("#7B3F00", "Chocolate");
6957 Color.a("#FFA700", "Chrome yellow");
6958 Color.a("#98817B", "Cinereous");
6959 Color.a("#E4D00A", "Citrine");
6960 Color.a("#9FA91F", "Citron");
6961 Color.a("#7F1734", "Claret");
6962 Color.a("#FBCCE7", "Classic rose");
6963 Color.a("#0047AB", "Cobalt");
6964 Color.a("#D2691E", "Cocoa brown");
6965 Color.a("#965A3E", "Coconut");
6966 Color.a("#6F4E37", "Coffee Brown");
6967 Color.a("#9BDDFF", "Columbia blue");
6968 Color.a("#002E63", "Cool black");
6969 Color.a("#8C92AC", "Cool grey");
6970 Color.a("#B87333", "Copper");
6971 Color.a("#AD6F69", "Copper penny");
6972 Color.a("#CB6D51", "Copper red");
6973 Color.a("#996666", "Copper rose");
6974 Color.a("#FF3800", "Coquelicot");
6975 Color.a("#FF7F50", "Coral");
6976 Color.a("#F88379", "Coral pink");
6977 Color.a("#FF4040", "Coral red");
6978 Color.a("#893F45", "Cordovan");
6979 Color.a("#FBEC5D", "Corn Yellow");
6980 Color.a("#B31B1B", "Cornell Red");
6981 Color.a("#6495ED", "Cornflower blue");
6982 Color.a("#FFF8DC", "Cornsilk");
6983 Color.a("#FFF8E7", "Cosmic latte");
6984 Color.a("#FFBCD9", "Cotton candy");
6985 Color.a("#FFFDD0", "Cream");
6986 Color.a("#DC143C", "Crimson");
6987 Color.a("#BE0032", "Crimson glory");
6988 Color.a("#00B7EB", "Cyan");
6989 Color.a("#58427C", "Cyber grape");
6990 Color.a("#FFD300", "Cyber yellow");
6991 Color.a("#FFFF31", "Daffodil");
6992 Color.a("#F0E130", "Dandelion");
6993 Color.a("#00008B", "Dark blue");
6994 Color.a("#666699", "Dark blue-gray");
6995 Color.a("#654321", "Dark brown");
6996 Color.a("#5D3954", "Dark byzantium");
6997 Color.a("#A40000", "Dark candy apple red");
6998 Color.a("#08457E", "Dark cerulean");
6999 Color.a("#986960", "Dark chestnut");
7000 Color.a("#CD5B45", "Dark coral");
7001 Color.a("#008B8B", "Dark cyan");
7002 Color.a("#536878", "Dark electric blue");
7003 Color.a("#B8860B", "Dark goldenrod");
7004 Color.a("#A9A9A9", "Dark gray");
7005 Color.a("#013220", "Dark green");
7006 Color.a("#00416A", "Dark imperial blue");
7007 Color.a("#1A2421", "Dark jungle green");
7008 Color.a("#BDB76B", "Dark khaki");
7009 Color.a("#734F96", "Dark lavender");
7010 Color.a("#534B4F", "Dark liver");
7011 Color.a("#543D37", "Dark liver (horses)");
7012 Color.a("#8B008B", "Dark magenta");
7013 Color.a("#003366", "Dark midnight blue");
7014 Color.a("#4A5D23", "Dark moss green");
7015 Color.a("#556B2F", "Dark olive green");
7016 Color.a("#FF8C00", "Dark orange");
7017 Color.a("#9932CC", "Dark orchid");
7018 Color.a("#779ECB", "Dark pastel blue");
7019 Color.a("#03C03C", "Dark pastel green");
7020 Color.a("#966FD6", "Dark pastel purple");
7021 Color.a("#C23B22", "Dark pastel red");
7022 Color.a("#E75480", "Dark pink");
7023 Color.a("#003399", "Dark powder blue");
7024 Color.a("#4F3A3C", "Dark puce");
7025 Color.a("#872657", "Dark raspberry");
7026 Color.a("#8B0000", "Dark red");
7027 Color.a("#E9967A", "Dark salmon");
7028 Color.a("#560319", "Dark Scarlet");
7029 Color.a("#8FBC8F", "Dark sea green");
7030 Color.a("#3C1414", "Dark sienna");
7031 Color.a("#8CBED6", "Dark sky blue");
7032 Color.a("#483D8B", "Dark slate blue");
7033 Color.a("#2F4F4F", "Dark slate gray");
7034 Color.a("#177245", "Dark spring green");
7035 Color.a("#918151", "Dark tan");
7036 Color.a("#FFA812", "Dark tangerine");
7037 Color.a("#CC4E5C", "Dark terra cotta");
7038 Color.a("#00CED1", "Dark turquoise");
7039 Color.a("#D1BEA8", "Dark vanilla");
7040 Color.a("#9400D3", "Dark violet");
7041 Color.a("#9B870C", "Dark yellow");
7042 Color.a("#00703C", "Dartmouth green");
7043 Color.a("#555555", "Davy's grey");
7044 Color.a("#D70A53", "Debian red");
7045 Color.a("#A9203E", "Deep carmine");
7046 Color.a("#EF3038", "Deep carmine pink");
7047 Color.a("#E9692C", "Deep carrot orange");
7048 Color.a("#DA3287", "Deep cerise");
7049 Color.a("#B94E48", "Deep chestnut");
7050 Color.a("#C154C1", "Deep fuchsia");
7051 Color.a("#004B49", "Deep jungle green");
7052 Color.a("#F5C71A", "Deep lemon");
7053 Color.a("#9955BB", "Deep lilac");
7054 Color.a("#CC00CC", "Deep magenta");
7055 Color.a("#D473D4", "Deep mauve");
7056 Color.a("#355E3B", "Deep moss green");
7057 Color.a("#FFCBA4", "Deep peach");
7058 Color.a("#A95C68", "Deep puce");
7059 Color.a("#843F5B", "Deep ruby");
7060 Color.a("#FF9933", "Deep saffron");
7061 Color.a("#00BFFF", "Deep sky blue");
7062 Color.a("#4A646C", "Deep Space Sparkle");
7063 Color.a("#7E5E60", "Deep Taupe");
7064 Color.a("#66424D", "Deep Tuscan red");
7065 Color.a("#BA8759", "Deer");
7066 Color.a("#1560BD", "Denim");
7067 Color.a("#EDC9AF", "Desert sand");
7068 Color.a("#EA3C53", "Desire");
7069 Color.a("#B9F2FF", "Diamond");
7070 Color.a("#696969", "Dim gray");
7071 Color.a("#9B7653", "Dirt");
7072 Color.a("#1E90FF", "Dodger blue");
7073 Color.a("#D71868", "Dogwood rose");
7074 Color.a("#85BB65", "Dollar bill");
7075 Color.a("#664C28", "Donkey Brown");
7076 Color.a("#00009C", "Duke blue");
7077 Color.a("#E5CCC9", "Dust storm");
7078 Color.a("#EFDFBB", "Dutch white");
7079 Color.a("#E1A95F", "Earth yellow");
7080 Color.a("#555D50", "Ebony");
7081 Color.a("#1B1B1B", "Logan's old colour </3"); //Logan's old colour </3
7082 Color.a("#614051", "Eggplant");
7083 Color.a("#F0EAD6", "Eggshell");
7084 Color.a("#1034A6", "Egyptian blue");
7085 Color.a("#7DF9FF", "Electric blue");
7086 Color.a("#FF003F", "Electric crimson");
7087 Color.a("#00FF00", "Electric green");
7088 Color.a("#6F00FF", "Electric indigo");
7089 Color.a("#CCFF00", "Electric lime");
7090 Color.a("#BF00FF", "Electric purple");
7091 Color.a("#3F00FF", "Electric ultramarine");
7092 Color.a("#FFFF00", "Electric yellow");
7093 Color.a("#50C878", "Emerald");
7094 Color.a("#6C3082", "Eminence");
7095 Color.a("#1B4D3E", "English green");
7096 Color.a("#B48395", "English lavender");
7097 Color.a("#AB4B52", "English red");
7098 Color.a("#563C5C", "English violet");
7099 Color.a("#96C8A2", "Eton blue");
7100 Color.a("#44D7A8", "Eucalyptus");
7101 Color.a("#801818", "Falu red");
7102 Color.a("#B53389", "Fandango");
7103 Color.a("#DE5285", "Fandango pink");
7104 Color.a("#F400A1", "Fashion fuchsia");
7105 Color.a("#E5AA70", "Fawn");
7106 Color.a("#4D5D53", "Feldgrau");
7107 Color.a("#4F7942", "Fern green");
7108 Color.a("#FF2800", "Ferrari Red");
7109 Color.a("#6C541E", "Field drab");
7110 Color.a("#B22222", "Firebrick");
7111 Color.a("#CE2029", "Fire engine red");
7112 Color.a("#E25822", "Flame");
7113 Color.a("#FC8EAC", "Flamingo pink");
7114 Color.a("#F7E98E", "Flavescent"); //Logan's new stupid colour?
7115 Color.a("#EEDC82", "Flax");
7116 Color.a("#A2006D", "Flirt");
7117 Color.a("#FFFAF0", "Floral white");
7118 Color.a("#FFBF00", "Fluorescent orange");
7119 Color.a("#FF1493", "Fluorescent pink");
7120 Color.a("#FF004F", "Folly");
7121 Color.a("#014421", "Forest green");
7122 Color.a("#228B22", "Forest green (web)");
7123 Color.a("#856D4D", "French bistre");
7124 Color.a("#0072BB", "French blue");
7125 Color.a("#FD3F92", "French fuchsia");
7126 Color.a("#86608E", "French lilac");
7127 Color.a("#9EFD38", "French lime");
7128 Color.a("#FD6C9E", "French pink");
7129 Color.a("#4E1609", "French puce");
7130 Color.a("#C72C48", "French raspberry");
7131 Color.a("#F64A8A", "French rose");
7132 Color.a("#77B5FE", "French sky blue");
7133 Color.a("#8806CE", "French violet");
7134 Color.a("#AC1E44", "French wine");
7135 Color.a("#A6E7FF", "Fresh Air");
7136 Color.a("#FF77FF", "Fuchsia pink");
7137 Color.a("#CC397B", "Fuchsia purple");
7138 Color.a("#C74375", "Fuchsia rose");
7139 Color.a("#E48400", "Fulvous");
7140 Color.a("#CC6666", "Fuzzy Wuzzy");
7141 Color.a("#DCDCDC", "Gainsboro");
7142 Color.a("#E49B0F", "Gamboge");
7143 Color.a("#007F66", "Generic viridian");
7144 Color.a("#F8F8FF", "Ghost white");
7145 Color.a("#FE5A1D", "Giants orange");
7146 Color.a("#B06500", "Ginger");
7147 Color.a("#6082B6", "Glaucous");
7148 Color.a("#E6E8FA", "Glitter");
7149 Color.a("#00AB66", "GO green");
7150 Color.a("#D4AF37", "Gold (metallic)");
7151 Color.a("#FFD700", "Gold (web) (Golden)");
7152 Color.a("#85754E", "Gold Fusion");
7153 Color.a("#996515", "Golden brown");
7154 Color.a("#FCC200", "Golden poppy");
7155 Color.a("#FFDF00", "Golden yellow");
7156 Color.a("#DAA520", "Goldenrod");
7157 Color.a("#A8E4A0", "Granny Smith Apple");
7158 Color.a("#6F2DA8", "Grape");
7159 Color.a("#808080", "Gray");
7160 Color.a("#BEBEBE", "Gray (X11 gray)");
7161 Color.a("#465945", "Gray-asparagus");
7162 Color.a("#1CAC78", "Green (Crayola)");
7163 Color.a("#008000", "Green");
7164 Color.a("#00A877", "Green (Munsell)");
7165 Color.a("#009F6B", "Green (NCS)");
7166 Color.a("#00A550", "Green (pigment)");
7167 Color.a("#66B032", "Green (RYB)");
7168 Color.a("#ADFF2F", "Green-yellow");
7169 Color.a("#A99A86", "Grullo");
7170 Color.a("#663854", "Halaya ube");
7171 Color.a("#446CCF", "Han blue");
7172 Color.a("#5218FA", "Beyonce Purple");
7173 Color.a("#E9D66B", "Hansa yellow");
7174 Color.a("#3FFF00", "Harlequin");
7175 Color.a("#C90016", "Harvard crimson");
7176 Color.a("#DA9100", "Harvest gold");
7177 Color.a("#DF73FF", "Heliotrope");
7178 Color.a("#AA98A9", "Heliotrope gray");
7179 Color.a("#F0FFF0", "Honeydew");
7180 Color.a("#006DB0", "Honolulu blue");
7181 Color.a("#49796B", "Chloe's green");
7182 Color.a("#FF1DCE", "Hot magenta");
7183 Color.a("#FF69B4", "Hot pink");
7184 Color.a("#71A6D2", "Iceberg");
7185 Color.a("#FCF75E", "Icterine");
7186 Color.a("#319177", "Illuminating Emerald");
7187 Color.a("#602F6B", "Imperial");
7188 Color.a("#002395", "Imperial blue");
7189 Color.a("#66023C", "Imperial purple");
7190 Color.a("#ED2939", "Imperial red");
7191 Color.a("#B2EC5D", "Inchworm");
7192 Color.a("#4C516D", "Independence");
7193 Color.a("#138808", "India green");
7194 Color.a("#CD5C5C", "Indian red");
7195 Color.a("#E3A857", "Indian yellow");
7196 Color.a("#4B0082", "Indigo");
7197 Color.a("#002FA7", "International Klein Blue");
7198 Color.a("#FF4F00", "International orange (aerospace)");
7199 Color.a("#BA160C", "International orange (engineering)");
7200 Color.a("#C0362C", "International orange (Golden Gate Bridge)");
7201 Color.a("#5A4FCF", "Iris");
7202 Color.a("#F4F0EC", "Isabelline");
7203 Color.a("#009000", "Islamic green");
7204 Color.a("#B2FFFF", "Italian sky blue");
7205 Color.a("#FFFFF0", "Ivory");
7206 Color.a("#00A86B", "Jade");
7207 Color.a("#9D2933", "Japanese carmine");
7208 Color.a("#264348", "Japanese indigo");
7209 Color.a("#5B3256", "Japanese violet");
7210 Color.a("#D73B3E", "Jasper");
7211 Color.a("#A50B5E", "Jazzberry jam");
7212 Color.a("#DA614E", "Jelly Bean");
7213 Color.a("#343434", "Jet");
7214 Color.a("#F4CA16", "Jonquil");
7215 Color.a("#8AB9F1", "Jordy blue");
7216 Color.a("#BDDA57", "June bud");
7217 Color.a("#29AB87", "Jungle green");
7218 Color.a("#4CBB17", "Kelly green");
7219 Color.a("#7C1C05", "Kenyan copper");
7220 Color.a("#3AB09E", "Keppel");
7221 Color.a("#C3B091", "Khaki");
7222 Color.a("#E79FC4", "Kobi");
7223 Color.a("#354230", "Kombu green");
7224 Color.a("#E8000D", "KU Crimson");
7225 Color.a("#087830", "La Salle Green");
7226 Color.a("#D6CADD", "Languid lavender");
7227 Color.a("#26619C", "Lapis lazuli");
7228 Color.a("#A9BA9D", "Laurel green");
7229 Color.a("#CF1020", "Lava");
7230 Color.a("#B57EDC", "Lavender (floral)");
7231 Color.a("#CCCCFF", "Lavender blue");
7232 Color.a("#FFF0F5", "Lavender blush");
7233 Color.a("#C4C3D0", "Lavender gray");
7234 Color.a("#9457EB", "Lavender indigo");
7235 Color.a("#EE82EE", "Lavender magenta");
7236 Color.a("#E6E6FA", "Lavender mist");
7237 Color.a("#FBAED2", "Lavender pink");
7238 Color.a("#967BB6", "Lavender purple");
7239 Color.a("#FBA0E3", "Lavender rose");
7240 Color.a("#7CFC00", "Lawn green");
7241 Color.a("#FFF700", "Lemon");
7242 Color.a("#FFFACD", "Lemon chiffon");
7243 Color.a("#CCA01D", "Lemon curry");
7244 Color.a("#FDFF00", "Lemon glacier");
7245 Color.a("#E3FF00", "Lemon lime");
7246 Color.a("#F6EABE", "Lemon meringue");
7247 Color.a("#FFF44F", "Lemon yellow");
7248 Color.a("#1A1110", "Licorice");
7249 Color.a("#545AA7", "Liberty");
7250 Color.a("#FDD5B1", "Light apricot");
7251 Color.a("#ADD8E6", "Light blue");
7252 Color.a("#B5651D", "Light brown");
7253 Color.a("#E66771", "Light carmine pink");
7254 Color.a("#F08080", "Light coral");
7255 Color.a("#93CCEA", "Light cornflower blue");
7256 Color.a("#F56991", "Light crimson");
7257 Color.a("#E0FFFF", "Light cyan");
7258 Color.a("#FF5CCD", "Light deep pink");
7259 Color.a("#C8AD7F", "Light French beige");
7260 Color.a("#F984EF", "Light fuchsia pink");
7261 Color.a("#FAFAD2", "Light goldenrod yellow");
7262 Color.a("#D3D3D3", "Light gray");
7263 Color.a("#90EE90", "Light green");
7264 Color.a("#FFB3DE", "Light hot pink");
7265 Color.a("#F0E68C", "Light khaki");
7266 Color.a("#D39BCB", "Light medium orchid");
7267 Color.a("#ADDFAD", "Light moss green");
7268 Color.a("#E6A8D7", "Light orchid");
7269 Color.a("#B19CD9", "Light pastel purple");
7270 Color.a("#FFB6C1", "Light pink");
7271 Color.a("#E97451", "Light red ochre");
7272 Color.a("#FFA07A", "Light salmon");
7273 Color.a("#FF9999", "Light salmon pink");
7274 Color.a("#20B2AA", "Light sea green");
7275 Color.a("#87CEFA", "Light sky blue");
7276 Color.a("#778899", "Light slate gray");
7277 Color.a("#B0C4DE", "Light steel blue");
7278 Color.a("#B38B6D", "Light taupe");
7279 Color.a("#FFFFE0", "Light yellow");
7280 Color.a("#C8A2C8", "Lilac");
7281 Color.a("#BFFF00", "Lime");
7282 Color.a("#32CD32", "Lime green");
7283 Color.a("#9DC209", "Limerick");
7284 Color.a("#195905", "Prostitute green");
7285 Color.a("#FAF0E6", "Linen");
7286 Color.a("#6CA0DC", "Little boy blue");
7287 Color.a("#B86D29", "Liver (dogs)");
7288 Color.a("#6C2E1F", "Liver");
7289 Color.a("#987456", "Liver chestnut");
7290 Color.a("#FFE4CD", "Lumber");
7291 Color.a("#E62020", "Lust");
7292 Color.a("#FF00FF", "Magenta");
7293 Color.a("#CA1F7B", "Magenta (dye)");
7294 Color.a("#D0417E", "Magenta (Pantone)");
7295 Color.a("#FF0090", "Magenta (process)");
7296 Color.a("#9F4576", "Magenta haze");
7297 Color.a("#AAF0D1", "Magic mint");
7298 Color.a("#F8F4FF", "Magnolia");
7299 Color.a("#C04000", "Mahogany");
7300 Color.a("#6050DC", "Majorelle Blue");
7301 Color.a("#0BDA51", "Malachite");
7302 Color.a("#979AAA", "Manatee");
7303 Color.a("#FF8243", "Mango Tango");
7304 Color.a("#74C365", "Mantis"); //The colour of Mantis (#78cb53) - new fav colour
7305 Color.a("#880085", "Mardi Gras");
7306 Color.a("#800000", "Maroon");
7307 Color.a("#E0B0FF", "Mauve");
7308 Color.a("#915F6D", "Mauve taupe");
7309 Color.a("#EF98AA", "Mauvelous");
7310 Color.a("#4C9141", "May green");
7311 Color.a("#73C2FB", "Maya blue");
7312 Color.a("#E5B73B", "Golden");
7313 Color.a("#66DDAA", "Medium aquamarine");
7314 Color.a("#0000CD", "Medium blue");
7315 Color.a("#E2062C", "Medium candy apple red");
7316 Color.a("#AF4035", "Medium carmine");
7317 Color.a("#035096", "Medium electric blue");
7318 Color.a("#1C352D", "Medium jungle green");
7319 Color.a("#BA55D3", "Medium orchid");
7320 Color.a("#9370DB", "Medium purple");
7321 Color.a("#BB3385", "Medium red-violet");
7322 Color.a("#AA4069", "Medium ruby");
7323 Color.a("#3CB371", "Medium sea green");
7324 Color.a("#80DAEB", "Medium sky blue");
7325 Color.a("#7B68EE", "Medium slate blue");
7326 Color.a("#C9DC87", "Medium spring bud");
7327 Color.a("#00FA9A", "Medium spring green");
7328 Color.a("#674C47", "Medium taupe");
7329 Color.a("#48D1CC", "Medium turquoise");
7330 Color.a("#D9603B", "Pale vermilion");
7331 Color.a("#F8B878", "Mellow apricot");
7332 Color.a("#F8DE7E", "Mellow yellow");
7333 Color.a("#FDBCB4", "Melon");
7334 Color.a("#0A7E8C", "Metallic Seaweed");
7335 Color.a("#9C7C38", "Metallic Sunburst");
7336 Color.a("#E4007C", "Mexican pink");
7337 Color.a("#191970", "Midnight blue");
7338 Color.a("#004953", "Midnight green (eagle green)");
7339 Color.a("#FFC40C", "Mikado yellow");
7340 Color.a("#E3F988", "Mindaro");
7341 Color.a("#3EB489", "Mint");
7342 Color.a("#F5FFFA", "Mint cream");
7343 Color.a("#98FF98", "Mint green");
7344 Color.a("#FFE4E1", "Misty rose");
7345 Color.a("#73A9C2", "Moonstone blue");
7346 Color.a("#AE0C00", "Mordant red 19");
7347 Color.a("#8A9A5B", "Moss green");
7348 Color.a("#30BA8F", "Mountain Meadow");
7349 Color.a("#997A8D", "Mountbatten pink");
7350 Color.a("#18453B", "MSU Green");
7351 Color.a("#306030", "Mughal green");
7352 Color.a("#C54B8C", "Mulberry");
7353 Color.a("#FFDB58", "Mustard");
7354 Color.a("#317873", "Myrtle green");
7355 Color.a("#F6ADC6", "Nadeshiko pink");
7356 Color.a("#2A8000", "Napier green");
7357 Color.a("#FFDEAD", "Navajo white");
7358 Color.a("#000080", "Navy");
7359 Color.a("#FFA343", "Neon Carrot");
7360 Color.a("#FE4164", "Neon fuchsia");
7361 Color.a("#39FF14", "Neon green");
7362 Color.a("#214FC6", "New Car");
7363 Color.a("#D7837F", "New York pink");
7364 Color.a("#A4DDED", "Non-photo blue");
7365 Color.a("#059033", "North Texas Green");
7366 Color.a("#E9FFDB", "Nyanza");
7367 Color.a("#0077BE", "Ocean Boat Blue");
7368 Color.a("#CC7722", "Ochre");
7369 Color.a("#43302E", "Old burgundy");
7370 Color.a("#CFB53B", "Old gold");
7371 Color.a("#FDF5E6", "Old lace");
7372 Color.a("#796878", "Old lavender");
7373 Color.a("#673147", "Old mauve");
7374 Color.a("#867E36", "Old moss green");
7375 Color.a("#C08081", "Old rose");
7376 Color.a("#808000", "Olive");
7377 Color.a("#6B8E23", "Olive Drab #3");
7378 Color.a("#3C341F", "Olive Drab #7");
7379 Color.a("#9AB973", "Olivine");
7380 Color.a("#353839", "Onyx");
7381 Color.a("#B784A7", "Opera mauve");
7382 Color.a("#FF7F00", "Orange");
7383 Color.a("#FF7538", "Orange (Crayola)");
7384 Color.a("#FF5800", "Orange (Pantone)");
7385 Color.a("#FB9902", "Orange (RYB)");
7386 Color.a("#FFA500", "Orange (web)");
7387 Color.a("#FF9F00", "Orange peel");
7388 Color.a("#FF4500", "Orange-red");
7389 Color.a("#DA70D6", "Orchid");
7390 Color.a("#F2BDCD", "Orchid pink");
7391 Color.a("#FB4F14", "Orioles orange");
7392 Color.a("#414A4C", "Outer Space");
7393 Color.a("#FF6E4A", "Outrageous Orange");
7394 Color.a("#002147", "Oxford Blue");
7395 Color.a("#990000", "Crimson Red");
7396 Color.a("#006600", "Pakistan green");
7397 Color.a("#273BE2", "Palatinate blue");
7398 Color.a("#682860", "Palatinate purple");
7399 Color.a("#BCD4E6", "Pale aqua");
7400 Color.a("#AFEEEE", "Pale blue");
7401 Color.a("#987654", "Pale brown");
7402 Color.a("#9BC4E2", "Pale cerulean");
7403 Color.a("#DDADAF", "Pale chestnut");
7404 Color.a("#DA8A67", "Pale copper");
7405 Color.a("#ABCDEF", "Pale cornflower blue");
7406 Color.a("#E6BE8A", "Pale gold");
7407 Color.a("#EEE8AA", "Pale goldenrod");
7408 Color.a("#98FB98", "Pale green");
7409 Color.a("#DCD0FF", "Pale lavender");
7410 Color.a("#F984E5", "Pale magenta");
7411 Color.a("#FADADD", "Pale pink");
7412 Color.a("#DDA0DD", "Pale plum");
7413 Color.a("#DB7093", "Nipple");
7414 Color.a("#96DED1", "Pale robin egg blue");
7415 Color.a("#C9C0BB", "Pale silver");
7416 Color.a("#ECEBBD", "Pale spring bud");
7417 Color.a("#BC987E", "Pale taupe");
7418 Color.a("#78184A", "Pansy purple");
7419 Color.a("#009B7D", "Paolo Veronese green");
7420 Color.a("#FFEFD5", "Papaya whip");
7421 Color.a("#E63E62", "Paradise pink");
7422 Color.a("#AEC6CF", "Pastel blue");
7423 Color.a("#836953", "Pastel brown");
7424 Color.a("#CFCFC4", "Pastel gray");
7425 Color.a("#77DD77", "Pastel green");
7426 Color.a("#F49AC2", "Pastel magenta");
7427 Color.a("#FFB347", "Pastel orange");
7428 Color.a("#DEA5A4", "Pastel pink");
7429 Color.a("#B39EB5", "Pastel purple");
7430 Color.a("#FF6961", "Pastel red");
7431 Color.a("#CB99C9", "Pastel violet");
7432 Color.a("#FDFD96", "Pastel yellow");
7433 Color.a("#FFE5B4", "Peach");
7434 Color.a("#FFCC99", "Peach-orange");
7435 Color.a("#FFDAB9", "Peach puff");
7436 Color.a("#FADFAD", "Peach-yellow");
7437 Color.a("#D1E231", "Pear");
7438 Color.a("#EAE0C8", "Pearl");
7439 Color.a("#88D8C0", "Dolphin Aqua");
7440 Color.a("#B768A2", "Pearly purple");
7441 Color.a("#E6E200", "Peridot");
7442 Color.a("#1C39BB", "Persian blue");
7443 Color.a("#00A693", "Persian green");
7444 Color.a("#32127A", "Persian indigo");
7445 Color.a("#D99058", "Persian orange");
7446 Color.a("#F77FBE", "Persian pink");
7447 Color.a("#701C1C", "Persian plum");
7448 Color.a("#CC3333", "Persian red");
7449 Color.a("#FE28A2", "Persian rose");
7450 Color.a("#EC5800", "Persimmon");
7451 Color.a("#CD853F", "Peru");
7452 Color.a("#000F89", "Phthalo blue");
7453 Color.a("#123524", "Phthalo green");
7454 Color.a("#45B1E8", "Picton blue");
7455 Color.a("#C30B4E", "Pictorial carmine");
7456 Color.a("#FDDDE6", "Piggy pink");
7457 Color.a("#01796F", "Pine green");
7458 Color.a("#FFC0CB", "Pink");
7459 Color.a("#D74894", "Pink (Pantone)");
7460 Color.a("#FFDDF4", "Pink lace");
7461 Color.a("#D8B2D1", "Pink lavender");
7462 Color.a("#FF9966", "Pink-orange");
7463 Color.a("#E7ACCF", "Pink pearl");
7464 Color.a("#F78FA7", "Pink Sherbet");
7465 Color.a("#93C572", "Pistachio");
7466 Color.a("#E5E4E2", "Platinum");
7467 Color.a("#8E4585", "Plum");
7468 Color.a("#BE4F62", "Popstar");
7469 Color.a("#FF5A36", "Portland Orange");
7470 Color.a("#B0E0E6", "Powder blue");
7471 Color.a("#FF8F00", "Princeton orange");
7472 Color.a("#003153", "Prussian blue");
7473 Color.a("#DF00FF", "Psychedelic purple");
7474 Color.a("#CC8899", "Puce");
7475 Color.a("#644117", "Pullman Brown (UPS Brown)");
7476 Color.a("#FF7518", "Pumpkin");
7477 Color.a("#800080", "Purple");
7478 Color.a("#9F00C5", "Purple (Munsell)");
7479 Color.a("#A020F0", "Purple");
7480 Color.a("#69359C", "Purple Heart");
7481 Color.a("#9678B6", "Purple mountain majesty");
7482 Color.a("#4E5180", "Purple navy");
7483 Color.a("#FE4EDA", "Purple pizzazz");
7484 Color.a("#50404D", "Purple taupe");
7485 Color.a("#9A4EAE", "Purpureus");
7486 Color.a("#51484F", "Quartz");
7487 Color.a("#436B95", "Queen blue");
7488 Color.a("#E8CCD7", "Queen pink");
7489 Color.a("#8E3A59", "Quinacridone magenta");
7490 Color.a("#FF355E", "Radical Red");
7491 Color.a("#FBAB60", "Rajah");
7492 Color.a("#E30B5D", "Raspberry");
7493 Color.a("#E25098", "Raspberry pink");
7494 Color.a("#B3446C", "Raspberry rose");
7495 Color.a("#826644", "Raw umber");
7496 Color.a("#FF33CC", "Razzle dazzle rose");
7497 Color.a("#E3256B", "Razzmatazz");
7498 Color.a("#8D4E85", "Razzmic Berry");
7499 Color.a("#FF0000", "Red");
7500 Color.a("#EE204D", "Red (Crayola)");
7501 Color.a("#F2003C", "Red (Munsell)");
7502 Color.a("#C40233", "Red (NCS)");
7503 Color.a("#ED1C24", "Red (pigment)");
7504 Color.a("#FE2712", "Red (RYB)");
7505 Color.a("#A52A2A", "Red-brown");
7506 Color.a("#860111", "Red devil");
7507 Color.a("#FF5349", "Red-orange");
7508 Color.a("#E40078", "Red-purple");
7509 Color.a("#C71585", "Red-violet");
7510 Color.a("#A45A52", "Redwood");
7511 Color.a("#522D80", "Regalia");
7512 Color.a("#002387", "Resolution blue");
7513 Color.a("#777696", "Rhythm");
7514 Color.a("#004040", "Rich black");
7515 Color.a("#F1A7FE", "Rich brilliant lavender");
7516 Color.a("#D70040", "Rich carmine");
7517 Color.a("#0892D0", "Rich electric blue");
7518 Color.a("#A76BCF", "Rich lavender");
7519 Color.a("#B666D2", "Rich lilac");
7520 Color.a("#B03060", "Rich maroon");
7521 Color.a("#444C38", "Rifle green");
7522 Color.a("#704241", "Deep Roast coffee");
7523 Color.a("#00CCCC", "Robin egg blue");
7524 Color.a("#8A7F80", "Rocket metallic");
7525 Color.a("#838996", "Roman silver");
7526 Color.a("#F9429E", "Rose bonbon");
7527 Color.a("#674846", "Rose ebony");
7528 Color.a("#B76E79", "Rose gold");
7529 Color.a("#FF66CC", "Rose pink");
7530 Color.a("#C21E56", "Rose red");
7531 Color.a("#905D5D", "Rose taupe");
7532 Color.a("#AB4E52", "Rose vale");
7533 Color.a("#65000B", "Rosewood");
7534 Color.a("#D40000", "Rosso corsa");
7535 Color.a("#BC8F8F", "Rosy brown");
7536 Color.a("#0038A8", "Royal azure");
7537 Color.a("#002366", "Royal blue");
7538 Color.a("#4169E1", "Royal light blue");
7539 Color.a("#CA2C92", "Royal fuchsia");
7540 Color.a("#7851A9", "Royal purple");
7541 Color.a("#FADA5E", "Royal yellow");
7542 Color.a("#CE4676", "Ruber");
7543 Color.a("#D10056", "Rubine red");
7544 Color.a("#E0115F", "Ruby");
7545 Color.a("#9B111E", "Ruby red");
7546 Color.a("#FF0028", "Ruddy");
7547 Color.a("#BB6528", "Ruddy brown");
7548 Color.a("#E18E96", "Ruddy pink");
7549 Color.a("#A81C07", "Rufous");
7550 Color.a("#80461B", "Russet");
7551 Color.a("#679267", "Russian green");
7552 Color.a("#32174D", "Russian violet");
7553 Color.a("#B7410E", "Rust");
7554 Color.a("#DA2C43", "Rusty red");
7555 Color.a("#8B4513", "Saddle brown");
7556 Color.a("#FF6700", "Safety orange (blaze orange)");
7557 Color.a("#EED202", "Safety yellow");
7558 Color.a("#F4C430", "Saffron");
7559 Color.a("#BCB88A", "Sage");
7560 Color.a("#23297A", "St. Patrick's blue");
7561 Color.a("#FA8072", "Salmon");
7562 Color.a("#FF91A4", "Salmon pink");
7563 Color.a("#C2B280", "Sand");
7564 Color.a("#ECD540", "Sandstorm");
7565 Color.a("#F4A460", "Sandy brown");
7566 Color.a("#92000A", "Sangria");
7567 Color.a("#507D2A", "Sap green");
7568 Color.a("#0F52BA", "Sapphire");
7569 Color.a("#0067A5", "Sapphire blue");
7570 Color.a("#CBA135", "Satin sheen gold");
7571 Color.a("#FF2400", "Scarlet");
7572 Color.a("#FFD800", "School bus yellow");
7573 Color.a("#76FF7A", "Screamin' Green");
7574 Color.a("#006994", "Sea blue");
7575 Color.a("#2E8B57", "Sea green");
7576 Color.a("#321414", "Seal brown");
7577 Color.a("#FFF5EE", "Seashell");
7578 Color.a("#FFBA00", "Selective yellow");
7579 Color.a("#704214", "Sepia");
7580 Color.a("#8A795D", "Shadow");
7581 Color.a("#778BA5", "Shadow blue");
7582 Color.a("#FFCFF1", "Shampoo");
7583 Color.a("#009E60", "Shamrock green");
7584 Color.a("#8FD400", "Sheen Green");
7585 Color.a("#D98695", "Shimmering Blush");
7586 Color.a("#FC0FC0", "Shocking pink");
7587 Color.a("#882D17", "Sienna");
7588 Color.a("#C0C0C0", "Silver");
7589 Color.a("#ACACAC", "Silver chalice");
7590 Color.a("#5D89BA", "Silver Lake blue");
7591 Color.a("#C4AEAD", "Silver pink");
7592 Color.a("#BFC1C2", "Silver sand");
7593 Color.a("#CB410B", "Sinopia");
7594 Color.a("#007474", "Skobeloff");
7595 Color.a("#87CEEB", "Sky blue");
7596 Color.a("#CF71AF", "Sky magenta");
7597 Color.a("#6A5ACD", "Slate blue");
7598 Color.a("#708090", "Slate gray");
7599 Color.a("#C84186", "Smitten");
7600 Color.a("#738276", "Smoke");
7601 Color.a("#933D41", "Smokey topaz");
7602 Color.a("#100C08", "Smoky black");
7603 Color.a("#FFFAFA", "Snow");
7604 Color.a("#CEC8EF", "Soap");
7605 Color.a("#893843", "Solid pink");
7606 Color.a("#757575", "Sonic silver");
7607 Color.a("#9E1316", "Spartan Crimson");
7608 Color.a("#1D2951", "Space cadet");
7609 Color.a("#807532", "Spanish bistre");
7610 Color.a("#0070B8", "Spanish blue");
7611 Color.a("#D10047", "Spanish carmine");
7612 Color.a("#E51A4C", "Spanish crimson");
7613 Color.a("#989898", "Spanish gray");
7614 Color.a("#009150", "Spanish green");
7615 Color.a("#E86100", "Spanish orange");
7616 Color.a("#F7BFBE", "Spanish pink");
7617 Color.a("#E60026", "Spanish red");
7618 Color.a("#4C2882", "Spanish violet");
7619 Color.a("#007F5C", "Spanish viridian");
7620 Color.a("#0FC0FC", "Spiro Disco Ball");
7621 Color.a("#A7FC00", "Spring bud");
7622 Color.a("#00FF7F", "Spring green");
7623 Color.a("#007BB8", "Star command blue");
7624 Color.a("#4682B4", "Steel blue");
7625 Color.a("#CC33CC", "Steel pink");
7626 Color.a("#4F666A", "Stormcloud");
7627 Color.a("#E4D96F", "Straw");
7628 Color.a("#FC5A8D", "Strawberry");
7629 Color.a("#FFCC33", "Sunglow");
7630 Color.a("#E3AB57", "Sunray");
7631 Color.a("#FAD6A5", "Sunset");
7632 Color.a("#FD5E53", "Sunset orange");
7633 Color.a("#CF6BA9", "Super pink");
7634 Color.a("#D2B48C", "Tan");
7635 Color.a("#F94D00", "Tangelo");
7636 Color.a("#F28500", "Tangerine");
7637 Color.a("#FFCC00", "Tangerine yellow");
7638 Color.a("#483C32", "Dark Grayish Brown");
7639 Color.a("#8B8589", "Taupe gray");
7640 Color.a("#D0F0C0", "Tea green");
7641 Color.a("#F4C2C2", "Tea rose");
7642 Color.a("#008080", "Teal");
7643 Color.a("#367588", "Teal blue");
7644 Color.a("#99E6B3", "Teal deer");
7645 Color.a("#00827F", "Teal green");
7646 Color.a("#CF3476", "Telemagenta");
7647 Color.a("#CD5700", "Tenne");
7648 Color.a("#E2725B", "Terra cotta");
7649 Color.a("#D8BFD8", "Thistle");
7650 Color.a("#DE6FA1", "Thulian pink");
7651 Color.a("#FC89AC", "Tickle Me Pink");
7652 Color.a("#0ABAB5", "Tiffany Blue");
7653 Color.a("#E08D3C", "Tiger's eye");
7654 Color.a("#DBD7D2", "Timberwolf");
7655 Color.a("#EEE600", "Titanium yellow");
7656 Color.a("#FF6347", "Tomato");
7657 Color.a("#746CC0", "Toolbox");
7658 Color.a("#FFC87C", "Topaz");
7659 Color.a("#FD0E35", "Tractor red");
7660 Color.a("#00755E", "Tropical rain forest");
7661 Color.a("#0073CF", "True Blue");
7662 Color.a("#417DC1", "Tufts Blue");
7663 Color.a("#FF878D", "Tulip");
7664 Color.a("#DEAA88", "Tumbleweed");
7665 Color.a("#B57281", "Turkish rose");
7666 Color.a("#40E0D0", "Turquoise");
7667 Color.a("#00FFEF", "Turquoise blue");
7668 Color.a("#A0D6B4", "Turquoise green");
7669 Color.a("#7C4848", "Tuscan red");
7670 Color.a("#C09999", "Tuscany");
7671 Color.a("#8A496B", "Twilight lavender");
7672 Color.a("#0033AA", "UA blue");
7673 Color.a("#D9004C", "UA red");
7674 Color.a("#8878C3", "Ube");
7675 Color.a("#536895", "UCLA Blue");
7676 Color.a("#FFB300", "UCLA Gold");
7677 Color.a("#3CD070", "UFO Green");
7678 Color.a("#120A8F", "Ultramarine");
7679 Color.a("#4166F5", "Ultramarine blue");
7680 Color.a("#FF6FFF", "Ultra pink");
7681 Color.a("#635147", "Umber");
7682 Color.a("#FFDDCA", "Unbleached silk");
7683 Color.a("#5B92E5", "United Nations blue");
7684 Color.a("#B78727", "University of California Gold");
7685 Color.a("#FFFF66", "Unmellow yellow");
7686 Color.a("#7B1113", "UP Maroon");
7687 Color.a("#AE2029", "Upsdell red");
7688 Color.a("#E1AD21", "Urobilin");
7689 Color.a("#004F98", "USAFA blue");
7690 Color.a("#F77F00", "University of Tennessee Orange");
7691 Color.a("#D3003F", "Utah Crimson");
7692 Color.a("#F3E5AB", "Vanilla");
7693 Color.a("#F38FA9", "Vanilla ice");
7694 Color.a("#C5B358", "Vegas gold");
7695 Color.a("#C80815", "Venetian red");
7696 Color.a("#43B3AE", "Verdigris");
7697 Color.a("#E34234", "Medium vermilion");
7698 Color.a("#D9381E", "Vermilion");
7699 Color.a("#8F00FF", "Violet");
7700 Color.a("#7F00FF", "Violet (color wheel)");
7701 Color.a("#8601AF", "Violet (RYB)");
7702 Color.a("#324AB2", "Logie Bear");
7703 Color.a("#F75394", "Violet-red");
7704 Color.a("#40826D", "Viridian");
7705 Color.a("#009698", "Viridian green");
7706 Color.a("#922724", "Vivid auburn");
7707 Color.a("#9F1D35", "Vivid burgundy");
7708 Color.a("#DA1D81", "Vivid cerise");
7709 Color.a("#CC00FF", "Vivid orchid");
7710 Color.a("#00CCFF", "Vivid sky blue");
7711 Color.a("#FFA089", "Vivid tangerine");
7712 Color.a("#9F00FF", "Vivid violet");
7713 Color.a("#004242", "Warm black");
7714 Color.a("#A4F4F9", "Waterspout");
7715 Color.a("#645452", "Wenge");
7716 Color.a("#F5DEB3", "Wheat");
7717 Color.a("#FFFFFF", "White");
7718 Color.a("#F5F5F5", "White smoke");
7719 Color.a("#A2ADD0", "Wild blue yonder");
7720 Color.a("#D470A2", "Wild orchid");
7721 Color.a("#FF43A4", "Wild Strawberry");
7722 Color.a("#FC6C85", "Wild watermelon");
7723 Color.a("#FD5800", "Willpower orange");
7724 Color.a("#A75502", "Windsor tan");
7725 Color.a("#722F37", "Wine");
7726 Color.a("#C9A0DC", "Wisteria");
7727 Color.a("#C19A6B", "Wood brown");
7728 Color.a("#738678", "Xanadu");
7729 Color.a("#0F4D92", "Yale Blue");
7730 Color.a("#1C2841", "Yankees blue");
7731 Color.a("#FCE883", "Yellow Crayola");
7732 Color.a("#EFCC00", "Yellow Munsell");
7733 Color.a("#FEDF00", "Yellow Pantone");
7734 Color.a("#FEFE33", "Yellow");
7735 Color.a("#9ACD32", "Yellow Green");
7736 Color.a("#FFAE42", "Yellow Orange");
7737 Color.a("#FFF000", "Yellow rose");
7738 Color.a("#0014A8", "Zaffre");
7739 Color.a("#2C1608", "Zinnwaldite brown");
7740 Color.a("#39A78E", "Zomp");
7741
7742 // where it receives the message
7743 gClient.on("a", function (msg) {
7744 chat.receive(msg);
7745 });
7746
7747 $("#chat input").on("focus", function (evt) {
7748 releaseKeyboard();
7749 $("#chat").addClass("chatting");
7750 chat.scrollToBottom();
7751 });
7752
7753 $(document).mousedown(function (evt) {
7754 if (!$("#chat").has(evt.target).length > 0) {
7755 chat.blur();
7756 }
7757 });
7758
7759 document.addEventListener("touchstart", function (event) {
7760 for (var i in event.changedTouches) {
7761 var touch = event.changedTouches[i];
7762 if (!$("#chat").has(touch.target).length > 0) {
7763 chat.blur();
7764 }
7765 }
7766 });
7767
7768 $(document).on("keydown", function (evt) {
7769 if ($("#chat").hasClass("chatting")) {
7770 if (evt.keyCode == 27) {
7771 chat.blur();
7772 evt.preventDefault();
7773 evt.stopPropagation();
7774 } else if (evt.keyCode == 13) {
7775 $("#chat input").focus();
7776 }
7777 } else if (!gModal && (evt.keyCode == 27 || evt.keyCode == 13)) {
7778 $("#chat input").focus();
7779 }
7780 });
7781
7782 $("#chat input").on("keydown", function (evt) {
7783 if (evt.keyCode == 13) {
7784 var message = $(this).val();
7785
7786 // ♥ // local commands // ♥ //
7787
7788 if (message.length == 0) { //close chat if no input
7789 chat.blur();
7790
7791 } else if (message.substring(0, 6).toLowerCase() == cmdChar+"lhelp" || message.substring(0, 6).toLowerCase() == "!lhelp") { //local command list
7792 // thanks Someguy!
7793 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)");
7794 $(this).val(""); //empties chatbox
7795 chat.blur(); //closes chat
7796
7797 } else if (message.substring(0, 5).toLowerCase() == cmdChar+"name" || message.substring(0, 5).toLowerCase() == "!name") { //name
7798 if (message.substring(5).trim() == "") {
7799 msgBox('Rename', 'Usage: '+cmdChar+'name new_name.', 3000, '#piano');
7800
7801 } else {
7802 gClient.sendArray([{
7803 "m": "userset",
7804 "set": {
7805 "name": message.substring(5).trim()
7806 }
7807 }]);
7808 selfName = message.substring(5).trim();
7809 msgBox('Renamed', message.substring(5).trim(), 3000, '#piano');
7810 }
7811 $(this).val("");
7812 chat.blur();
7813
7814 } else if (message.substring(0, 5).toLowerCase() == cmdChar+"svol" || message.substring(0, 5).toLowerCase() == "!svol") { //speech volume
7815 var speechVolumeTEMP = message.substring(6).trim()
7816 if (isNaN(speechVolumeTEMP) || speechVolumeTEMP > 1 || speechVolumeTEMP < 0 || speechVolumeTEMP == '') {
7817 msgBox('Speech Volume [usage]', 'Please enter a number no greater than 1 and no less than 0.', 5000, '#piano');
7818 $(this).val("");
7819 chat.blur();
7820 return;
7821
7822 } else {
7823 speechVolume = speechVolumeTEMP; //sets new variable value
7824 msgBox('Speech Volume', speechVolume, 3000, '#piano');
7825
7826 $(this).val("");
7827 chat.blur();
7828 }
7829
7830 } else if (message.substring(0, 7).toLowerCase() == cmdChar+"spitch" || message.substring(0, 7).toLowerCase() == "!spitch") { //speech pitch
7831 var speechPitchTEMP = message.substring(8).trim()
7832 if (isNaN(speechPitchTEMP) || speechPitchTEMP > 2 || speechPitchTEMP < 0 || speechPitchTEMP == '') {
7833 msgBox('Speech Pitch [usage]', 'Please enter a number no greater than 2 and no less than 0.', 5000, '#piano');
7834 $(this).val("");
7835 chat.blur();
7836 return;
7837
7838 } else {
7839 speechPitch = message.substring(8).trim() //sets new variable value
7840 msgBox('Pitch', speechPitch, 3000, '#piano');
7841 $(this).val("");
7842 chat.blur();
7843 }
7844
7845 } else if (message.substring(0, 6).toLowerCase() == cmdChar+"srate" || message.substring(0, 6).toLowerCase() == "!srate") { //speech rate
7846 var speechRateTEMP = message.substring(7).trim()
7847 if (isNaN(speechRateTEMP) || speechRateTEMP > 2 || speechRateTEMP < 0 || speechRateTEMP == '') {
7848 msgBox('Speech Pitch [usage]', 'Please enter a number no greater than 2 and no less than 0.', 5000, '#piano');
7849 $(this).val("");
7850 chat.blur();
7851 return;
7852
7853 } else {
7854 speechRate = message.substring(7).trim() //sets new variable value
7855 msgBox('Rate', speechRate, 3000, '#piano');
7856 $(this).val("");
7857 chat.blur();
7858 }
7859
7860 } else if (message.substring(0, 9).toLowerCase() == cmdChar+"sdefault" || message.substring(0, 9).toLowerCase() == "!sdefault") { //speech default
7861 speechVolume = 0.5; //default volume for spoken text
7862 speechPitch = 1; //default pitch for spoken text
7863 speechRate = 1; //default speed for spoken text
7864 msgBox('Speech Default', 'Volume, pitch and rate all reset.', 3000, '#piano');
7865 $(this).val("");
7866 chat.blur();
7867
7868 } else if (message.substring(0, 6).toLowerCase() == cmdChar+"lobby" || message.substring(0, 6).toLowerCase() == "!lobby") { //lobby
7869 if (gClient.isOwner()) {
7870 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.");
7871 if (lobbyConfirm == "Yes") {
7872 MPP.client.sendArray([{m: "chset", set: {lobby: true}}]);
7873 msgBox('Room is now a lobby', '', 3000, '#piano');
7874 } else {
7875 alert("Incorrectly entered text or you cancled.");
7876 }
7877
7878 } else {
7879 alert("You're not the owner of this room!");
7880 }
7881
7882 $(this).val("");
7883 chat.blur();
7884
7885 } else if (message.substring(0, 9).toLowerCase() == cmdChar+"givefish" || message.substring(0, 9).toLowerCase() == "!givefish") { //give fish
7886 giveFish = !giveFish;
7887 if (!giveFish) {
7888 msgBox('Give Fish', 'Off', 3000, '#piano');
7889
7890 } else {
7891 msgBox('Give Fish', 'On', 3000, '#piano');
7892 }
7893
7894 $(this).val("");
7895 chat.blur();
7896
7897 } else if (message.substring(0, 9).toLowerCase() == cmdChar+"fishlord" || message.substring(0, 9).toLowerCase() == "!fishlord") { //fish lord
7898 fishLord = message.substring(10).trim();
7899 if (fishLord == '') {
7900 msgBox('Fish Lord [usage]', cmdChar+'fishlord name_here', 3000, '#piano');
7901 $(this).val("");
7902 chat.blur();
7903 return;
7904 }
7905 msgBox('Fish Lord', 'Fish lord: ' + fishLord, 3000, '#piano');
7906 $(this).val("");
7907 chat.blur();
7908
7909 } else if (message.substring(0, 7).toLowerCase() == cmdChar+"juggle" || message.substring(0, 7).toLowerCase() == "!juggle") { //juggle
7910 function jugglePls() {
7911 juggling = setInterval(function() {
7912 gClient.sendArray([{
7913 m: "chown"
7914 }]);
7915 }, 2100); //2300 is good for just the dropping of it
7916 }
7917
7918 if (juggle) {
7919 juggle = false;
7920 clearInterval(juggling);
7921
7922 gClient.sendArray([{
7923 m: "chown",
7924 id: gClient.participantId
7925 }]);
7926 msgBox('Juggle Crown', 'Off', 2000, '#piano');
7927
7928 } else {
7929 juggle = true;
7930 jugglePls();
7931 msgBox('Juggle Crown', 'On', 2000, '#piano');
7932 }
7933
7934 $(this).val("");
7935 chat.blur();
7936
7937 } else if (message.substring(0, 10).toLowerCase() == cmdChar+"mathcheat" || message.substring(0, 10).toLowerCase() == "!mathcheat") { //juggle
7938 if (mathCheat) {
7939 mathCheat = false;
7940 msgBox('Math Cheats', 'Off', 2000, '#piano');
7941 } else {
7942 mathCheat = true;
7943 msgBox('Math Cheats', 'On', 2000, '#piano');
7944 }
7945
7946 $(this).val("");
7947 chat.blur();
7948
7949 // ♥ // local commands // ♥ //
7950
7951 } else if (message.length <= 512) {
7952 if (!meow && !leet) {
7953 //console.log("Triggered first");
7954 chat.send(message);
7955 $(this).val("");
7956 chat.blur();
7957 }
7958 if (message.substring(0,1).trim() != "!" && message.substring(0,1).trim() != "/" && message.substring(0,1).trim() != cmdChar) {
7959 if (meow) {
7960 //thanks electrashave!
7961 leet = false;
7962 var words = ['meow', 'meow', 'mew', 'purr'];
7963 var final = '';
7964 for (var i = 0; words.length > i; i++) {
7965 final += words[Math.floor(Math.random()*words.length)] + ' ';
7966 }
7967 final = final.toLowerCase();
7968 final = final.charAt(0).toUpperCase() + final.slice(1).trim() + '. *' + message.trim() + '*';
7969 chat.send(final);
7970 $(this).val("");
7971 chat.blur();
7972
7973 } else if (!leet){
7974 $(this).val("");
7975 chat.blur();
7976 }
7977
7978 if (leet) {
7979 meow = false;
7980 var alpha1 = "abcdefghijklmnopqrstuvwxyz0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789~`?-=[]\;'\",./_+{}|:<>!@#$%^&*()♥°¬";
7981 var alpha2 = "4bcd3fgh1jklmn0pqrstuvwxyz0123456789 4BCD3FGH1JKLMN0PQRSTUVWXYZ0123456789~`?-=[]\;'\",./_+{}|:<>!@#$%^&*()♥°¬";
7982 var str = message;
7983 var newstr = '';
7984 for (var i = 0; i < str.length; i++) {
7985 charPos = alpha1.indexOf(str.charAt(i));
7986 newstr += alpha2.charAt(charPos);
7987 }
7988 chat.send(newstr);
7989 $(this).val("");
7990 chat.blur();
7991
7992 } else if (!meow) {
7993 $(this).val("");
7994 chat.blur();
7995 }
7996
7997 } else if (meow || leet) {
7998 //console.log("Triggered final");
7999 chat.send(message);
8000 $(this).val("");
8001 chat.blur();
8002 }
8003
8004 }
8005
8006 evt.preventDefault();
8007 evt.stopPropagation();
8008 } else if (evt.keyCode == 27) {
8009 chat.blur();
8010 evt.preventDefault();
8011 evt.stopPropagation();
8012 } else if (evt.keyCode == 9) {
8013 evt.preventDefault();
8014 evt.stopPropagation();
8015 }
8016 });
8017
8018 return {
8019 show: function () {
8020 $("#chat").fadeIn();
8021 },
8022
8023 hide: function () {
8024 $("#chat").fadeOut();
8025 },
8026
8027 clear: function () {
8028 if (clearChat) {
8029 $("#chat li").remove();
8030 return;
8031 }
8032 },
8033
8034 scrollToBottom: function () {
8035 var ele = $("#chat ul").get(0);
8036 ele.scrollTop = ele.scrollHeight;
8037 },
8038
8039 blur: function () {
8040 if ($("#chat").hasClass("chatting")) {
8041 $("#chat input").get(0).blur();
8042 $("#chat").removeClass("chatting");
8043 chat.scrollToBottom();
8044 captureKeyboard();
8045 }
8046 },
8047
8048 send: function (message) {
8049 gClient.sendArray([{
8050 m: "a",
8051 message: message
8052 }]);
8053 },
8054
8055
8056 receive: function (msg) {
8057 if (gChatMutes.indexOf(msg.p._id) != -1) return;
8058 msg.a = msg.a.replace(/</g, '<');
8059 msg.p.name = msg.p.name.replace(/</g, '<');
8060 content = msg.a.replace(/((https?\:\/\/|ftp\:\/\/)|(www\.))(\S+)(\w{2,4})(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/gi, function(url) {
8061 nice = url;
8062 if( url.match('^https?:\/\/') ) nice = nice.replace(/^https?:\/\//i,'')
8063 else url = 'http://' + url;
8064
8065 return '<a target="_blank" style="text-decoration: none;" href="'+ url +'">'+ url +'</a>';
8066 });
8067 var final = content;
8068
8069 var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
8070
8071 var li = $('<li><span class="name"/><span style="position: initial!important;" class="message"/>');
8072
8073 li.find(".name").html(msg.p.name + afterName); //fix for <3 showing up as lt;3 using .text instead of .html -thanks Someguy
8074 if (debug) {
8075 li.find(".name").html("[" + msg.p._id + "] " + msg.p.name + afterName);
8076 }
8077 if (timeStamp) {
8078 li.find(".name").html(getTime() + " | " + msg.p.name + afterName);
8079 }
8080 li.find(".message").html(
8081 "<span class='msg_'>"+ final + "</span>"
8082 );
8083
8084 li.css("color", msg.p.color || "white");
8085
8086 $("#chat ul").append(li);
8087
8088 var eles = $("#chat ul li").get();
8089 for (var i = 1; i <= 50 && i <= eles.length; i++) {
8090 eles[eles.length - i].style.opacity = 1.0 - (i * 0.03); //chat fade
8091 }
8092 if (eles.length > 50) {
8093 eles[0].style.display = "none";
8094 }
8095 if (eles.length > chatLimit) { //max chat log history default was 256
8096 $(eles[0]).remove();
8097 }
8098 updateChatLength(eles.length);
8099
8100 // scroll to bottom if not "chatting" or if not scrolled up
8101 if (!$("#chat").hasClass("chatting")) {
8102 chat.scrollToBottom();
8103 } else {
8104 var ele = $("#chat ul").get(0);
8105 if (ele.scrollTop > ele.scrollHeight - ele.offsetHeight - 50)
8106 chat.scrollToBottom();
8107 }
8108 if (debug2) {
8109 // test
8110 //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
8111 //length of msg: $('#chat li .msg_').get(0).innerHTML.length
8112 var myString = $('#chat li:last .msg_').get(0).innerHTML;
8113 var cut = myString.length;
8114 console.log("length: " + cut);
8115 var myArray = myString.split("");
8116 var loopTimer = 70;
8117 console.log('before loop ' + myString);
8118 $('#chat li:last .msg_').get(0).innerHTML = myString.substring(cut, cut);
8119 var frameLooper = setInterval( function() {
8120 console.log('looping ' + myString);
8121 if(myArray.length > 0) {
8122 $('#chat li:last .msg_').get(0).innerHTML += myArray.shift();
8123 } else {
8124 clearInterval(frameLooper);
8125 console.log('clearing loop ' + myString);
8126 return false;
8127 }
8128 }, loopTimer);
8129 console.log('done ' + myString);
8130
8131 //$('#chat li:last .msg_').get(0).innerHTML
8132
8133 // test
8134 }
8135
8136
8137 }
8138 };
8139
8140 })();
8141
8142
8143 clearChatFunc = function() {
8144 chat.clear();
8145 updateChatLength(0);
8146 }
8147
8148
8149 // use midi bridge (old one started here)
8150 $("#blah-btn").on("click", function (evt) {
8151 var pRoom = prompt("Enter the name of your lobby...", hotkeyRoom);
8152 if (!pRoom) return;
8153 var room_name = pRoom;
8154 changeRoom(room_name, "right", {
8155 "visible": true,
8156 "chat": true,
8157 "crownsolo": false,
8158 "lobby": true
8159 });
8160 });
8161
8162 // use midi bridge (old one ended here)
8163
8164
8165 // New MIDI
8166 var gWebMidiWorking;
8167 (function() {
8168
8169 MIDI_TRANSPOSE = -12;
8170
8171 var MIDI_KEY_NAMES = ["a-1", "as-1", "b-1"];
8172 var bare_notes = "c cs d ds e f fs g gs a as b".split(" ");
8173 for(var oct = 0; oct < 7; oct++) {
8174 for(var i in bare_notes) {
8175 MIDI_KEY_NAMES.push(bare_notes[i] + oct);
8176 }
8177 }
8178 MIDI_KEY_NAMES.push("c7");
8179
8180 if (navigator.requestMIDIAccess) {
8181 navigator.requestMIDIAccess().then(
8182 function(midi) {
8183 console.log(midi);
8184 if(midi.inputs.size > 0) {
8185 var inputs = midi.inputs.values();
8186 for(var input_it = inputs.next(); input_it && !input_it.done; input_it = inputs.next()) {
8187 var input = input_it.value;
8188 console.log(input);
8189 input.onmidimessage = function(evt) {
8190 var channel = evt.data[0] & 0xf;
8191 var cmd = evt.data[0] >> 4;
8192 var note_number = evt.data[1];
8193 var vel = evt.data[2];
8194 //console.log(channel, cmd, note_number, vel);
8195 if(cmd == 8 || (cmd == 9 && vel == 0)) {
8196 // NOTE_OFF
8197 release(MIDI_KEY_NAMES[note_number - 9 + MIDI_TRANSPOSE]);
8198 } else if(cmd == 9) {
8199 // NOTE_ON
8200 press(MIDI_KEY_NAMES[note_number - 9 + MIDI_TRANSPOSE], vel / 100);
8201 } else if(cmd == 11) {
8202 // CONTROL_CHANGE
8203 if(!gAutoSustain) {
8204 if(note_number == 64) {
8205 if(vel > 0) {
8206 pressSustain();
8207 } else {
8208 releaseSustain();
8209 }
8210 }
8211 }
8212 }
8213 };
8214 if(!gWebMidiWorking) {
8215 gWebMidiWorking = true;
8216 new Notification({title:"Nice!", text:"Web MIDI is going.", duration:2000}); //MIDI working
8217 }
8218 }
8219 } else {
8220 console.log("no midi inputs");
8221 gWebMidiWorking = false;
8222 }
8223 if(gMidiOutTest && midi.outputs.size > 0) {
8224 var outputs = midi.outputs.values();
8225 for(var output_it = outputs.next(); output_it && !output_it.done; output_it = outputs.next()) {
8226 var output = output_it.value;
8227 console.log(output);
8228 }
8229 gMidiOutTest = function(note_name, vel, delay_ms) {
8230 var note_number = MIDI_KEY_NAMES.indexOf(note_name);
8231 if(note_number == -1) return;
8232 note_number = note_number + 9 - MIDI_TRANSPOSE;
8233
8234 var outputs = midi.outputs.values();
8235 for(var output_it = outputs.next(); output_it && !output_it.done; output_it = outputs.next()) {
8236 var output = output_it.value;
8237 output.send([0x90, note_number, vel], window.performance.now() + delay_ms);
8238 }
8239 }
8240 }
8241 },
8242 function(err){
8243 console.log(err);
8244 gWebMidiWorking = false;
8245 } );
8246 }
8247 })();
8248
8249
8250
8251 //More button
8252 (function () {
8253 var loaded = false;
8254 $("#social").fadeIn(250);
8255 $("#more-button").click(function () {
8256 //stuff goes between here and..
8257 if (leet) {
8258 leet = false;
8259 } else {
8260 leet = true;
8261 }
8262 msgBox('1337 Mode', ''+leet, 2000, '#piano');
8263 });
8264 })();
8265
8266
8267 //api
8268 //window.MPP
8269 MPP = {
8270 press: press,
8271 release: release,
8272 piano: gPiano,
8273 client: gClient,
8274 chat: chat,
8275 msgBox: msgBox
8276 };
8277
8278
8279});
8280//main end
8281
8282//Thanks B@K$
8283MPP.client.sendArray = function(arr) {
8284 if (arr[0].m == "m") {
8285 logie = this;
8286 logie.participantUpdate({
8287 id: logie.participantId
8288 , x: parseFloat(arr[0].x)
8289 , y: parseFloat(arr[0].y)
8290 , m: "m"
8291 });
8292 }
8293 this.send(JSON.stringify(arr));
8294}
8295
8296// miscellaneous HTML changes
8297 // default place holder for chat
8298 $("#chat .translate").attr("placeholder", "")
8299
8300// miscellaneous HTML changes
8301
8302//HTML Stuff (note: the big buttons are 120px apart and the heart buttons are 25px apart -Logan)
8303//button 1
8304$("body #bottom .relative").append('<div id="1-btn" class="ugly-button 1_btn" style="position: fixed;bottom: 29px;right: 365px;width: 100px">Toggle Piano</div>');
8305$("#1-btn").click(function(){
8306 $("#piano").fadeToggle(1000);
8307});
8308
8309//Joke Generator
8310//button 2
8311$("body #bottom .relative").append('<div id="2-btn" class="ugly-button 2_btn" style="position: fixed;bottom: 29px;right: 245px;width: 100px">Joke Generator</div>');
8312$("#2-btn").click(function(){
8313 var Animal = ['chicken', 'turtle', 'rabbit', 'rat', 'kangaroo', 'cuddlepet', 'fox', 'wolf', 'bat', 'gecko', 'scorpion', 'cat', 'dog', 'parrot', 'seagull', 'elf', 'pony', 'pixie', 'polar bear', 'penguin', 'anteater', 'chipmunk', 'monkey', 'gorilla', 'goat', 'emu', 'elephant', 'horse', 'frog', 'hamster', 'duck', 'flamingo', 'eagle', 'gerbil', 'catfish', 'baboon', 'reindeer', 'seal', 'walrus', 'worm', 'Turkey', 'Panda', 'mule', 'donkey', 'meerkat', 'shark', 'lion', 'tiger', 'jaguar', 'jellyfish', 'igunana', 'lemming', 'crab', 'ladybird', 'rinoceros'];
8314 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'];
8315 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.'];
8316 var Aselection = Math.floor(Math.random() * Animal.length);
8317 var Lselection = Math.floor(Math.random() * Location.length);
8318 var Pselection = Math.floor(Math.random() * Punchline.length);
8319 jokeGens++;
8320 document.getElementById("2-btn").innerHTML = "Joke Generator " + jokeGens
8321 sendChat("[Joke Generator #" + jokeGens + "] Why did the " + Animal[Aselection] + " cross the " + Location[Lselection] + "? " + Punchline[Pselection]);
8322});
8323
8324//Bunny ASCII Art
8325//button 3
8326$("body #bottom .relative").append('<div id="3-btn" class="ugly-button 3_btn" style="position: fixed;bottom: 29px;right: 125px;width: 100px">Bunny ASCII Art</div>');
8327$("#3-btn").click(function(){
8328 setTimeout(function() { sendChat("(\\_/)" ); }, 0);
8329 setTimeout(function() { sendChat("(o.o)" ); }, 0);
8330 setTimeout(function() { sendChat("('')('')" ); }, 0);
8331});
8332
8333//♥ Test Button ♥
8334//button 4
8335function updateChatLength(num) {
8336 document.getElementById("4-btn").innerHTML = "Msgs: " + num;
8337}
8338$("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>');
8339$("#4-btn").click(function(){
8340 var yayNayChat = confirm("Do you want to clear the chat?");
8341
8342 if (yayNayChat) {
8343 clearChat = true;
8344 clearChatFunc();
8345 clearChat = false;
8346 }
8347});
8348
8349//♥ button 5
8350$("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>');
8351$("#5-btn").click(function(){
8352 if (debug) {
8353 //off
8354 debug = false;
8355 document.getElementById("5-btn").style.color = "red";
8356 } else {
8357 //on
8358 debug = true;
8359 document.getElementById("5-btn").style.color = "green";
8360 }
8361});
8362
8363//♥ button 6
8364$("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>');
8365$("#6-btn").click(function(){
8366 document.getElementById("6-btn").style.color = Col();
8367 //nothing as of now
8368});
8369
8370//♥ button 7
8371$("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>');
8372$("#7-btn").click(function(){
8373 document.getElementById("7-btn").style.color = Col();
8374 //nothing as of now
8375});
8376
8377//♥ button 8
8378$("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>');
8379$("#8-btn").click(function(){
8380 document.getElementById("8-btn").style.color = Col();
8381 //nothing as of now
8382});
8383
8384//♥ button 9
8385$("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>');
8386$("#9-btn").click(function(){
8387 document.getElementById("9-btn").style.color = Col();
8388 //nothing as of now
8389});
8390
8391//♥ button 10
8392$("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>');
8393$("#10-btn").click(function(){
8394 document.getElementById("10-btn").style.color = Col();
8395 //nothing as of now
8396});
8397
8398//♥ button 11
8399$("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>');
8400$("#11-btn").click(function(){
8401 document.getElementById("11-btn").style.color = Col();
8402 //nothing as of now
8403});
8404
8405//♥ button 12
8406$("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>');
8407$("#12-btn").click(function(){
8408 document.getElementById("12-btn").style.color = Col();
8409 //nothing as of now
8410});
8411
8412//♥ button 13
8413$("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>');
8414$("#13-btn").click(function(){
8415 document.getElementById("13-btn").style.color = Col();
8416 //nothing as of now
8417});
8418
8419//♥ button 14
8420$("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>');
8421$("#14-btn").click(function(){
8422 document.getElementById("14-btn").style.color = Col();
8423 //nothing as of now
8424});
8425
8426//♥ button 15
8427$("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>');
8428$("#15-btn").click(function(){
8429 document.getElementById("15-btn").style.color = Col();
8430 //nothing as of now
8431});
8432
8433//♥ button 16
8434$("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>');
8435var playingMid = false;
8436document.getElementById("16-btn").style.color = "red";
8437$("#16-btn").click(function(){
8438 if (!playingMid) {
8439 //MIDIjs.play('http://localhost:3000/midis/logan.mid');
8440 playingMid = true;
8441 document.getElementById("16-btn").style.color = "green";
8442 } else {
8443 //MIDIjs.stop();
8444 document.getElementById("16-btn").style.color = "red";
8445 playingMid = false;
8446 }
8447});
8448
8449//♥ button 17
8450$("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>');
8451var spinning = false;
8452document.getElementById("17-btn").style.color = "red";
8453$("#17-btn").click(function(){
8454 if (spinning) {
8455 document.getElementById("17-btn").style.color = "red";
8456 $("#piano").removeClass("spin");
8457 spinning = false;
8458 } else {
8459 document.getElementById("17-btn").style.color = "green";
8460 $("#piano").addClass("spin");
8461 spinning = true;
8462 }
8463});
8464
8465//♥ button 18
8466$("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>');
8467$("#18-btn").click(function(){
8468 document.getElementById("18-btn").style.color = Col();
8469 MPP.press("b1", volume); MPP.press("fs2", volume); MPP.press("d2", volume); MPP.press("b2", volume); MPP.press("b-1", volume);
8470});
8471
8472//♥ button 19
8473$("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>');
8474$("#19-btn").click(function(){
8475 document.getElementById("19-btn").style.color = Col();
8476 MPP.press("b1", volume); MPP.press("fs2", volume); MPP.press("ds2", volume); MPP.press("b2", volume); MPP.press("b-1", volume);
8477});
8478
8479//♥ button 20
8480$("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>');
8481$("#20-btn").click(function(){
8482 document.getElementById("20-btn").style.color = Col();
8483 MPP.press("cs2", volume); MPP.press("e2", volume); MPP.press("as2", volume); MPP.press("fs0", volume);
8484});
8485
8486//♥ button 21
8487$("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>');
8488$("#21-btn").click(function(){
8489 document.getElementById("21-btn").style.color = Col();
8490 MPP.press("cs2", volume); MPP.press("e2", volume); MPP.press("gs2", volume); MPP.press("cs0", volume);
8491});
8492
8493//♥ button 22
8494$("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>');
8495$("#22-btn").click(function(){
8496 document.getElementById("22-btn").style.color = Col();
8497 MPP.press("c2", volume); MPP.press("fs2", volume); MPP.press("gs2", volume);
8498});
8499
8500//♥ button 23
8501$("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>');
8502$("#23-btn").click(function(){
8503 document.getElementById("23-btn").style.color = Col();
8504 MPP.press("b1", volume); MPP.press("e2", volume); MPP.press("gs2", volume);
8505});
8506
8507//♥ button 24
8508$("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>');
8509$("#24-btn").click(function(){
8510 setCmdChar();
8511 updateCmdChar(cmdChar);
8512
8513});
8514
8515// le label
8516$("body").append('<div id="resource-label" style="position: fixed; bottom: 529px; right: 17px;">Resource Monitor</div>');
8517
8518// thanks http://stackoverflow.com/users/165737/anurag
8519$("body #resource-label").css("fontSize", "11px");
8520
8521console.log(window.performance.now() - startUpDelay);
8522//END OF SCRIPT// //END OF SCRIPT// //END OF SCRIPT// //END OF SCRIPT// //END OF SCRIPT// //END OF SCRIPT/