;IRcap8 5d392377c1039a9bf1dbd1318bec2ab0 alias Ajedrez { .enable #ajedrez if (!%ajed.skin) { %ajed.skin = 2D } | if (!%ajed.zoom) { %ajed.zoom = 100 | %ajed.zom = 100 } | if (!%ajed.crono) { %ajed.crono = $calc(60) } if $1 == >zoom { %aje.zoom = $2 | %ajed.zom = $2 | goto rezoom } unset %aje.* if ($2) { %aje.soyneg = 1 } aje.skin %ajed.skin %aje.spr = 8 1 2,8 2 3,8 3 4,8 4 $iif($2 == $null,5,6) $+ ,8 5 $iif($2 == $null,6,5) $+ ,8 6 4,8 7 3,8 8 2 %aje.spr = %aje.spr $+ ,7 1 1,7 2 1,7 3 1,7 4 1,7 5 1,7 6 1,7 7 1,7 8 1 %aje.spr = %aje.spr $+ ,2 1 7,2 2 7,2 3 7,2 4 7,2 5 7,2 6 7,2 7 7,2 8 7 %aje.spr = %aje.spr $+ ,1 1 8,1 2 9,1 3 10,1 4 $iif($2 == $null,11,12) $+ ,1 5 $iif($2 == $null,12,11) $+ ,1 6 10,1 7 9,1 8 8 :rezoom unset %aje.fzom2 ajedrez.win if $1 == >zoom { pinta | if (%aje.nick) aje.marcador | return } %aje.turno = N | if ($2) { %aje.turno = B } %aje.nick = $upper($me) | if ($1) { %aje.nick = $1 } if (!%tmp.ajecrono) { %tmp.ajecrono = %ajed.crono } %aje.cronoB = $calc(%tmp.ajecrono * 60) | %aje.cronoN = $calc(%tmp.ajecrono * 60) | unset %tmp.ajecrono pinta clear @ajedrez2 | aje.histo $s(2) | aje.histo %aje.nick var %a = $aje.stat(v,%aje.nick) | aje.histo $s(61) $+ : $+ $gettok(%a,5,32) $s(63) $+ : $+ $gettok(%a,8,32) $s(62) $+ : $+ $gettok(%a,6,32) ( $+ $gettok(%a,7,32) $+ % $+ ) aje.histo $s(3) $duration(%aje.cronoB,3) | aje.histo $asctime(HH:nn * dd/mm/yy) | aje.histo $str(*,16) %aje.nummo = 0 aje.turno } #ajedrez on alias -l aje.turno { if (%aje.turno == B) { %aje.turno = N } | else { %aje.turno = B } if (%aje.ultmovH) { inc %aje.nummo | aje.histo %aje.nummo $+ . %aje.ultmovH %aje.notex | unset %aje.ultmovH %aje.notex } .timerAJEDREZ off aje.marcador aje.crono | .timerAJEDREZ.crono -o 0 1 ajedrez.crono if (%aje.turno == B) || (%aje.nick == $me) { if ($aje.cjaque(%aje.turno)) { aje.histo << $s(4) >> | sss flod } .timerAJEDREZ -mo 0 200 ajedrezraton } } alias UCLICK.@ajedrez { if (!$inrect($mouse.x,$mouse.y,20,40,$gettok(%aje.fzom2,1,32),$gettok(%aje.fzom2,2,32))) || (!$timer(ajedrez)) return if (%aje.promopend) { aje.promo %aje.promopend | return } if (!%aje.sely) { var %a = $aje.inf(%aje.cuy,%aje.cux) if (%a) { if $gettok(%a,6,32) != %aje.turno return %aje.selx = %aje.cux %aje.sely = %aje.cuy aje.POM %aje.cux %aje.cuy sss clik pinta sel } return } if (%aje.selx %aje.sely == %aje.cux %aje.cuy) { rclick.@ajedrez | return } sss clik var %a = %aje.spr , %u = %aje.ultmov , %fg = %aje.flag if (R isin $aje.inf(%aje.sely,%aje.selx)) && (T isin $aje.inf(%aje.cuy,%aje.cux)) { var %selx = %aje.selx , %di if (%aje.cux == 8) && ($enrocalibre(%aje.sely,%aje.selx,%aje.cux) == si) { %di = 1 if (B isin $aje.inf(%aje.sely,%aje.selx)) { if (RB isin %aje.flag) || (T18 isin %aje.flag) || ($aje.amenaza(B,1 %aje.selx $+ -1 $calc(%aje.selx + 1) $+ -1 $calc(%aje.selx + 2))) { var %di } } if (N isin $aje.inf(%aje.sely,%aje.selx)) { if (RN isin %aje.flag) || (T88 isin %aje.flag) || ($aje.amenaza(N,8 %aje.selx $+ -8 $calc(%aje.selx + 1) $+ -8 $calc(%aje.selx + 2))) { var %di } } } if (%aje.cux == 1) && ($enrocalibre(%aje.sely,%aje.cux,%aje.selx) == si) { %di = -1 if (B isin $aje.inf(%aje.sely,%aje.selx)) { if (RB isin %aje.flag) || (T11 isin %aje.flag) || ($aje.amenaza(B,1 %aje.selx $+ -1 $calc(%aje.selx - 1) $+ -1 $calc(%aje.selx - 2))) { var %di } } if (N isin $aje.inf(%aje.sely,%aje.selx)) { if (RN isin %aje.flag) || (T81 isin %aje.flag) || ($aje.amenaza(N,8 %aje.selx $+ -8 $calc(%aje.selx - 1) $+ -8 $calc(%aje.selx - 2))) { var %di } } } if (%di) { %aje.noturno = 1 var %a = %aje.sely %selx %aje.sely $calc(%selx + (2 * %di)) , %b = %aje.cuy %aje.cux %aje.cuy $calc(%selx + (1 * %di)) | aje.mueve %b | var %u = %aje.ultmov | %aje.notex = 0-0 | aje.mueve %a if ($aje.cjaque(%aje.turno)) { %aje.spr = %a | %aje.ultmov = %u | %aje.flag = %fg | pinta | bip | return } aje.ctcp M %u * | aje.ctcp M %aje.ultmov 0-0 %aje.cronoB T aje.turno return } } if (!$findtok(%aje.pom,%aje.cuy %aje.cux,1,44)) { bip | return } if (P isin $aje.inf(%aje.sely,%aje.selx)) && (%aje.cuy == 8) { var %nt = * } aje.mueve %aje.sely %aje.selx %aje.cuy %aje.cux if ($aje.cjaque(%aje.turno)) { %aje.spr = %a | %aje.ultmov = %u | %aje.flag = %fg | unset %aje.notex | pinta | bip | return } if (P isin $aje.inf(%aje.cuy,%aje.cux)) { if (%aje.cuy == 8) { aje.promo promo %aje.ultmov | return } if (%aje.cuy == 1) && (%aje.nick == $me) { aje.promo promo %aje.ultmov | return } } aje.ctcp M %aje.ultmov %nt %aje.cronoB T aje.turno } alias -l enrocalibre { var %y = $1 , %x = $2 , %z = $3 | inc %x | dec %z while (%x <= %z) { if ($aje.inf(%y,%x)) { return no } inc %x } return si } alias RCLICK.@ajedrez { if (!$inrect($mouse.x,$mouse.y,20,40,$gettok(%aje.fzom2,1,32),$gettok(%aje.fzom2,2,32))) return unset %aje.selx %aje.sely %aje.pom pinta sel } alias -l aje.mueve { %aje.ultmov = $1- var %a = $aje.inf($1,$2) var %p = $gettok(%aje.spr,$gettok(%a,1,32),44) %p = $3 $4 $gettok(%a,4,32) var %h = $aje.inf($3,$4) %aje.spr = $puttok(%aje.spr,%p,$gettok(%a,1,32),44) if (%h) { %aje.spr = $deltok(%aje.spr,$gettok(%h,1,32),44) %aje.notex = %aje.notex x $+ $gettok(%h,5,32) } else { if ($gettok(%a,5,32) == P) { if ($gettok(%a,6,32) == B) && ($1 == 5) { var %ap = $aje.inf($calc($3 - 1),$4) | if (P N isin %ap) { %aje.spr = $deltok(%aje.spr,$gettok(%ap,1,32),44) | %aje.notex = $s(5) } } if ($gettok(%a,6,32) == N) && ($1 == 4) { var %ap = $aje.inf($calc($3 + 1),$4) | if (P B isin %ap) { %aje.spr = $deltok(%aje.spr,$gettok(%ap,1,32),44) | %aje.notex = $s(5) } } } } unset %aje.selx %aje.sely %aje.pom pinta %aje.ultmovH = $iif(%aje.turno == B,) $+ $gettok(%a,5,32) $+ $chr($calc(96 + $2)) $+ $1 > $gettok(%a,5,32) $+ $chr($calc(96 + $4)) $+ $3 if (T B isin %a) && ($1 $2 == 1 1) { %aje.flag = $addtok(%aje.flag,T11,32) } if (T B isin %a) && ($1 $2 == 1 8) { %aje.flag = $addtok(%aje.flag,T18,32) } if (R B isin %a) { %aje.flag = $addtok(%aje.flag,RB,32) } if (T N isin %a) && ($1 $2 == 8 1) { %aje.flag = $addtok(%aje.flag,T81,32) } if (T N isin %a) && ($1 $2 == 8 8) { %aje.flag = $addtok(%aje.flag,T88,32) } if (R N isin %a) { %aje.flag = $addtok(%aje.flag,RN,32) } } alias aje.CTCP if (%aje.nick != $me) { qc .ctcp %aje.nick AJEDREZ $1- | resetidle } alias aje.tablas { %tmp.aje.pido = tablas aje.fin T Tablas aje.ctcp TABLAS OK %aje.cronoB T } alias aje.promo { if $1 == promo { smenu aje.promo 60 $s(6) $+  $+ $s(7) $+  $+ $s(8) $+  $+ $s(9) | %aje.promopend = $1- | return } unset %aje.promopend var %f = $aje.inf($gettok(%aje.ultmov,3,32),$gettok(%aje.ultmov,4,32)) var %fe = 5 if ($1 == 2) { %fe = 2 } if ($1 == 3) { %fe = 4 } if ($1 == 4) { %fe = 3 } if ($gettok(%f,6,32) == B) { inc %fe 6 } %aje.spr = $puttok(%aje.spr,$gettok(%f,2-3,32) %fe,$gettok(%f,1,32),44) var %nf = $gettok($aje.inf($gettok(%aje.ultmov,3,32),$gettok(%aje.ultmov,4,32)),5,32) aje.ctcp M %aje.ultmov * aje.ctcp promo $gettok(%aje.ultmov,3-4,32) 0 0 %fe %nf %aje.cronoB T pinta %aje.notex = %aje.notex p $+ %nf aje.turno } alias -l pinta { drawpic -nc @ajedrezbuf 0 0 mod\ajedrez\ $+ %aje.fondo if (%aje.ultmov) { var %y1 = $gettok(%aje.ultmov,1,32) , %x1 = $gettok(%aje.ultmov,2,32) , %y2 = $gettok(%aje.ultmov,3,32) , %x2 = $gettok(%aje.ultmov,4,32) , %t1 = $gettok(%aje.tab,%y1,44) , %t2 = $gettok(%aje.tab,%y2,44) dec %x1 | dec %x2 drawline -rnd @ajedrezbuf $rgb(0,80,0) 3 $calc($gettok(%t1,1,32) + ($gettok(%t1,3,32) * %x1) + 1) $calc($gettok(%t1,2,32) - ($gettok(%t1,3,32) / 2.5) + 1) $calc($gettok(%t2,1,32) + ($gettok(%t2,3,32) * %x2) + 1) $calc($gettok(%t2,2,32) - ($gettok(%t2,3,32) / 2.5) + 1) drawrect -rnfd @ajedrezbuf $rgb(0,80,0) 1 $calc($gettok(%t1,1,32) + ($gettok(%t1,3,32) * %x1) - 4) $calc($gettok(%t1,2,32) - ($gettok(%t1,3,32) / 2.5) - 3) 12 10 16 16 drawline -rnd @ajedrezbuf $rgb(0,150,0) 3 $calc($gettok(%t1,1,32) + ($gettok(%t1,3,32) * %x1)) $calc($gettok(%t1,2,32) - ($gettok(%t1,3,32) / 2.5)) $calc($gettok(%t2,1,32) + ($gettok(%t2,3,32) * %x2)) $calc($gettok(%t2,2,32) - ($gettok(%t2,3,32) / 2.5)) drawrect -rnfd @ajedrezbuf $rgb(0,150,0) 1 $calc($gettok(%t1,1,32) + ($gettok(%t1,3,32) * %x1) - 5) $calc($gettok(%t1,2,32) - ($gettok(%t1,3,32) / 2.5) - 4) 12 10 16 16 } %aje.spr = $sorttok(%aje.spr,44,nr) if (%aje.cuy) { var %cursor = %aje.cuy %aje.cux 13 } if (%aje.sely) { var %cursor = %cursor $+ , $+ %aje.sely %aje.selx 14 } if (%aje.pom) { var %a , %i = 1 | :L3 | var %n = $gettok(%aje.pom,%i,44) | if (%n) { %a = $addtok(%a,%n 14,44) | inc %i | goto L3 } | var %cursor = %a $ + , $+ %cursor } var %i = 1 , %t = %cursor $+ , $+ %aje.spr | :L2 var %n = $gettok(%t,%i,44) | if (%n) { sprite %n inc %i | goto L2 } if (!%aje.fzom2) { %aje.fzom2 = $int($calc($gettok(%aje.fzom,1,32) / (100 / %aje.zoom))) $int($calc($gettok(%aje.fzom,2,32) / (100 / %aje.zoom))) } drawcopy -mn @ajedrezbuf 0 0 %aje.fzom @ajedrez 20 40 %aje.fzom2 | drawline @ajedrez } alias -l sprite { var %sp = $3 | if (%aje.soyneg) { if (%aje.rev) { if (%sp < 7) { inc %sp 6 } | else if (%sp > 6) && (%sp < 13) { dec %sp 6 } } } var %z = $calc(%aje.z * ($1 - 1)) var %tx = $int($calc(%aje.dx - (%aje.dx * %z / 100))) var %ty = $int($calc(%aje.dy - (%aje.dy * %z / 100))) var %l = $gettok(%aje.tab,$1,44) , %xi = $gettok(%l,1,32) , %yi = $gettok(%l,2,32) , %di = $gettok(%l,3,32) var %x = $calc(%xi + (%di * ($2 - 1))) , %y = %yi drawpic -nctms @ajedrezbuf $rgb(0,255,0) $calc(%x - (%tx / 2)) $calc(%y - %ty) %tx %ty $calc(%aje.dx * (%sp - 1)) 0 %aje.dx %aje.dy mod\ajedrez\ $+ %aje.fichas } alias -l ajedrez.zoomcord { unset %aje.tabz var %i = 1 | :L1 var %a = $gettok(%aje.tab,%i,44) | if (%a) { var %b = $int($calc($gettok(%a,1,32) / (100 / %aje.zoom))) $int($calc($gettok(%a,2,32) / (100 / %aje.zoom))) $calc($gettok(%a,3,32) / (100 / %aje.zoom)) %aje.tabz = $addtok(%aje.tabz,%b,44) inc %i | goto L1 } } alias -l ajedrez.win { window -c @ajedrez :L1 var %x = $int($calc(186 + $gettok(%aje.fzom,1,32) / (100 / %aje.zoom))) var %y = $int($calc(146 + $gettok(%aje.fzom,2,32) / (100 / %aje.zoom))) if (%x > $window(-3).w) || (%y > $window(-3).h) { dec %aje.zoom 5 | goto L1 } if (%y < 300) { %y = 300 } if (%x < 400) { %x = 400 } guiwin @ajedrez c c %x %y $s(T) var %n = 1, %s | :L2 | var %d = $finddir(mod\ajedrez\,*,%n,1) | if (%d) { %s = $addtok(%s,$nopath(%d),22) | inc %n | goto L2 } | %s = $sorttok(%s,22,a) %ajedrez.cb = $calc(%x - 124) $calc(%y - 51) 96 aje.zoom 25%50%75%-100%-125%150%175%200%300%400% $+ $s(10) $chr(124) $calc(%x - 124) $calc(%y - 31) 96 ajed.skin %s $+  $+ $s(11) %ajedrez.ls1 = 20 $calc(%y - 92) $calc(%x - 205) 4 1 0 ajenosel @ajedrez1 window -hl @ajedrez1 guilista @ajedrez ajedrez.ls1 %ajedrez.ls2 = $calc(%x - 156) 104 120 $int($calc((%y / 14) - 18)) 1 0 ajenosel @ajedrez2 window -hl @ajedrez2 guilista @ajedrez ajedrez.ls2 %ajedrez.bt = $calc(%x - 156) $calc(%y - 140) 122 return -| $calc(%x - 156) $calc(%y - 105) 50 ajedrez.menu_w $s(12) $chr(124) $calc(%x - 84) $calc(%y - 105) 50 ajedrez.menu_j $s(13 ) $chr(124) $calc(%x - 156) $calc(%y - 80) 122 ajedrez.menu_st $s(T) aje.botonera %ajedrez.tx = 20 $calc(%y - 33) $calc(%x - 185) aje.chat guidib @ajedrez window -wa @ajedrez ajedrez.zoomcord } alias -l aje.botonera { var %a = $gettok($gettok(%ajedrez.bt,1,124),1-3,32) if ($1 == restaura) { %a = %a ajedrez.menu_rea $s(14) } else if (!%aje.fin) { %a = %a ajedrez.menu_o $s(15) } else { if (%aje.soyneg) { %a = %a ajedrez.menu_rn $s(16) } else { %a = %a return - } } %ajedrez.bt = $puttok(%ajedrez.bt,%a,1,124) } alias -l AJEDREZraton { if ($mouse.win != @ajedrez) || (!$inrect($mouse.x,$mouse.y,20,40,$gettok(%aje.fzom2,1,32),$gettok(%aje.fzom2,2,32))) return var %x = $calc($mouse.x - 20) , %y = $calc($mouse.y - 40) , %ry = %aje.cuy , %rx = %aje.cux var %i = 1 , %m = 999 | :l1 var %n = $gettok($gettok(%aje.tabz,%i,44),2,32) | if (%n) { var %d = $abs($calc((%n - $calc(($gettok(%aje.tabz,2,32) - $gettok(%aje.tabz,-2,32)) / 16)) - %y)) if %m > %d { %m = %d | var %yy = %i } inc %i | goto L1 } var %i = $gettok(%aje.tabz,%yy,44) %aje.cuy = %yy | %aje.cux = $int($calc((%x - $gettok(%i,1,32) + ($gettok(%i,3,32) / 2) ) / $gettok(%i,3,32) + 1)) if (%aje.cux < 1) || (%aje.cux > 8) { return } if (%yy) { if (%rx != %aje.cux) || (%ry != %aje.cuy) { pinta cursor } } } alias -l aje.inf { var %i = 1 | :L1 var %a = $gettok(%aje.spr,%i,44) | if (%a) { if ($gettok(%a,1-2,32) == $1 $2) { return %i %a $aje.pieza($gettok(%a,3,32)) $iif(($gettok(%a,3,32) > 6),B,N) } inc %i | goto L1 } } alias -l aje.pieza return $gettok(P T C A D R P T C A D R,$1,32) alias -l aje.POM { unset %aje.pom var %f = $gettok($aje.inf($2,$1),5,32) , %c = $gettok($aje.inf($2,$1),6,32) goto %f :D di $1- -1 0 8 di $1- -1 1 8 di $1- 0 1 8 di $1- 1 1 8 di $1- 1 0 8 di $1- 1 -1 8 di $1- 0 -1 8 di $1- -1 -1 8 goto L1 :R di $1- -1 0 1 di $1- -1 1 1 di $1- 0 1 1 di $1- 1 1 1 di $1- 1 0 1 di $1- 1 -1 1 di $1- 0 -1 1 di $1- -1 -1 1 goto L1 :A di $1- -1 1 8 di $1- 1 1 8 di $1- 1 -1 8 di $1- -1 -1 8 goto L1 :T di $1- -1 0 8 di $1- 0 1 8 di $1- 1 0 8 di $1- 0 -1 8 goto L1 :P if %c == B { if (!$aje.inf($calc($2 + 1),$1)) di $1- 0 1 1 if ($2 == 2) { if (!$aje.inf($calc($2 + 2),$1)) && (!$aje.inf($calc($2 + 1),$1)) di $1- 0 1 2 } if ($aje.inf($calc($2 + 1),$calc($1 - 1))) di $1- -1 1 1 if ($aje.inf($calc($2 + 1),$calc($1 + 1))) di $1- 1 1 1 if ($2 == 5) { if (%aje.ultmov == 7 $calc($1 + 1) 5 $calc($1 + 1)) di $1- 1 1 1 | if (%aje.ultmov == 7 $calc($1 - 1) 5 $calc($1 - 1)) di $1- -1 1 1 } } if %c == N { if (!$aje.inf($calc($2 - 1),$1)) di $1- 0 -1 1 if ($2 == 7) { if (!$aje.inf($calc($2 - 2),$1)) && (!$aje.inf($calc($2 - 1),$1)) di $1- 0 -1 2 } if ($aje.inf($calc($2 - 1),$calc($1 - 1))) di $1- -1 -1 1 if ($aje.inf($calc($2 - 1),$calc($1 + 1))) di $1- 1 -1 1 if ($2 == 4) { if (%aje.ultmov == 2 $calc($1 + 1) 4 $calc($1 + 1)) di $1- 1 -1 1 | if (%aje.ultmov == 2 $calc($1 - 1) 4 $calc($1 - 1)) di $1- -1 -1 1 } } goto L1 :C di $1- -2 1 di $1- -1 2 di $1- 2 1 di $1- 1 2 di $1- -2 -1 di $1- -1 -2 di $1- 2 -1 di $1- 1 -2 goto L1 :L1 } alias -l DI { var %x = $1 , %y = $2 , %w = $3 , %h = $4 , %n = $5 , %c = $gettok($aje.inf(%y,%x),6,32) :L1 inc %x %w | inc %y %h if (%x < 1) || (%x > 8) || (%y < 1) || (%y > 8) return var %cc = $gettok($aje.inf(%y,%x),6,32) if (%cc) { if (%cc != %c) { %aje.pom = $addtok(%aje.pom,%y %x,44) } return } %aje.pom = $addtok(%aje.pom,%y %x,44) dec %n | if %n > 0 goto L1 } alias -l DI2 { var %x = $1 , %y = $2 , %w = $3 , %h = $4 , %c = $gettok($aje.inf(%y,%x),6,32) inc %x % %aje.pom = $addtok(%aje.pom,%y %x,44) } alias ajedrez.cierra .timerAJEDREZ* off | if (!%aje.sefue) { if (!%aje.fin) { aje.ctcp Q | aje.stat - %aje.nick } | aje.ctcp CV } | window -c @ajedrezbuf | unset %aje.* | .disable #ajedrez alias -l aje.skin { var %c = mod\ajedrez\ $+ $1 $+ \ajskin.ini %aje.tab = $readini(%c,ajedrez,xyz) %aje.z = $readini(%c,ajedrez,zoom) %aje.dx = $readini(%c,ajedrez,ancho) %aje.dy = $readini(%c,ajedrez,alto) %aje.fzom = $readini(%c,ajedrez,tabla) %aje.fichas = $1 $+ \ $+ $readini(%c,ajedrez,fichas) %aje.fondo = $1 $+ \ $+ $readini(%c,ajedrez,tablero) unset %aje.rev | if ($readini(%c,ajedrez,neg) == 1) { %aje.rev = 1 } %ajed.skin = $1 drawpic -c | window -c @ajedrezbuf | window -pBwh +d @ajedrezbuf 100 100 %aje.fzom ajedrez >zoom %ajed.zom } alias ctcp.ajedrez.nosonido if $nick == %aje.nick return $true | else return $false alias ctcp.ajedrez.noecho if $nick == %aje.nick return $true | else return $false alias -l aje.cjaque { var %t = $ticks var %j var %n = 1 | :L1 | var %a = $gettok(%aje.spr,%n,44) | if (%a) { if ($gettok(%a,3,32) == 6) { var %rn = $gettok(%a,1-2,32) } | if ($gettok(%a,3,32) == 12) { var %rb = $gettok(%a,1-2,32) } | inc %n | goto L1 } if (N isin $1) { var %n = 1 | :L2 | var %a = $gettok(%aje.spr,%n,44) | if (%a) { if ($gettok(%a,3,32) > 6) { aje.pom $gettok(%a,2,32) $gettok(%a,1,32) | if ($findtok(%aje.pom,%rn,1,44)) { %j = %j $+ N } } inc %n | goto L2 } } if (B isin $1) { var %n = 1 | :L3 | var %a = $gettok(%aje.spr,%n,44) | if (%a) { if ($gettok(%a,3,32) < 7) { aje.pom $gettok(%a,2,32) $gettok(%a,1,32) | if ($findtok(%aje.pom,%rb,1,44)) { %j = %j $+ B } } inc %n | goto L3 } } unset %aje.pom return %j } alias -l aje.amenaza { var %t = $ticks var %j if (B isin $1) { var %n = 1 | :L1 | var %a = $gettok(%aje.spr,%n,44) | if (%a) { if ($gettok(%a,3,32) < 7) { aje.pom $gettok(%a,2,32) $gettok(%a,1,32) var %m = 1 | :L2 | var %r = $gettok($2-,%m,45) | if (%r) { if ($findtok(%aje.pom,%r,1,44)) { %j = $addtok(%j,%r,44) } inc %m | goto L2 } } inc %n | goto L1 } } if (N isin $1) { var %n = 1 | :L4 | var %a = $gettok(%aje.spr,%n,44) | if (%a) { if ($gettok(%a,3,32) > 6) { aje.pom $gettok(%a,2,32) $gettok(%a,1,32) var %m = 1 | :L5 | var %r = $gettok($2-,%m,45) | if (%r) { if ($findtok(%aje.pom,%r,1,44)) { %j = $addtok(%j,%r,44) } inc %m | goto L5 } } inc %n | goto L4 } } unset %aje.pom return %j } alias onCOMBO.@ajedrez { if $1 == aje.zoom { ajedrez >zoom $remove(%aje.zoom,%) } if $1 == ajed.skin { aje.skin %ajed.skin } } alias -l aje.marcador { var %x = $calc($window(@ajedrez).w - 156) cuagi @ajedrez %x 40 140 55 $rgb(40,40,40) var %c1 = $rgb(255,255,255) , %t1 = 11 , %c2 = $rgb(100,100,100) , %t2 = 9 | if %aje.turno == N { %c1 = %c2 | %t1 = %t2 | var %c2 = $rgb(255,255,255) , %t2 = 11 } var %t = $me $iif(%aje.turno == N,* $duration(%aje.cronoB,3)) , %xx = $calc(%x + 70 - ($width(%t,verdana,%t1,1) / 2)) | if %xx < %x { %xx = %x } | drawtext -ocnr @ajedrez %c1 Verdana %t1 %xx 80 140 14 %t var %t = %aje.nick $iif(%aje.turno == B,* $duration(%aje.cronoN,3)) , %xx = $calc(%x + 70 - ($width(%t,verdana,%t2,1) / 2)) | if %xx < %x { %xx = %x } | drawtext -ocnr @ajedrez %c2 Verdana %t2 %xx 42 140 14 %t drawline @ajedrez } alias -l aje.crono { drawtext -ocnrb @ajedrez $rgb(255,255,255) $rgb(40,40,40) Verdana 20 $calc($window(@ajedrez).w - 135) 55 99 24 $duration(% [ $+ [ aje.crono $+ [ %aje.turno ] ] ],3) drawline @ajedrez } alias -l ajedrez.crono { var %a = % [ $+ [ aje.crono $+ [ %aje.turno ] ] ] dec %a if %a == 0 { if (%aje.turno == B) aje.ctcp TIEMPO if (%aje.nick == $me) aje.fin $iif(%aje.turno == B,N,B) $s(17) else { if (%aje.turno == B) aje.fin N $s(17) } } if (%a < 0) { %a = 0 } | % [ $+ [ aje.crono $+ [ %aje.turno ] ] ] = %a aje.crono } alias -l aje.histo { var %a = $1- if ($3 == >) { var %t = $s(1) %a = $replacexCS($1-,P,$gettok(%t,1,44),T,$gettok(%t,2,44),C,$gettok(%t,3,44),A,$gettok(%t,4,44),D,$gettok(%t,5,44),R,$gettok(%t,6,44)) } aline @ajedrez2 %a %ajedrez.ls2 = $puttok(%ajedrez.ls2,$line(@ajedrez2,0),5,32) guilista @ajedrez ajedrez.ls2 drawline @ajedrez } alias -l aje.fin { .timerajedrez* off %aje.fin = 1 aje.marcador | aje.crono aje.histo $str(*,16) aje.histo $s(18) aje.histo $2- if ($1 !isin TC) aje.histo $s(19) $iif($1 == B,$me,%aje.nick) aje.histo $asctime(HH:nn * dd/mm/yy) aje.botonera | guidib @ajedrez if $1 == B aje.stat + %aje.nick | if $1 == N aje.stat - %aje.nick | if $1 == T aje.stat T %aje.nick } alias onEDIT.@ajedrez { if (%aje.chat) { aje.ctcp C %aje.chat aje.chat $strip($timestamp) < $+ $me $+ > %aje.chat | unset %aje.chat } } on 1:KEYDOWN:@ajedrez:*: if (%ajedrez.tx) { guipulsatx 20 $calc($window(@ajedrez).h - 33) 20 $calc($window(@ajedrez).h - 33) $calc($window(@ajedrez).w - 185) aje.chat | editbox -a $keychar } alias -l aje.Chat { if $1- == refres { guilista @ajedrez ajedrez.ls1 | guidib @ajedrez | return } var %l = $1- , %w = $calc($window(@ajedrez).w - 210) , %n = $wrap(%l,verdana,9,%w,0) , %i = 1 | while (%i <= %n) { aline @ajedrez1 $wrap(%l,verdana,9,%w,%i) | inc %i } :L1 | if ($line(@ajedrez1,0) > 25) { dline @ajedrez1 1 | goto L1 } %ajedrez.ls1 = $puttok(%ajedrez.ls1,$line(@ajedrez1,0),5,32) %ajedrez.ls1 = $puttok(%ajedrez.ls1,0,6,32) .timerajedrezCHAT -m 1 50 aje.chat refres write " $+ $logdir $+ $mkfn(%aje.nick) $+ .log" $strip($1-) } alias ajenosel sline -r @ajedrez1 | aje.chat refres alias -l turno if %aje.turno == B return $me | else return %aje.nick alias ajedrez.menu { goto $1 :o if (%aje.fin) return smenu ajedrez.menu_sm 160 $s(20) - $s(21) - $s(22) return :sm if $2 == 1 { if (!$aje.cjaque(%aje.turno)) { sss fallo | return } aje.ctcp JMATE %aje.cronoB T aje.fin $iif(%aje.turno == B,N,B) $s(23) return } if $2 == 3 { set -u180 %tmp.aje.pido tablas | aje.ctcp TABLAS | aje.histo * $s(25) | if %aje.nick == $me aje.tablas } if $2 == 5 { aje.fin N $me $s(26) | aje.ctcp Q } return :w | url $urlcap $+ /fset/ajedrez.html | return :j | j $s(27) | return :st smenu ajedrez.menu_sm2 160 $s(28) ( %ajed.crono m.)- $s(29) - $s(30) return :rn %aje.reto = %aje.nick | ctcp %aje.nick AJEDREZ reto %ajed.crono $aje.version %ircapv $version return :rea if ($gettok(%tmp.aje.restaura,1,32) != $me) { aje.histo * $s(31) | aje.histo * $gettok(%tmp.aje.restaura,1,32) | fallo | return } set -u180 %tmp.aje.pido rest %aje.nick aje.ctcp REST %tmp.aje.restaura return :sm2 if $2 == 1 { %ajed.crono = $$?="$s(32) %ajed.crono )" | return } if $2 == 5 { aje.stat w %aje.nick | return } if $2 == 3 { var %a = $sfile($logdir $+ \ajedrez- $+ $mkfn(%aje.nick) $+ - $+ $remove($date $+ $time,/,:) $+ .log) if (%a) savebuf @ajedrez2 " $+ %a $+ " return } } raw 401:*: if $2 == %aje.nick { %aje.sefue = on | if (!%aje.fin) aje.fin C $s(33) | aje.chat *** %aje.nick $s(34) | aje.restaura g } on 1:disconnect: if (!%aje.fin) { aje.fin C $s(35) | aje.restaura g } on 1:nick: if ($nick == $me) && (!%aje.fin) { aje.fin C $s(36) | aje.restaura g } #ajedrez end menu menubar { $lower($s(T)) .$s(39): ajedrez .- .$s(28) ( %ajed.crono m.): %ajed.crono = $$?=" $s(32) %ajed.crono )" .- .$s(38): aje.stat w } menu nicklist,query { $lower($s(T)) .$s(37) ( %ajed.crono m.): if $1 == $me { ajedrez } | else { %aje.reto = $1 | ctcp $1 AJEDREZ reto %ajed.crono $aje.version %ircapv $version } .- .$s(38): aje.stat w $1 .$s(40) $active: var %a = $aje.stat(v,$1) | say $s(T) $+ : $s(41) $+  $1 $+ : $gettok(%a,5,32) / $s(42) $+ : $gettok(%a,6,32) ( $+ $gettok(%a,7,32) $+ % $+ ) / $s(43) $+ : $gettok(%a,8,32) } alias -l aje.version return 1.0 CTCP 1:AJEDREZ: { if ($2 == RETO) { if $3 == OK { if $nick == %aje.reto { %tmp.ajecrono = %ajed.crono | ajedrez $nick } | return } if ($4 != $aje.version) { qc notice $nick $s(T) $+ : $s(44) | return } if ($window(@ajedrez)) && (!%aje.sefue) && ($nick != %aje.nick) { qc notice $nick $s(T) $+ : $s(45) | return } %tmp.ajecrono = $3 pregunta $nick $s(46) ( $+ $s(3) $+ : $duration($calc($3 * 60),3) $+ )  aje.acepto $nick  qc .notice $nick $s(47) return } if ($2 == REST) { if $3 == OK { if (%tmp.aje.pido != rest $nick) return unset unset %tmp.aje.pido | aje.restaura i 0 %tmp.aje.restaura | return } pregunta $nick $s(48)  aje.restaura i 1 $3-  qc .notice $nick $s(47) return } if $nick != %aje.nick return inc -u15 %tmp.ajeflod 1 | if (%tmp.ajeflod < 10) { %cflod = $remove(%cflod,$site) } if $2 == Q { if (!%aje.fin) aje.fin B %aje.nick $s(26) | return } if $2 == CV { aje.chat *** %aje.nick $s(50) | %aje.sefue = on | unset %ajedrez.tx | return } if $2 == C { aje.chat $strip($timestamp) < $+ %aje.nick $+ > $3- | return } if (%aje.fin) { inc -u20 %tmp.ajeflod 2 | aje.ctcp C $s(51) | return } if ($gettok($3-,-1,32) == T) { %aje.cronoN = $gettok($3-,-2,32) } if $2 == JMATE { aje.fin B $s(23) | return } if ($2 == TABLAS) { if $2- == TABLAS { pregunta $nick $s(52)  aje.tablas  aje.ctcp TABLAS NO | return } if $2-3 == TABLAS NO { unset %tmp.aje.pido | aje.histo * $s(53) | return } if $2-3 == TABLAS OK { if (%tmp.aje.pido == tablas) { aje.fin T $s(43) | unset %tmp.aje.pido } | return } } var %y = $calc(9 - $3) , %x = $calc(9 - $4) , %y1 = $calc(9 - $5) , %x1 = $calc(9 - $6) if $2 == M { if (0-0 isin $3-) { %aje.notex = 0-0 } aje.mueve %y %x %y1 %x1 if (* !isin $3-) aje.turno } if $2 == PROMO { var %a = $aje.inf(%y,%x) %aje.spr = $puttok(%aje.spr,%y %x $calc($7 - 6),$gettok(%a,1,32),44) pinta %aje.notex = %aje.notex p $+ $8 aje.turno } if $2 == TIEMPO { aje.fin B $s(17) } } alias aje.acepto .timer 1 1 ajedrez $1 1 | .ctcp $1 AJEDREZ RETO OK | unset %cflod alias aje.restaura { if $1 == g { %tmp.aje.restaura = $me %aje.nick %aje.turno $iif((%aje.soyneg),1,0) %aje.cronoB %aje.cronoN %aje.nummo - $+ $replace(%aje.flag,$chr(32),-) %aje.spr aje.botonera restaura guidib @ajedrez } if $1 == i { .enable #ajedrez unset %aje.* %aje.nick = $iif($2 == 1,$3,$4) %aje.turno = $5 | if $2 == 0 { %aje.turno = $iif($5 == B,N,B) } if ($6 == 0) && ($2 == 1) { %aje.soyneg = 1 } | if ($6 == 1) && ($2 == 0) { %aje.soyneg = 1 } %aje.cronoN = $iif($2 == 1,$7,$8) %aje.cronoB = $iif($2 == 1,$8,$7) %aje.nummo = $9 %aje.flag = $replace($10,-,$chr(32)) %aje.spr = $11- if $2 == 1 { var %n = 1 , %nu | :L1 var %a = $gettok(%aje.spr,%n,44) | if (%a) { var %f = $gettok(%a,3,32),44) | if (%f > 6) { dec %f 6 } | else { inc %f 6 } %nu = $addtok(%nu,$calc(9 - $gettok(%a,1,32)) $calc(9 - $gettok(%a,2,32)) %f,44) inc %n | goto L1 } %aje.spr = %nu %aje.flag = $replacex(%aje.flag,RB,RN,RN,RB,T11,T88,T88,T11,T18,T81,T81,T18) aje.ctcp REST OK } .timer 1 1 ajedrez.win .timer 1 1 aje.skin %ajed.skin .timer 1 1 pinta .timer 1 1 aje.turno .timer 1 1 aje.histo * $s(54) } } alias aje.stat { if $1 == w { .load -rs mod\ajedrez\ajedrezstats.mrc | ajedrezstats $2 | return } var %j = $replace($2,$chr(124),!) var %f = usr\ajedrezstats.ini , %t = $readini(%f,%j,t) , %g = $readini(%f,%j,g) , %e = $readini(%f,%j,e) , %gt = $readini(%f,global.,t) , %gg = $readini(%f,global.,g) , %ge = $readini(%f,global.,e) if $1 == + || $1 == - || $1 == T { inc %gt | writeini %f global. t %gt inc %t | writeini %f %j t %t } if $1 == + { inc %g | writeini %f %j g %g inc %gg | writeini %f global. g %gg } if $1 == T { inc %e | writeini %f %j e %e inc %ge | writeini %f global. e %ge } if $1 == v { return $nonull(%gt) $nonull(%gg) $nonull($round($calc((%gg * 100) / %gt),1)) $nonull(%ge) $nonull(%t) $nonull(%g) $nonull($round($calc((%g * 100) / %t),1)) $nonull(%e) } if $1 == b { remini usr/ajedrezstats.ini %j | if %j == - remove usr/ajedrezstats.ini } } alias -l S return $hget(ajedrez,$1) on 1:SIGNAL:idioma: if ($1 != $2) { hload ajedrez "lng\ $+ %idioma $+ \ajedrez.lnh" } on 1:unload: { window -c @ajedrez | window -c @ajedrez1 | window -c @ajedrez2 | window -c @ajedrezbuf | window -c @ajedrezstats unset %aje.* %ajed.* %ajedrez* | .timerAjedrez* off | hfree ajedrez } on 1:start: if (!%ajed.crono) { %ajed.crono = 30 } | .disable #ajedrez | .hmake -s ajedrez | hload ajedrez "lng\ $+ %idioma $+ \ajedrez.lnh" ;EOF