Advertisement
sparkychild

Untitled

Aug 4th, 2015
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.87 KB | None | 0 0
  1. mytype: 'typing',
  2. type: 'typing',
  3. typing: function(arg, user, room) {
  4. if (!user.hasRank(room.id, '+')) return this.say(room, 'user');
  5. if (!arg) {
  6. var target = {
  7. 'id': user.id,
  8. 'name': user.name
  9. }
  10. }
  11. else {
  12. var target = {
  13. 'id': toId(arg),
  14. 'name': arg,
  15. }
  16. }
  17. var types = {
  18. 0: {
  19. type: 'Ice',
  20. color: '2822DA'
  21. },
  22. 1: {
  23. type: 'Water',
  24. color: '2822DA'
  25. },
  26. 2: {
  27. type: 'Fire',
  28. color: 'BF6224'
  29. },
  30. 3: {
  31. type: 'Grass',
  32. color: '4A8B4F'
  33. },
  34. 4: {
  35. type: 'Normal',
  36. color: '6C6C6C'
  37. },
  38. 5: {
  39. type: 'Fighting',
  40. color: '865A44'
  41. },
  42. 6: {
  43. type: 'Psychic',
  44. color: '8E1164'
  45. },
  46. 7: {
  47. type: 'Ghost',
  48. color: '695170'
  49. },
  50. 8: {
  51. type: 'Dark',
  52. color: '000'
  53. },
  54. 9: {
  55. type: 'Electric',
  56. color: '9F9F25'
  57. },
  58. 10: {
  59. type: 'Ground',
  60. color: '90903E'
  61. },
  62. 11: {
  63. type: 'Rock',
  64. color: '897246'
  65. },
  66. 12: {
  67. type: 'Steel',
  68. color: '5B6265'
  69. },
  70. 13: {
  71. type: 'Fairy',
  72. color: 'C95596'
  73. },
  74. 14: {
  75. type: 'Flying',
  76. color: '6F7AA1'
  77. },
  78. 15: {
  79. type: 'Poison',
  80. color: '591F7A'
  81. },
  82. 16: {
  83. type: 'Bug',
  84. color: '5F6F32'
  85. },
  86. 17: {
  87. type: 'Dragon',
  88. color: '473981'
  89. },
  90. };
  91.  
  92. if(!this.settings.typing){
  93. this.settings.typing = {};
  94. this.writeSettings();
  95. }
  96. if (this.settings.typing[target.id]) {
  97. 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'))
  98. }
  99. var dualtype = true;
  100.  
  101. function scramble(text, variable){
  102. var array = [];
  103. for(var i = 0; i < variable; i++){
  104. array.push('');
  105. }
  106. for(var i = 0; i < text.length;i++){
  107. array[i % array.length] += text[i];
  108. }
  109. return array.join('');
  110. }
  111. function returnType(target, variation) {
  112. var base = 'qwertyuiopasdfghjklzxcvbnm1234567890';
  113. var chars = scramble(base, variation);
  114. var total = 0;
  115. for (var i = 0; i < target.length; i++) {
  116. total += chars.indexOf(target[i]);
  117. }
  118. return total % 18;
  119. }
  120. //using 2 different numbers to generate random numbers;
  121. var type1 = types[returnType(target.id, 4)];
  122. var type2 = types[returnType(target.id, 6)];
  123. if (type1.type === type2.type) {
  124. dualtype = false;
  125. }
  126. 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.'));
  127. },
  128. customtype: 'settype',
  129. settype: function(arg, user, room) {
  130. if (!user.isExcepted()) return false;
  131. if(!arg) return false;
  132. var target = toId(arg.replace(', ', ',').split(',')[0]);
  133. var typing = arg.replace(', ', ',').split(',')[1];
  134. if(!typing){
  135. return false;
  136. }
  137. if (typing.indexOf('/') > -1) {
  138. typing = [toId(typing.split('/')[0]), toId(typing.split('/')[1])]
  139. }
  140. else {
  141. typing = [typing];
  142. }
  143. var type = {
  144. ice: 0,
  145. water: 1,
  146. fire: 2,
  147. grass: 3,
  148. normal: 4,
  149. fighting: 5,
  150. psychic: 6,
  151. ghost: 7,
  152. dark: 8,
  153. electric: 9,
  154. ground: 10,
  155. rock: 11,
  156. steel: 12,
  157. fairy: 13,
  158. flying: 14,
  159. poison: 15,
  160. bug: 16,
  161. dragon: 17
  162. };
  163. for (var i = 0; i < typing.length; i++) {
  164. if(!type[typing[i]]) return this.say(room, 'Invalid type.');
  165. typing[i] = type[typing[i]];
  166. }
  167. this.settings.typing[target] = typing;
  168. this.writeSettings();
  169. this.say(room, 'Done!')
  170. },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement