Friday, 21 October 2011

remote socket revenge

#socketsaufi off
on 1:start: { .debug -i @war war }
on *:sockopen:kicker-*:{
  var %raw, %me = $hx(me), %sx = sockwrite -n $sockname
  var %user $lower($regsubex(%me,/\W/g,))
  %sx USER $r(A,Z) $+  $r(0,9) $sock($sockname).ip $sock($sockname).ip * * : $logo
  %sx NICK %warbot
  .sockmark %sockname *
  .notify %me
  sx * privmsg ReopServ OP %c 123456
  .sockwrite -nt * join %c
  if (%k) { $kiss }
}
alias kiss {
  inc -u2 %kill
  if (%kill isnum 1-200) {
    .timerR4 -hmc 100 10 sx $sock(kicker-*).name kick %c %k $logo | sx $sock(kicker-*).name kick %c %k $logo
  }
}
on *:SOCKCLOSE:*: { .halt }
on *:signal:re: { $kiss | halt }
on *:signal:W: { $kiss | halt }
on *:signal:r4: { $kiss | halt }
on *:signal:r3: { $kiss | halt }
on *:signal:M: { $kiss | halt }
on *:signal:K: { $kiss | halt }
on *:signal:X: { $kiss | halt }
on *:signal:N: { $kiss | halt }
on *:signal:J: { sx $sock(kicker-*).name join %c | halt }
on *:sockread:kicker-*:{
  if ($sockerr > 0) { return }
  :loop
  var %me = $hx(me)
  sockread %raw | tokenize 32 %raw
  if ($sockbr == 0) { return }
  if ($1 == PING) { sockwrite -n $sockname PONG $2 }
  if ($regex($1,^ERROR)) { .sockclose * | .echo -a Remote Quit | F2 }
  if ($2 == 441) { if (%k) { .signal -n K } }
  if ($2 == MODE) { if $gettok(%raw,4,32) == +o && $gettok(%raw,5-,32) == %me { if (%k) { .signal -n M } } }
  if ($2 == JOIN) { if $remove($gettok(%raw,1,33),$chr(58)) == %wmusuh { if (%k) { .signal -n X } } }
  ; if ($2 == KICK) { if (%me == $4) && ($sn($1) != BattleServ) && ($sn($1) != %me) { .set %k $sn($1) | .inc %kick. $+ %k | sx * privmsg ReopServ OP %c 123456 | .signal -n J | .signal -n K | halt } | if ($sn($1) == %k) { .signal -n re | halt } }
  if ($gettok(%mafia.buffer,2,32) == KICK) { if (%me == $4) && ($sn($1) == %n { .sockwrite -n kicker-* $str(kick %c,1) $gettok(%mafia.buffer,4,32) $logo } }
  if ($gettok(%mafia.buffer,2,32) == KICK) { if (%me == $4) && ($sn($1) == %botnick { set %c $gettok(%mafia.buffer,3,32) | set %n $gettok($right(%mafia.buffer,-1),1,33) | .sockwrite -n kicker-* join #rekick | .sockwrite -n kicker-* $str(kick %c %n ,1) $logo } }
  if ($2 == 474) { .timers off | .unset %k* %join* %p* %mekick | timera 1 11 .sockwrite -n kicker-* join %c | timerb 1 22 .sockwrite -n kicker-* PRIVMSG %c ~waroff $logo | .halt }
  goto loop
}
;if ($notify(0) > 0) { var %nl = $notify(0) | while %nl > 0 { /notify -r $notify(%nl) | .dec %nl } | .notify %me } |
alias war {
  tokenize 32 $1- | var %event = $3
  if (%event == 600) { $iif(%k,.signal -n N) | if (%k) { .signal -n W } | halt }
  if (%event == 601) { $iif(%k,.signal -n N) | if (%k) { .signal -n W } | halt }
  if (%event == 602) { $iif(%k,.signal -n N) | if (%k) { .signal -n W } | halt }
  if (%event == 603) { $iif(%k,.signal -n N) | if (%k) { .signal -n W } | halt }
  if (%event == 604) { $iif(%k,.signal -n N) | if (%k) { .signal -n W } | halt }
  if (%event == 605) { $iif(%k,.signal -n N) | if (%k) { .signal -n W } | halt }
  if (%event == 606) { $iif(%k,.signal -n N) | if (%k) { .signal -n W } | halt }
  if (%event == 607) { $iif(%k,.signal -n N) | if (%k) { .signal -n W } | halt }
}
on *:unotify:{ if ( $nick == %warbot ) { .sockclose * | F2 | .echo -a $time %warbot  4,4** 1,0 Bot DisConnected 4,4** | halt } }
on *:notify: { if ( $nick == %warbot ) { .sockwrite -nt * join %c | if (%k) { .signal -n W } | .echo -a $time %warbot 4,4** 1,0 Bot Connected 4,4** } }
alias sz { sockclose * | /echo -a Remote Quit | F2 }
alias logo return 12,12 *** 0TEST TEST TEST 12***
alias F5 notify TEST | .set %warbot TEST | .set %serv birc.mine.nu | .set %sport 6667 | .set %c #rekick | .kickerbot
alias F1 /hfree -sw foes | .unset %k* %join* %p* %mekick | .sockwrite -n * privmsg %c ~waroff $logo
alias F2 /kickerbot %warbot %serv %sport
alias F7 hfree -sw kicker-* | hfree -sw foes | unset %k | hax chan $iif($?="What is your War Channel?",$v1,#rekick) | .set %c $hxx(chan) | .set %rj 0 | hax bn 1 | /sockclose *
alias sx { .sockwrite -nt $mid($1-,1) }
alias sn { return $iif($pos($1,!),$mid($1,2,$calc($v1 - 2)),$right($1,-1)) }
alias hax { hadd -m x $1- }
alias hb { hadd -m $sockname $1- }
alias hi { hinc x $1- }
alias hx { return $hget($sockname,$1) }
alias hxx { return $hget(x,$1) }
alias kickerbot { var %nick $1, %serv = $2, %sockname = $+(kicker-,%nick) | if !%serv || %serv isnum { echo -a /kickerbot TEST birc.mine.nu 6667 | return } | elseif $regex($2,^(.*):(.*)$) { var %serv $regml(1), %port = $regml(2) } | elseif $regex($2,^(.*)$) { var %serv $regml(1), %port = 6667 } | .sockopen %sockname %serv %sport | .hadd -m %sockname me %nick }
menu * {
  LOAD:/F2
  JOIN :  sockwrite -tn * join #
  KICK:.set %k $$1 | .timer -m 270 10 .sockwrite -tn * kick #rekick %k $logo
  PART : sockwrite -tn * part #
  CLEAR: unset %k | timers off | .echo -a * revenge clear | timer 1 7 .sockwrite -n * privmsg # ~waroff
  QUIT:.timers off | /notify -r $notify(1) | /sx * part %c | /sockclose *
}
on 1:input:*:{
  if (/c isin $1) { F1 | halt }
  if (/k isin $1) { .set %k $2- | .timer -m 60 10 .sockwrite -tn * kick %c $2- $logo | halt }
  if (/h isin $1) { sockwrite -tn * part %c | sockwrite -tn * join %c | halt }
  if (/r isin $1) { F2 | halt }
  if (/q isin $1) { sockwrite -tn * quit | sockclose * | .notice $me 4,4** 1,0 Bot Close 4,4** | halt }
}
#socketsaufi end

No comments:

Post a Comment