Advertisement
sparkychild

Untitled

Aug 4th, 2015
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.61 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.  
  102. function returnType(target, variation) {
  103. var chars = 'qwertyuiopasdfghjklzxcvbnm1234567890';
  104. var total = 0;
  105. for (var i = 0; i < target.length; i++) {
  106. total += chars.indexOf(target[i]);
  107. }
  108. return (total + variation) % 18;
  109. }
  110. //using 2 different numbers to generate random numbers;
  111. var type1 = types[returnType(target.id, 13)];
  112. var type2 = types[returnType(target.id, 37)];
  113. if (type1.type === type2.type) {
  114. dualtype = false;
  115. }
  116. 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.'));
  117. },
  118. customtype: 'settype',
  119. settype: function(arg, user, room) {
  120. if (!user.isExcepted()) return false;
  121. if(!arg) return false;
  122. var target = toId(arg.replace(', ', ',').split(',')[0]);
  123. var typing = arg.replace(', ', ',').split(',')[1];
  124. if(!typing){
  125. return false;
  126. }
  127. if (typing.indexOf('/') > -1) {
  128. typing = [toId(typing.split('/')[0]), toId(typing.split('/')[1])]
  129. }
  130. else {
  131. typing = [typing];
  132. }
  133. var type = {
  134. ice: 0,
  135. water: 1,
  136. fire: 2,
  137. grass: 3,
  138. normal: 4,
  139. fighting: 5,
  140. psychic: 6,
  141. ghost: 7,
  142. dark: 8,
  143. electric: 9,
  144. ground: 10,
  145. rock: 11,
  146. steel: 12,
  147. fairy: 13,
  148. flying: 14,
  149. poison: 15,
  150. bug: 16,
  151. dragon: 17
  152. };
  153. for (var i = 0; i < typing.length; i++) {
  154. if(!type[typing[i]]) return this.say(room, 'Invalid type.');
  155. typing[i] = type[typing[i]];
  156. }
  157. this.settings.typing[target] = typing;
  158. this.writeSettings();
  159. this.say(room, 'Done!')
  160. },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement