Leal9001

eRPK test 6

Aug 11th, 2012
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 3.36 KB | None | 0 0
  1. on *:text:*:#: {
  2.   if ($me == Gervasio) {
  3.     set %chan $chan
  4.     if ($1 == .fc) {
  5.       set %id $2
  6.       set %ver fc
  7.       set %url /citizen/profile/
  8.       if ($2 == $null) {
  9.         msg $chan Error: Insufficient parameters
  10.         halt
  11.       }
  12.       erpk
  13.     }
  14.     if ($1 == .fca) {
  15.       set %id 1
  16.       set %ver fca
  17.       if ($2 == $null) {
  18.         msg $chan Error: Insufficient parameters
  19.         halt
  20.       }
  21.       set %nick $2
  22.       set %url $+(/citizen/search/,%nick,/)
  23.       erpk
  24.       set %ver fc
  25.       set %url /citizen/profile/
  26.       erpk
  27.     }
  28.     if ($1 == .dist) {    
  29.       if ($2 == $null) msg $chan Error: Insufficient parameters |
  30.       set %ff $2
  31.       set %id $gettok($3,6,47)
  32.       set %ver dist
  33.       erpk
  34.     }
  35.     if ($1 == .battle) {
  36.       set %ver battle
  37.       set %id $2
  38.       set %url /battle/
  39.       erpk
  40.     }
  41.   }
  42. }
  43. alias erpk {
  44.   if ($sock(erpk)) { sockclose erpk }
  45.   sockopen erpk erpk-api.com 80
  46. }
  47.  
  48. on *:sockopen:erpk:{
  49.   sockwrite -n $sockname GET $+(,%url,%id,.json?key=wVYjogjGye) HTTP/1.1
  50.   sockwrite -n $sockname Host: erpk-api.com
  51.   sockwrite -n $sockname user-agent: Mozilla/??
  52.   sockwrite -n $sockname Connection: Keep-Alive
  53.   sockwrite -n $sockname $crlf
  54. }
  55. on *:sockread:erpk:{
  56.   if ($sockerr > 0) {
  57.     echo -a SOCKET ERROR: $sockerr
  58.     halt
  59.   }
  60.   sockread &t
  61.   var %sockreader $bvar(&t,$calc($bfind(&t,1,13 10 13 10) + 4) $+ -).text
  62.   if (%ver == fc) {
  63.     set %rankp $gettok(%sockreader,11,44)
  64.     set %rankp $gettok(%rankp,3,58)
  65.     set %str $gettok(%sockreader,10,44)
  66.     set %str $int($gettok(%str,2,58))
  67.     echo -a $(%str,2)
  68.     set %rankl $gettok(%sockreader,12,44)
  69.     set %rankl $gettok(%rankl,2,58)
  70.     set %rankn $gettok(%sockreader,14,44)
  71.     set %rankn $gettok(%rankn,2,58)
  72.     set %rankn $gettok(%rankn,1,34)
  73.     set %name $gettok(%sockreader,2,44)
  74.     set %name $noqt($gettok(%name,2,58))
  75.     set %dmgq0 $calc(((%rankl - 1) / 20 + 0.3) * ((%str / 10) + 40)*(1 + 0 / 100))
  76.     set %dmgq1 $calc(((%rankl - 1) / 20 + 0.3) * ((%str / 10) + 40)*(1 + 20 / 100))
  77.     set %dmgq2 $calc(((%rankl - 1) / 20 + 0.3) * ((%str / 10) + 40)*(1 + 40 / 100))
  78.     set %dmgq3 $calc(((%rankl - 1) / 20 + 0.3) * ((%str / 10) + 40)*(1 + 60 / 100))
  79.     set %dmgq4 $calc(((%rankl - 1) / 20 + 0.3) * ((%str / 10) + 40)*(1 + 80 / 100))
  80.     set %dmgq5 $calc(((%rankl - 1) / 20 + 0.3) * ((%str / 10) + 40)*(1 + 100 / 100))
  81.     set %dmgq6 $calc(((%rankl - 1) / 20 + 0.3) * ((%str / 10) + 40)*(1 + 120 / 100))
  82.     set %dmgq7 $calc(((%rankl - 1) / 20 + 0.3) * ((%str / 10) + 40)*(1 + 200 / 100))
  83.     msg %chan  $+ %name (Rank: %rankn [ $+ %rankl $+ ], Str: %str $+ ) 9:8:4: Q0: $int(%dmgq0) 9:8:4: Q1: $int(%dmgq1) 9:8:4: Q2: $int(%dmgq2) 9:8:4: Q3: $int(%dmgq3) 9:8:4: Q4: $int(%dmgq4) 9:8:4: Q5: $int(%dmgq5) 9:8:4: Q6: $int(%dmgq6) 9:8:4: Q7: $int(%dmgq7)
  84.     unset %ver
  85.   }
  86.   if (%ver == battle) {
  87.     set %region $gettok(%sockreader,6,44)
  88.     set %region $gettok(%region,2,58)
  89.     msg %chan %region
  90.     msg %chan $remove(%region,",})
  91.   }
  92.   if (%ver == fca) {
  93.     set %nickt $gettok(%sockreader,1,44)
  94.     set %nickt $gettok(%nickt,2,58)
  95.     if (%nick == %nickt) {
  96.       set %id $gettok(%sockreader,1,44)
  97.       set %id $gettok(%id,2,58)
  98.     }
  99.     else {
  100.       msg %chan Error: No citizen found with that name
  101.       halt
  102.     }
  103.   }
  104.   unset %chan
  105.   unset %id
  106. }
Advertisement
Add Comment
Please, Sign In to add comment