Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name DH2 auto ipmute
- // @version 1.0
- // @description Makes it less atrocious.
- // @author eegos and florb
- // @match http://*.diamondhunt.co/game.php
- // @match https://*.diamondhunt.co/game.php
- // @run-at document-idle
- // @grant none
- // ==/UserScript==
- // if someone sends AUTOMUTE_MESSAGES or more chat messages within AUTOMUTE_SECONDS seconds, they get automatically muted
- const AUTOMUTE_ON = true;
- const AUTOMUTE_MESSAGES = 15;
- const AUTOMWARN_MESSAGES = 7;
- const AUTOMUTE_SECONDS = 4;
- const NUM_LOADTRIES = 10;
- const BANNED_PLAYERS = ["lolw00t","salmeh games","andfritz","lolwatt","aldenrulz","pizda24","darkvetal","trevor365u","higuys","umberhallow","wewlaaddd","fittan","niggers","adolf hitler","bonjii","turtlelord11","799350","bouldr","niglipslol","popzitzz","noobie","j a c o b","creeperking9","willum","3x0tic","not2crispy","mr.opwaffl3z","jacob714","jacob716","jacob746","gasthejews","bajskuk","suckabbc","bogjavel","niggerfucker","scrublord123","jordans","head","nigguz","scottyop","lev","mart lands.","mymineblock","zxcvbnm233","lolw00t2","qwertyuiop12","3x0tic","ttyybb","testtesttest","dyhcgfkrhaka","pppppppp","mymineblock3","mymineblock4","mymineblock2","and more","freefrisbee","mymineblock0","lightning123","mymineblock.","at a school","lolw00t4","miniboma","boom the bea","ssssssssssss","loiw0o0t4123"];
- // internal stuff. No changes necessary
- var bodyMarginBottom = 210;
- (function init(tries) {
- 'use strict';
- // wait for game to load, or abort after x tries
- if (tries > 0 && (!window.hasOwnProperty("webSocket") || window.webSocket.readyState !== WebSocket.OPEN || window.firstLoadGame === true)) {
- setTimeout(() => {
- init(--tries);
- }, 200);
- return;
- } else if(tries <= 0) {
- // tough life
- return;
- }
- // createFixedStatus();
- // moveChat();
- if(AUTOMUTE_ON){
- initAutoMute();
- }
- // initSkillBarFix();
- })(NUM_LOADTRIES);
- const SERVER_MESSAGE_CHATTAG = 0; // default
- const SERVER_MESSAGE_CHATICON = 0; // default
- var messageCount = {};
- var origAddToChatBox = addToChatBox;
- function initAutoMute(){
- 'use strict';
- setInterval(resetMessages, AUTOMUTE_SECONDS * 1000);
- addToChatBox = function(username, icon, tag, message, isPM) {
- origAddToChatBox.apply(this, arguments);
- if(BANNED_PLAYERS.includes(username)){
- muteBanned(username);
- }
- // don't mute yourself
- if(username != window.username && !window.mutedPeople.includes(username)){
- if(messageCount[username]){
- if(++messageCount[username] >= AUTOMUTE_MESSAGES){
- mutePlayer(username);
- }
- } else {
- messageCount[username] = 1;
- }
- }
- };
- }
- function resetMessages(){
- 'use strict';
- messageCount = {};
- }
- function muteBanned(username){
- 'use strict';
- document.getElementById("chat-input-text").value = "/pm "+username+" getting around a mute is agaisnt the chat rules. ";
- sendChat(document.getElementById('chat-input-text'));
- document.getElementById("chat-input-text").value = "/ipmute "+username;
- sendChat(document.getElementById('chat-input-text'));
- // document.getElementById("chat-input-text").value = "/pm eegos"+username+"muted for getting around a mute";
- // sendChat(document.getElementById('chat-input-text'));
- // sendBytes("IP_MUTE="+username);
- }
- function warnPlayer(username){
- document.getElementById("chat-input-text").value = "/pm "+username+" you are sending a lot of message qucikly. this is spam/flooding and it is against the chat rules. ";
- sendChat(document.getElementById('chat-input-text'));
- }
- function mutePlayer(username){
- // sendBytes("IP_MUTE="+username);
- document.getElementById("chat-input-text").value = "/pm "+username+" you have been muted for flooding. ";
- sendChat(document.getElementById('chat-input-text'));
- document.getElementById("chat-input-text").value = "/ipmute "+username;
- sendChat(document.getElementById('chat-input-text'));
- // document.getElementById("chat-input-text").value = "/pm eegos"+username+"muted for flooding";
- // sendChat(document.getElementById('chat-input-text'));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement