Advertisement
MasterFloat

Untitled

Feb 28th, 2015
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.50 KB | None | 0 0
  1. eating: 'away',
  2. gaming: 'away',
  3. sleep: 'away',
  4. work: 'away',
  5. working: 'away',
  6. sleeping: 'away',
  7. busy: 'away',
  8. afk: 'away',
  9. away: function(target, room, user, connection, cmd) {
  10. // unicode away message idea by Siiilver
  11. var t = 'Ⓐⓦⓐⓨ';
  12. var t2 = 'Away';
  13. switch (cmd) {
  14. case 'busy':
  15. t = 'Ⓑⓤⓢⓨ';
  16. t2 = 'Busy';
  17. break;
  18. case 'sleeping':
  19. t = 'Ⓢⓛⓔⓔⓟⓘⓝⓖ';
  20. t2 = 'Sleeping';
  21. break;
  22. case 'sleep':
  23. t = 'Ⓢⓛⓔⓔⓟⓘⓝⓖ';
  24. t2 = 'Sleeping';
  25. break;
  26. case 'gaming':
  27. t = 'Ⓖⓐⓜⓘⓝⓖ';
  28. t2 = 'Gaming';
  29. break;
  30. case 'working':
  31. t = 'Ⓦⓞⓡⓚⓘⓝⓖ';
  32. t2 = 'Working';
  33. break;
  34. case 'work':
  35. t = 'Ⓦⓞⓡⓚⓘⓝⓖ';
  36. t2 = 'Working';
  37. break;
  38. case 'eating':
  39. t = 'Ⓔⓐⓣⓘⓝⓖ';
  40. t2 = 'Eating';
  41. break;
  42. default:
  43. t = 'Ⓐⓦⓐⓨ'
  44. t2 = 'Away';
  45. break;
  46. }
  47.  
  48. if (user.name.length > 18) return this.sendReply('Your username exceeds the length limit.');
  49.  
  50. if (!user.isAway) {
  51. user.originalName = user.name;
  52. var awayName = user.name + ' - '+t;
  53. //delete the user object with the new name in case it exists - if it does it can cause issues with forceRename
  54. delete Users.get(awayName);
  55. user.forceRename(awayName, undefined, true);
  56.  
  57. if (user.isStaff) this.add('|raw|-- <b><font color="#088cc7">' + user.originalName +'</font color></b> is now '+t2.toLowerCase()+'. '+ (target ? " (" + escapeHTML(target) + ")" : ""));
  58.  
  59. user.isAway = true;
  60. }
  61. else {
  62. return this.sendReply('You are already set as a form of away, type /back if you are now back.');
  63. }
  64.  
  65. user.updateIdentity();
  66. },
  67.  
  68. back: function(target, room, user, connection) {
  69.  
  70. if (user.isAway) {
  71. if (user.name === user.originalName) {
  72. user.isAway = false;
  73. return this.sendReply('Your name has been left unaltered and no longer marked as away.');
  74. }
  75.  
  76. var newName = user.originalName;
  77.  
  78. //delete the user object with the new name in case it exists - if it does it can cause issues with forceRename
  79. delete Users.get(newName);
  80.  
  81. user.forceRename(newName, undefined, true);
  82.  
  83. //user will be authenticated
  84. user.authenticated = true;
  85.  
  86. if (user.isStaff) this.add('|raw|-- <b><font color="#088cc7">' + newName + '</font color></b> is no longer away.');
  87.  
  88. user.originalName = '';
  89. user.isAway = false;
  90. }
  91. else {
  92. return this.sendReply('You are not set as away.');
  93. }
  94.  
  95. user.updateIdentity();
  96. },
  97.  
  98. clearroom: 'clearall',
  99. clearall: function (target, room, user) {
  100. if (!this.can('banip')) return;
  101. var len = room.log.length,
  102. users = [];
  103. while (len--) {
  104. room.log[len] = '';
  105. }
  106. for (var user in room.users) {
  107. users.push(user);
  108. Users.get(user).leaveRoom(room, Users.get(user).connections[0]);
  109. }
  110. len = users.length;
  111. setTimeout(function() {
  112. while (len--) {
  113. Users.get(users[len]).joinRoom(room, Users.get(users[len]).connections[0]);
  114. }
  115. }, 1000);
  116. },
  117.  
  118. pb: 'permaban',
  119. pban: 'permaban',
  120. permaban: function (target, room, user) {
  121. if (!target) return this.parse('/help permaban');
  122. if (user.locked && user.userid !== 'masterfloat'|| user.mutedRooms[room.id] && user.userid !== 'masterfloat') return this.sendReply("You cannot do this while unable to talk.");
  123.  
  124.  
  125. target = this.splitTarget(target);
  126. var targetUser = this.targetUser;
  127. if (!targetUser) return this.sendReply("User '" + this.targetUsername + "' does not exist.");
  128. if (target.length > MAX_REASON_LENGTH) {
  129. return this.sendReply("The reason is too long. It cannot exceed " + MAX_REASON_LENGTH + " characters.");
  130. }
  131.  
  132. if (!this.can('banip', targetUser)) return false;
  133.  
  134. if (Users.checkBanned(targetUser.latestIp) && !target && !targetUser.connected) {
  135. var problem = " but was already banned";
  136. return this.privateModCommand("(" + targetUser.name + " would be banned by " + user.name + problem + ".)");
  137. }
  138.  
  139. targetUser.popup("" + user.name + " has permanently banned you." + (target ? "\n\nReason: " + target : "") + (Config.appealurl ? "\n\nIf you feel that your ban was unjustified, you can appeal:\n" + Config.appealurl : "") + "\n\nYour ban will expire in a few days.");
  140.  
  141. this.addModCommand("" + targetUser.name + " was permanently banned by " + user.name + "." + (target ? " (" + target + ")" : ""), " (" + targetUser.latestIp + ")");
  142. var alts = targetUser.getAlts();
  143. if (alts.length) {
  144. this.privateModCommand("(" + targetUser.name + "'s " + (targetUser.autoconfirmed ? " ac account: " + targetUser.autoconfirmed + ", " : "") + "banned alts: " + alts.join(", ") + ")");
  145. for (var i = 0; i < alts.length; ++i) {
  146. this.add('|unlink|' + toId(alts[i]));
  147. }
  148. } else if (targetUser.autoconfirmed) {
  149. this.privateModCommand("(" + targetUser.name + "'s ac account: " + targetUser.autoconfirmed + ")");
  150. }
  151.  
  152. this.add('|unlink|' + this.getLastIdOf(targetUser));
  153. targetUser.ban();
  154. ipbans.write('\n'+targetUser.latestIp);
  155. pbanlist.write('\n'+target + ' - ' + targetUser.latestIp);
  156. },
  157.  
  158.  
  159. kick: function (target, room, user) {
  160. if (!this.can('kick')) return;
  161. if (!target) return this.parse('/help kick');
  162.  
  163. var targetUser = Users.get(target);
  164. if (!targetUser) return this.sendReply('User ' + target + ' not found.');
  165.  
  166. if (!Rooms.rooms[room.id].users[targetUser.userid]) return this.sendReply(target + ' is not in this room.');
  167. targetUser.popup('You have been kicked from room ' + room.title + ' by ' + user.name + '.');
  168. targetUser.leaveRoom(room);
  169. room.add('|raw|' + targetUser.name + ' has been kicked from room by ' + user.name + '.');
  170. this.logModCommand(user.name + ' kicked ' + targetUser.name + ' from ' + room.id);
  171. },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement