Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mytype: 'typing',
- type: 'typing',
- typing: function(arg, user, room) {
- if (!user.hasRank(room.id, '+')) return this.say(room, 'user');
- if (!arg) {
- var target = {
- 'id': user.id,
- 'name': user.name
- }
- }
- else {
- var target = {
- 'id': toId(arg),
- 'name': arg,
- }
- }
- var types = {
- 0: {
- type: 'Ice',
- color: '2822DA'
- },
- 1: {
- type: 'Water',
- color: '2822DA'
- },
- 2: {
- type: 'Fire',
- color: 'BF6224'
- },
- 3: {
- type: 'Grass',
- color: '4A8B4F'
- },
- 4: {
- type: 'Normal',
- color: '6C6C6C'
- },
- 5: {
- type: 'Fighting',
- color: '865A44'
- },
- 6: {
- type: 'Psychic',
- color: '8E1164'
- },
- 7: {
- type: 'Ghost',
- color: '695170'
- },
- 8: {
- type: 'Dark',
- color: '000'
- },
- 9: {
- type: 'Electric',
- color: '9F9F25'
- },
- 10: {
- type: 'Ground',
- color: '90903E'
- },
- 11: {
- type: 'Rock',
- color: '897246'
- },
- 12: {
- type: 'Steel',
- color: '5B6265'
- },
- 13: {
- type: 'Fairy',
- color: 'C95596'
- },
- 14: {
- type: 'Flying',
- color: '6F7AA1'
- },
- 15: {
- type: 'Poison',
- color: '591F7A'
- },
- 16: {
- type: 'Bug',
- color: '5F6F32'
- },
- 17: {
- type: 'Dragon',
- color: '473981'
- },
- };
- if(!this.settings.typing){
- this.settings.typing = {};
- this.writeSettings();
- }
- if (this.settings.typing[target.id]) {
- return this.say(room, '!htmlbox ' + target.name + ' is a <font style="font-weight: bold; color: #' + types[this.settings.typing[target.id][0]].color + '"> ' + types[this.settings.typing[target.id][0]].type + '</font>' + (this.settings.typing[target.id][1] ? ' type and <font style="font-weight: bold; color: #' + types[this.settings.typing[target.id][1]].color + '">' + types[this.settings.typing[target.id][1]].type + '</font> type' : ' type'))
- }
- var dualtype = true;
- function returnType(target, variation) {
- var chars = 'qwertyuiopasdfghjklzxcvbnm1234567890';
- var total = 0;
- for (var i = 0; i < target.length; i++) {
- total += chars.indexOf(target[i]);
- }
- return (total + variation) % 18;
- }
- //using 2 different numbers to generate random numbers;
- var type1 = types[returnType(target.id, 13)];
- var type2 = types[returnType(target.id, 37)];
- if (type1.type === type2.type) {
- dualtype = false;
- }
- this.say(room, '!htmlbox ' + target.name + ' is a <font style="font-weight: bold; color: #' + type1.color + '">' + type1.type + '</font> ' + (dualtype ? 'and <font style="font-weight: bold; color: #' + type2.color + '">' + type2.type + '</font> type.' : 'type.'));
- },
- customtype: 'settype',
- settype: function(arg, user, room) {
- if (!user.isExcepted()) return false;
- if(!arg) return false;
- var target = toId(arg.replace(', ', ',').split(',')[0]);
- var typing = arg.replace(', ', ',').split(',')[1];
- if(!typing){
- return false;
- }
- if (typing.indexOf('/') > -1) {
- typing = [toId(typing.split('/')[0]), toId(typing.split('/')[1])]
- }
- else {
- typing = [typing];
- }
- var type = {
- ice: 0,
- water: 1,
- fire: 2,
- grass: 3,
- normal: 4,
- fighting: 5,
- psychic: 6,
- ghost: 7,
- dark: 8,
- electric: 9,
- ground: 10,
- rock: 11,
- steel: 12,
- fairy: 13,
- flying: 14,
- poison: 15,
- bug: 16,
- dragon: 17
- };
- for (var i = 0; i < typing.length; i++) {
- if(!type[typing[i]]) return this.say(room, 'Invalid type.');
- typing[i] = type[typing[i]];
- }
- this.settings.typing[target] = typing;
- this.writeSettings();
- this.say(room, 'Done!')
- },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement