Advertisement
westor

!Rank addon (for patrick)

Nov 6th, 2014
393
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 2.09 KB | None | 0 0
  1. ON *:TEXT:!*:#: {
  2.   tokenize 32 $strip($1-,burci)
  3.   if ($1 == !rank) {
  4.     if (!$2-) { .msg $chan ( $+ $nick $+ ): Error, Not enough parameters, try again and enter the region! | return }
  5.     if (!$3-) { .msg $chan ( $+ $nick $+ ): Error, Not enough parameters, try again and enter the summoner name! | return }
  6.     rank $nick $chan $2 $urlencode($3-)
  7.   }
  8. }
  9.  
  10. alias rank {
  11.   if ($me !ison $2) { return }
  12.   if ($1 !ison $2) { return }
  13.   if (!$1-) { return }
  14.   var %u = https:// $+ $3 $+ .api.pvp.net/api/lol/ $+ $3 $+ /v1.4/summoner/by-name/ $+ $4 $+ ?api_key=API_CODE_HERE&nocache= $+ $ticks
  15.   var %v = twc_ $+ $ticks
  16.   JSONOpen -ud %v %u
  17.   if (%JSONError) { .msg $2 ( $+ $1 $+ ): Error, There was an connection error to the website, please try again later! | goto end | return }
  18.   var %n = $remove($urldecode($4),$chr(32))
  19.   var %id = $json(%v,%n,id)
  20.   var %name = $json(%v,%n,name)
  21.   if (!%id) { .msg $2 ( $+ $1 $+ ): Error, The $qt($urldecode($4-)) nickname or the region that you have enter are not vaild! | goto end | return }
  22.   var %uu = https:// $+ $3 $+ .api.pvp.net/api/lol/ $+ $3 $+ /v2.5/league/by-summoner/ $+ %id $+ /entry?api_key=API_CODE_HERE&nocache= $+ $ticks
  23.   var %vv = tws_ $+ $ticks
  24.   JSONOpen -ud %vv %uu
  25.   if (%JSONError) { .msg $2 ( $+ $1 $+ ): Error, There was an connection and parsing error to the website, please try again later! | goto end | return }
  26.   var %divi = $json(%vv,%id,0,entries,0,division)
  27.   var %lp = $json(%vv,%id,0,entries,0,leaguePoints)
  28.   var %tier = $json(%vv,%id,0,tier)
  29.   if (!%divi) { .msg $2 ( $+ $1 $+ ): Error, There is NOT any information founded on the website for $qt(%name - %id) user Name/ID! | goto end | return }
  30.   .msg $2 ( $+ $1 $+ ): $iif(%name,%name) is currently $upper($left($lower(%tier),1)) $+ $right($lower(%tier),-1) %divi and has $iif(!%lp,0 lp,%lp $+ LP)
  31.   :end
  32.   JSONClose %v
  33.   JSONClose %vv
  34. }
  35.  
  36. alias urlencode return $regsubex($1-,/([^a-z0-9])/ig,% $+ $base($asc(\t),10,16,2))
  37. alias urldecode {
  38.   var %r = $regsubex($replace($1, +, $chr(32)), /%([A-F\d]{2})/gi, $chr($base(\1, 16, 10)))
  39.   var %rr = $utfdecode(%r)
  40.   return %rr
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement