Advertisement
Guest User

Flash Script

a guest
Jan 29th, 2015
562
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var stalkwords = ["bebobop"];
  2. var hilight = "BACKGROUND-COLOR: #ffff00";
  3. var fontcolour = "";
  4. var fontstyle = "";
  5. var fontsize = 3;
  6. var auth_symbol = {
  7.     "0": "",
  8.     "1": "",
  9.     "2": "",
  10.     "3": "",
  11.     "4": "+"
  12. };
  13. var auth_style = {
  14.     "0": "<b>",
  15.     "1": "<i><b>",
  16.     "2": "<i><b>",
  17.     "3": "<i><b>",
  18.     "4": "<b>"
  19. };
  20. events = ({
  21.     beforeNewMessage: function (message, html) {
  22.         if (html === true) {
  23.             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()) {
  24.                 client.trayMessage("Pokemon Online", "Disconnected from Server!");
  25.             }      
  26.             return;
  27.         }
  28.     },
  29.     stripHTML: function stripHTML(string) {
  30.         var regex = /(<([^>]+)>)/ig;
  31.         string = string.replace(regex, "");
  32.         return string;
  33.     },
  34.     html_escape: function (text) {
  35.         var m = String(text);
  36.         if (m.length > 0) {
  37.             var amp = "&am" + "p;";
  38.             var lt = "&l" + "t;";
  39.             var gt = "&g" + "t;";
  40.             return m.replace(/&/g, amp).replace(/</g, lt).replace(/>/g, gt);
  41.             } else {
  42.             return "";
  43.         }
  44.     },
  45.     authEnd: function (string) {
  46.         newstring = string.replace(/</g, "</")
  47.         return newstring
  48.     },
  49.     channelLinks: function (string) {
  50.         var channels = client.channelNames()
  51.         for (x in channels) {
  52.             if (string.toLowerCase().indexOf("#" + channels[x].toLowerCase()) != -1) {
  53.                 var channel = new RegExp("#" + channels[x], "i")
  54.                 string = string.replace(channel, '<a href="po:join/' + channels[x] + '">#' + channels[x] + "</a>")
  55.             }
  56.         }
  57.         return string
  58.     },
  59.         beforeChannelMessage: function(message, channel, html) {
  60.             var pos = message.indexOf(': ');
  61.         if (pos != -1) {
  62.             if (client.id(message.substring(0, pos)) == -1) {
  63.                 return;
  64.             }
  65.             var id = client.id(message.substring(0, pos))
  66.             var playname = message.substring(0, pos)
  67.             if (client.auth(id) < 4 && client.auth(id) >= 0) {
  68.                 var playmessage = this.html_escape(message.substr(pos + 2))
  69.             } else {
  70.                 var playmessage = message.substr(pos + 2)
  71.             }
  72.             var msg = playmessage.split(' ')
  73.             for (x in msg) {
  74.                 var msgnew = ""
  75.                 if (msg[x].substr(0, 7) == "http://" || msg[x].substr(0, 8) == "https://") {
  76.                     var link = msg[x]
  77.                     link = link.replace(/&amp;/g, "&")
  78.                     msgnew = "<a href = '" + link + "'>" + link + "</a>"
  79.                     playmessage = playmessage.replace(msg[x], msgnew)
  80.                 }
  81.             }
  82.             var colour = client.color(id)
  83.             if (colour === "#000000") {
  84.                 var clist = ['#5811b1', '#399bcd', '#0474bb', '#f8760d', '#a00c9e', '#0d762b', '#5f4c00', '#9a4f6d', '#d0990f', '#1b1390', '#028678', '#0324b1'];
  85.                 colour = clist[src % clist.length];
  86.             }
  87.             if (playmessage.toLowerCase().indexOf(client.ownName().toLowerCase()) != -1 && playname !== client.ownName()) {
  88.                 var name = new RegExp("\\b" + client.ownName() + "\\b", "i")
  89.                 newplaymessage = playmessage.replace(name, "<span style='" + hilight + "'>" + client.ownName() + "</span>")
  90.                 if (newplaymessage !== playmessage) {
  91.                     playmessage = newplaymessage.replace(newplaymessage, "<i> " + newplaymessage + "</i><ping/>")
  92.                 }
  93.             }
  94.             for (x in stalkwords) {
  95.                 if (playmessage.toLowerCase().indexOf(stalkwords[x].toLowerCase()) != -1 && playname !== client.ownName()) {
  96.                     var stalk = new RegExp("\\b" + stalkwords[x] + "\\b", "i")
  97.                     newplaymessage = playmessage.replace(stalk, "<span style='" + hilight + "'>" + stalkwords[x] + "</span>")
  98.                     if (newplaymessage !== playmessage) {
  99.                         playmessage = newplaymessage.replace(newplaymessage, "" + newplaymessage + "<ping/>")
  100.                     }
  101.                 }
  102.             }
  103.             var symbolLength = 0
  104.             for (x in auth_symbol) {
  105.                 if (x > symbolLength) {
  106.                     symbolLength = x
  107.                 }
  108.             }
  109.             var auth = client.auth(id)
  110.             if (auth > symbolLength) {
  111.                 auth = 0
  112.             }
  113.             playmessage = this.channelLinks(playmessage)
  114.             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)
  115.             if (playmessage.indexOf('<ping/>') !== -1 && !client.windowActive()) {
  116.                 client.trayMessage('Ping' + (channel ? " in " + client.channelName(channel) : ""), this.stripHTML(playname + ":" + playmessage));
  117.         }            
  118.         sys.stopEvent()
  119.         }
  120.     }
  121. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement