Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var stalkwords = ["bebobop"];
- var hilight = "BACKGROUND-COLOR: #ffff00";
- var fontcolour = "";
- var fontstyle = "";
- var fontsize = 3;
- var auth_symbol = {
- "0": "",
- "1": "",
- "2": "",
- "3": "",
- "4": "+"
- };
- var auth_style = {
- "0": "<b>",
- "1": "<i><b>",
- "2": "<i><b>",
- "3": "<i><b>",
- "4": "<b>"
- };
- events = ({
- beforeNewMessage: function (message, html) {
- if (html === true) {
- if (this.stripHTML(message) === "Disconnected from Server! If the disconnect is due to an internet problem, try to reconnect once the issue is solved." && !client.windowActive()) {
- client.trayMessage("Pokemon Online", "Disconnected from Server!");
- }
- return;
- }
- },
- stripHTML: function stripHTML(string) {
- var regex = /(<([^>]+)>)/ig;
- string = string.replace(regex, "");
- return string;
- },
- html_escape: function (text) {
- var m = String(text);
- if (m.length > 0) {
- var amp = "&am" + "p;";
- var lt = "&l" + "t;";
- var gt = "&g" + "t;";
- return m.replace(/&/g, amp).replace(/</g, lt).replace(/>/g, gt);
- } else {
- return "";
- }
- },
- authEnd: function (string) {
- newstring = string.replace(/</g, "</")
- return newstring
- },
- channelLinks: function (string) {
- var channels = client.channelNames()
- for (x in channels) {
- if (string.toLowerCase().indexOf("#" + channels[x].toLowerCase()) != -1) {
- var channel = new RegExp("#" + channels[x], "i")
- string = string.replace(channel, '<a href="po:join/' + channels[x] + '">#' + channels[x] + "</a>")
- }
- }
- return string
- },
- beforeChannelMessage: function(message, channel, html) {
- var pos = message.indexOf(': ');
- if (pos != -1) {
- if (client.id(message.substring(0, pos)) == -1) {
- return;
- }
- var id = client.id(message.substring(0, pos))
- var playname = message.substring(0, pos)
- if (client.auth(id) < 4 && client.auth(id) >= 0) {
- var playmessage = this.html_escape(message.substr(pos + 2))
- } else {
- var playmessage = message.substr(pos + 2)
- }
- var msg = playmessage.split(' ')
- for (x in msg) {
- var msgnew = ""
- if (msg[x].substr(0, 7) == "http://" || msg[x].substr(0, 8) == "https://") {
- var link = msg[x]
- link = link.replace(/&/g, "&")
- msgnew = "<a href = '" + link + "'>" + link + "</a>"
- playmessage = playmessage.replace(msg[x], msgnew)
- }
- }
- var colour = client.color(id)
- if (colour === "#000000") {
- var clist = ['#5811b1', '#399bcd', '#0474bb', '#f8760d', '#a00c9e', '#0d762b', '#5f4c00', '#9a4f6d', '#d0990f', '#1b1390', '#028678', '#0324b1'];
- colour = clist[src % clist.length];
- }
- if (playmessage.toLowerCase().indexOf(client.ownName().toLowerCase()) != -1 && playname !== client.ownName()) {
- var name = new RegExp("\\b" + client.ownName() + "\\b", "i")
- newplaymessage = playmessage.replace(name, "<span style='" + hilight + "'>" + client.ownName() + "</span>")
- if (newplaymessage !== playmessage) {
- playmessage = newplaymessage.replace(newplaymessage, "<i> " + newplaymessage + "</i><ping/>")
- }
- }
- for (x in stalkwords) {
- if (playmessage.toLowerCase().indexOf(stalkwords[x].toLowerCase()) != -1 && playname !== client.ownName()) {
- var stalk = new RegExp("\\b" + stalkwords[x] + "\\b", "i")
- newplaymessage = playmessage.replace(stalk, "<span style='" + hilight + "'>" + stalkwords[x] + "</span>")
- if (newplaymessage !== playmessage) {
- playmessage = newplaymessage.replace(newplaymessage, "" + newplaymessage + "<ping/>")
- }
- }
- }
- var symbolLength = 0
- for (x in auth_symbol) {
- if (x > symbolLength) {
- symbolLength = x
- }
- }
- var auth = client.auth(id)
- if (auth > symbolLength) {
- auth = 0
- }
- playmessage = this.channelLinks(playmessage)
- client.printChannelMessage("<font face ='" + fontstyle + "'><font size = " + fontsize + "><font color='" + colour + "'><timestamp/> " + auth_symbol[auth] + auth_style[auth] + playname + ": </font>" + this.authEnd(auth_style[auth]) + playmessage, channel, true)
- if (playmessage.indexOf('<ping/>') !== -1 && !client.windowActive()) {
- client.trayMessage('Ping' + (channel ? " in " + client.channelName(channel) : ""), this.stripHTML(playname + ":" + playmessage));
- }
- sys.stopEvent()
- }
- }
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement