mohamedraif

Untitled

May 10th, 2014
352
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 8.49 KB | None | 0 0
  1. alias autostatus {
  2.   if ($network != Mibbit) { halt }
  3.   elseif (%inuse == yes) { timer 1 30 autostatus }
  4.   else { set %inuse yes | set %info auto | sockopen tpporg www.twitchplayspokemon.org 80 | timertpp 1 10 timeout }
  5.   timerauto 1 600 autostatus
  6. }
  7.  
  8. alias timeout {
  9.   set %inuse no
  10.   if (%info != auto) { msg %tppchan The request timed out due to Raif's shit internet. Sorry. }
  11.   unset %info
  12.   unset %count*
  13.   unset %tnick
  14.   unset %tpp.*
  15. }
  16.  
  17. on $*:TEXT:/^!tppstatus/iS:%tppchan:{
  18.   if ($network != Mibbit) { halt }
  19.   elseif (%inuse == yes) { msg %tppchan $nick $+ : Someone else has requested the same information! Please be patient. }
  20.   else { set %inuse yes | set %info status | sockopen tpporg www.twitchplayspokemon.org 80 | timertpp 1 10 timeout }
  21. }
  22.  
  23. on $*:TEXT:/^!tppteam/iS:%tppchan:{
  24.   if ($network != Mibbit) { halt }
  25.   elseif (%inuse == yes) { msg %tppchan $nick $+ : Someone else has requested the same information! Please be patient. }
  26.   else { set %inuse yes | set %tnick $nick | set %info team | sockopen tpporg www.twitchplayspokemon.org 80 | timertpp 1 10 timeout }
  27. }
  28.  
  29. on *:SOCKOPEN:tpporg:{
  30.   sockwrite -n tpporg GET / HTTP/1.1
  31.   sockwrite -n tpporg Host: twitchplayspokemon.org
  32.   sockwrite -n tpporg Connection: keep-alive
  33.   sockwrite -n tpporg Cache-Control: max-age=0
  34.   sockwrite -n tpporg Accept: text/html
  35.   sockwrite -n tpporg User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.131 Safari/537.36
  36.   sockwrite -n tpporg Accept-Encoding: text
  37.   sockwrite -n tpporg Accept-Language: en-US,en;q=0.8
  38.   sockwrite -n tpporg Cookie: more_info_badges=1; more_info=1; more_info_e4=1
  39.   sockwrite -n $sockname $crlf $+ $crlf
  40. }
  41.  
  42. on *:SOCKREAD:tpporg:{
  43.   if ($sockerr > 0) return
  44.   :nextread
  45.   sockread %tpp
  46.   if ($sockbr == 0) { return }
  47.   if (%tpp) {
  48.     inc %count.lines
  49.     if ($network != Mibbit) { sockclose tpporg | halt }
  50.     elseif ($regex(%tpp,/Last\supdate\72/) > 0) { var %x $regsubex(%tpp,/<[^<>]+>/gS,$null) | set %tpp.lastupdate $regsubex(%x,/^\s+/g,$null) }    
  51.     elseif (%info == status) || (%info == auto) {
  52.       if ($regex(%tpp,/<p>.*\72 <strong>.*<\/strong><\/p>/) > 0) {
  53.         inc %count
  54.         var %x $regsubex(%tpp,/<[^<>]+>/g,$null)
  55.         var %x $regsubex(%x,/^\s+/g,$null)
  56.         set %tpp.status. [ $+ [ %count ] ] $regsubex(%x,/&eacute;/g,é)
  57.       }
  58.       elseif (%info == auto) && ($regex(%tpp,/<span class\="milestone-name">.*<\/span/) > 0) {
  59.         var %x $regsubex(%tpp,/<[^<>]+>/g,$null)
  60.         set %tpp.lastmilestone $regsubex(%x,/^\s+/g,$null)
  61.       }
  62.       elseif (%info == auto) && ($regex(%tpp,/<td class\="text-right"><small>/) > 0) {
  63.         var %x $regsubex(%tpp,/<[^<>]+>/g,$null)
  64.         set %tpp.lastmilestonedate $regsubex(%x,/^\s+/g,$null)
  65.       }
  66.     }
  67.     elseif (%info == team) {
  68.       if ($regex(%tpp,/<th>.*<img src\="/) > 0) && (%count.lines < 300) {
  69.         inc %count.name
  70.         if (%count.name < 7) {
  71.           var %x $regsubex(%tpp,/<[^<>]+>/g,$null)
  72.           var %x $regsubex(%x,/^\s+/g,$null)
  73.           set %tpp.name. [ $+ [ %count.name ] ] $regsubex(%x,/\(&#.*;\)/g,$null)
  74.           if ($regex(%tpp,&#9794;) > 0) { set %tpp.gender. [ $+ [ %count.name ] ] Male }
  75.           elseif ($regex(%tpp,&#9792;) > 0) { set %tpp.gender. [ $+ [ %count.name ] ] Female }
  76.           else { set %tpp.gender. [ $+ [ %count.name ] ] Genderless }
  77.         }
  78.       }
  79.       elseif ($regex(%tpp,/<small class\="pokemon-name"><em>/) > 0) && (%count.lines < 300) {
  80.         inc %count.pokname
  81.         if (%count.pokname < 7) {
  82.           var %x $regsubex(%tpp,/<[^<>]+>/g,$null)
  83.           set %tpp.pokname. [ $+ [ %count.pokname ] ] $regsubex(%x,/^\s+/g,$null)
  84.         }
  85.       }
  86.       elseif ($regex(%tpp,/<td class\="pokemon-valign-middle">Level/) > 0) && (%count.lines < 300) {
  87.         inc %count.level
  88.         if (%count.level < 7) {
  89.           var %x $regsubex(%tpp,/<[^<>]+>/g,$null)
  90.           set %tpp.level. [ $+ [ %count.level ] ] $regsubex(%x,/^\s+/g,$null)
  91.         }
  92.       }
  93.       elseif ($regex(%tpp,/<td class\="pokemon-valign-middle">.*<\/em><\/td>/) > 0) && (%count.lines < 300) {
  94.         inc %count.nickname
  95.         if (%count.nickname < 7) {
  96.           var %x $regsubex(%tpp,/<[^<>]+>/g,$null)
  97.           set %tpp.nickname. [ $+ [ %count.nickname ] ] $regsubex(%x,/^\s+/g,$null)
  98.         }
  99.       }
  100.       elseif ($regex(%tpp,/<td>.*(hold|held).*<\/td>/i) > 0) && (%count.lines < 300) {
  101.         inc %count.held
  102.         if (%count.held < 7) {
  103.           var %x $regsubex(%tpp,/<[^<>]+>/g,$null)
  104.           set %tpp.held. [ $+ [ %count.held ] ] $regsubex(%x,/^\s+/g,$null)
  105.         }
  106.       }
  107.       elseif ($regex(%tpp,/<td class="pokemon-valign-middle">/) > 0) && (%count.lines < 300) { set %count.temp %count.lines }
  108.       elseif ($regex(%tpp,/<ul class\="pokemon-moves">/) > 0) && ($calc($(%count.lines)-$(%count.temp)) == 1) && (%count.lines < 300) {
  109.         inc %count.movpoke
  110.         if (%count.movpoke < 7) { set %move on }
  111.       }
  112.       elseif ($regex(%tpp,/<li/) > 0) && (%move == on) && (%count.lines < 300) {
  113.         inc %count.move
  114.         var %x $regsubex(%tpp,/<[^<>]+>/g,$null)
  115.         var %y tpp.move. $+ %count.movpoke $+ %count.move
  116.         set % [ $+ [ %y ] ] $regsubex(%x,/^\s+/g,$null)
  117.       }
  118.       elseif ($regex(%tpp,/</ul>/) > 0) && (%move == on) && (%count.lines < 300) { set %move off | set %count.move 0 }
  119.       elseif ($regex(%tpp,/<li><em>Ability\72<\/em>/) > 0) && (%count.lines < 300) { set %count.temp %count.lines }
  120.       elseif ($regex(%tpp,/<li><attr/) > 0) && ($calc($(%count.lines)-$(%count.temp)) == 1) && (%count.lines < 300) {
  121.         inc %count.ability
  122.         if (%count.ability < 7) {
  123.           var %x $regsubex(%tpp,/<[^<>]+>/g,$null)
  124.           set %tpp.ability. [ $+ [ %count.ability ] ] $regsubex(%x,/^\s+/g,$null)
  125.         }
  126.       }
  127.     }
  128.   }
  129.   goto nextread
  130. }
  131.  
  132. on *:SOCKCLOSE:tpporg:{
  133.   echo -s $timestamp tpp socket closed
  134.   timertpp off
  135.   set %inuse no
  136.   if (%info = auto) {
  137.     set %tpp.autostatus 04 $+ TPP Auto Update: %tpp.status.1 $(|) %tpp.status.2 $(|) %tpp.status.3 $(|) %tpp.status.4
  138.     if (%autostatus.old != %tpp.autostatus) { msg %tppchan %tpp.autostatus $(|) %tpp.status.5 $(|) %tpp.lastupdate }
  139.     set %tpp.automilestone 04 $+ TPP Auto Update: %tpp.lastmilestonedate - %tpp.lastmilestone
  140.     if (%automilestone.old != %tpp.automilestone) { msg %tppchan %tpp.automilestone }
  141.     set %autostatus.old %tpp.autostatus
  142.     set %automilestone.old %tpp.automilestone
  143.   }
  144.   elseif (%info = status) { msg %tppchan 04 $+ %tpp.status.1 $(|) %tpp.status.2 $(|) %tpp.status.3 $(|) %tpp.status.4 $(|) %tpp.status.5 $(|) %tpp.lastupdate }
  145.   elseif (%info = team) {
  146.     msg %tnick 04 $+ %tpp.name.1 $(|) %tpp.pokname.1 $(|) %tpp.nickname.1 $(|) %tpp.gender.1 $(|) %tpp.level.1 $(|) %tpp.held.1
  147.     msg %tnick 07 $+ Moves: %tpp.move.11 $+ , %tpp.move.12 $+ , %tpp.move.13 $+ , %tpp.move.14 $(|) Ability: %tpp.ability.1
  148.     if (%tpp.name.2 != $null) msg %tnick 04 $+ %tpp.name.2 $(|) %tpp.pokname.2 $(|) %tpp.nickname.2 $(|) %tpp.gender.2 $(|) %tpp.level.2 $(|) %tpp.held.2
  149.     if (%tpp.name.2 != $null) msg %tnick 07 $+ Moves: %tpp.move.21 $+ , %tpp.move.22 $+ , %tpp.move.23 $+ , %tpp.move.24 $(|) Ability: %tpp.ability.2
  150.     if (%tpp.name.3 != $null) msg %tnick 04 $+ %tpp.name.3 $(|) %tpp.pokname.3 $(|) %tpp.nickname.3 $(|) %tpp.gender.3 $(|) %tpp.level.3 $(|) %tpp.held.3
  151.     if (%tpp.name.3 != $null) msg %tnick 07 $+ Moves: %tpp.move.31 $+ , %tpp.move.32 $+ , %tpp.move.33 $+ , %tpp.move.34 $(|) Ability: %tpp.ability.3
  152.     if (%tpp.name.4 != $null) msg %tnick 04 $+ %tpp.name.4 $(|) %tpp.pokname.4 $(|) %tpp.nickname.4 $(|) %tpp.gender.4 $(|) %tpp.level.4 $(|) %tpp.held.4
  153.     if (%tpp.name.4 != $null) msg %tnick 07 $+ Moves: %tpp.move.41 $+ , %tpp.move.42 $+ , %tpp.move.43 $+ , %tpp.move.44 $(|) Ability: %tpp.ability.4
  154.     if (%tpp.name.5 != $null) msg %tnick 04 $+ %tpp.name.5 $(|) %tpp.pokname.5 $(|) %tpp.nickname.5 $(|) %tpp.gender.5 $(|) %tpp.level.5 $(|) %tpp.held.5
  155.     if (%tpp.name.5 != $null) msg %tnick 07 $+ Moves: %tpp.move.51 $+ , %tpp.move.52 $+ , %tpp.move.53 $+ , %tpp.move.54 $(|) Ability: %tpp.ability.5
  156.     if (%tpp.name.6 != $null) msg %tnick 04 $+ %tpp.name.6 $(|) %tpp.pokname.6 $(|) %tpp.nickname.6 $(|) %tpp.gender.6 $(|) %tpp.level.6 $(|) %tpp.held.6
  157.     if (%tpp.name.6 != $null) msg %tnick 07 $+ Moves: %tpp.move.61 $+ , %tpp.move.62 $+ , %tpp.move.63 $+ , %tpp.move.64 $(|) Ability: %tpp.ability.6
  158.     msg %tnick %tpp.lastupdate
  159.   }
  160.   unset %info
  161.   unset %count*
  162.   unset %tnick
  163.   unset %tpp.*
  164. }
Advertisement
Add Comment
Please, Sign In to add comment