Yoko

All sides of Injection
It is currently 2025-10-12 12:08:32

All times are UTC+02:00




Post new topic  Reply to topic  [ 4 posts ] 
Author Message
PostPosted: 2010-11-29 19:40:37 
Offline
User avatar

Joined: 2010-10-01 16:47:41
Posts: 75
Итак, дамы и господа, WikiLeaks опубликовали информационную бомбу, а мы публикуем свою, мааааленькую бомбочку ;)
Представляю сабж на ваш суд:

Code:
######## Антиантимакрос для шарда Абисс ###########
# (c) GMX
# Скрипт актуален на 29.11.2010 г.
#

sub antiabyss()
    # Основная функция.
    # Выбирает шесть контрольных точек на нарисованной цифре,
    # измеряет между ними расстояние, сверяется с шаблоном и
    # нажимает нужную кнопочку
    var res1, res2, res3, res4, res5, res6, result, counter, choice
    counter=0
    result=0
    res1=testn(1,4)  # выбираем контрольные точки
    res2=testn(4,5)
    res3=testn(7,8)
    res4=testn(8,11)
    res5=testn(5,8)
    res6=testn(2,3)
    if (res1>20 and res2>20 and res3>20 and res4>20) and res6<14 then  # двойка
       uo.print("Possibly 2!!!!!")
       result=2
    end if
    if (res1>20 and res2>20 and res3<14 and res4<14) then              # тройка
       uo.print("Possibly 3!!!!!")
       result=3
    end if
    if (res1<14 and res2<14 and res3<14 and res4<14) then              # пятерка
       uo.print("Possibly 5!!!!!")
       result=5
    end if
    if (res1>17 and res2<14 and res3>17 and res4<14) then              # шестерка
       uo.print("Possibly 6!!!!!")
       result=6
    end if
    if (res1>17 and res2>17 and res5<14) and res6>16 then              # восьмерка
       uo.print("Possibly 8!!!!!")
       result=8
    end if
    if (res1<14 and res2>17 and res3<14 and res4>17) then              # девятка
       uo.print("Possibly 9!!!!!")
       result=9
    end if
    choice=choose(result)  # выбираем нужный результат
    uo.print("Choice №"+str(choice))
    uo.print('++++++++++++++')
    uo.print("Pressing...")
    if choice==1 then      # и жмем на нужную кнопку
        uo.lclick(163,199)
    end if
    if choice==2 then
        uo.lclick(163,235)
    end if
    if choice==3 then
        uo.lclick(163,268)
    end if
endsub

sub testn(num1,num2)
    # Функция считывает координаты точек, составляющих цифру,
    # и возвращает расстояние между двумя точками,
    # переданными в качестве параметров функции
    var i,res
    DIM x[11]
    DIM y[11]
    for i=1 to 11
        x[i]=val(GetWord(uo.lastGump("command",i+2), 2))
        y[i]=val(GetWord(uo.lastGump("command",i+2), 3))
    next
    res=SQRT((x[num1]-x[num2])*(x[num1]-x[num2])+(y[num1]-y[num2])*(y[num1]-y[num2])) # вспоминаем теорему Пифагора ;)
    uo.print(str(res))
    return res
endsub

sub choose(num) # Функция считывает варианты ответов и возвращает нужный
    var count,i
    for i=1 to 3
        count=val(uo.lastGump("text",i))
        uo.print('count='+str(count))
        if num==count then
            return i
        end if
    next
    uo.print('Somthing wrong. Zero returned!!!!!')
    return 0
endsub
   
Sub GetWord( st, nom )
    ; (c) Edred
    ; Возвращает слово из строки str за номером num
    ; если такого слова нет - возвращаем ''
    ;
    ; Разделителем слов считаем пробел. Несколько пробелов подряд считаются за один.
    ; Функция сделана без рекурсии специально для считывания слов из сверхдлинных строк!
    ;
    VAR tmpst, i, dlin, kol = 0, start = 0
    dlin = len( st )
    For i=0 To dlin - 1
        If mid( st, i, 1 ) == ' ' OR i == dlin - 1 Then
            kol = kol + 1
            If kol == nom Then
                ; это первый пробел после нужного нам слова
                tmpst = mid( st, start, i - start )
                return tmpst
            Else
                While mid( st, i, 1 ) == ' '
                    i = i + 1
                Wend
                If kol == nom - 1 Then
                    start = i
                Endif
            Endif
        Endif
    Next
    tmpst = ''
    return tmpst
endsub

sub SQRT(x)    # Квадратный корень
    if x<0 then
        return 0
    end if
    var tmp=int(2*len(str(x)))
    var result=XtoPowerY(2,tmp)
    repeat
        tmp=result
        result=0.5*(result+x/result)
    until abs(tmp-result)<0.00001
    return result
end sub

sub abs(x)    # модуль числа
    if (x < 0) then
        x = -x
    end if
    return x
end sub

sub IsWholeNum(num)  # является ли число целым
    if (num-int(num)) == 0 then
        return true
    else
        return false
    end if
end sub

sub XtoPowerY(x,y)   # возведение в степень
    if not IsWholeNum(y) or y<0 or (x==0 and y==0) then
        return 0
    end if
    var i,result=1
    if y>0 then
        for i = 1 to y
            result=result*x
        next
    else
        return 1   
    end if
    return result
end sub


Примечание для самых маленьких: чтобы это чудо заработало в основной скрипт нужно вставить что-нибудь вроде:

Code:
            
if not uo.LastGump("replyed") then
    uo.print("Antimacros detected!!!")
    wait(500)
    antiabyss()
end if

_________________
Все мы славные ребята, простые русские парни, железные люди с деревянными головами...


Top
   
PostPosted: 2010-12-21 08:46:03 
Offline

Joined: 2010-08-24 14:41:57
Posts: 25
зачем выдумывать велосипед
http://forum.yoko.com.ua/viewtopic.php?f=7&t=11884&hilit=abyss&start=20
сообшение мр. Grin

Code:
sub antimacro()

   var x, y
   
   while  not uo.Dead()
      if (uo.LastGump('replyed') == 0) and (uo.LastGump('text', 0)  == 'Please choose this number:') then
         x = uo.LastGump('x')
         y = uo.LastGump('y')
         uo.LClick(x+120, y+185+what()*35)
         wait(1000)
      end if
      wait(100)
   wend

end sub
     
sub what()

   var i, score, index, temp, st
   dim x[11], y[11]
   dim nm[3]
   
   for i = 3 to 12
      st = uo.LastGump('command', i)
      x[i-2] = val(mid(st, 8, 3))
      y[i-2] = val(mid(st, 12, 3))
   next
   for i = 0 to 2
      nm[i] = val(uo.LastGump('text', i+1))
   next
   score = 10000
   index = 0
   for i = 0 to 2
      temp = numberscore(nm[i], x, y)
      if score > temp then
         score = temp
         index = i
      endif
   next
   return index

end sub

sub numberscore(num, x, y)

   dim Sings[10]
   var cheking = 1
   var n, i, total = 0
   dim xv[2], yv[2], point[3]
   
   Sings[2] = "080910080506"
   Sings[3] = "040706060708"
   Sings[5] = "040506060708"
   Sings[6] = "070910050608"
   Sings[8] = "030506060709"
   Sings[9] = "040607050807"
   
   for n = 0 to 1
      for i = 0 to 2
         point[i] = val(mid(Sings[num], n*6+i*2, 2))
      next
      for i = 0 to 1
         xv[i] = x[point[i]]-x[point[i+1]]
         yv[i] = y[point[i]]-y[point[i+1]]
      next
      total = total+anglscore(xv, yv)
   next
   return total

endsub
     
sub anglscore(x, y)

   var xy1 = x[0]*y[0]
   var xy2 = x[1]*y[1]
   var t = xy1+xy2
   
   x[0] = x[0]+y[0]
   x[1] = x[1]+y[1]
   return 100*t*t/((x[0]*x[0]-2*xy1)*(x[1]*x[1]-2*xy2))

end sub


Top
   
PostPosted: 2010-12-21 09:09:28 
Offline
User avatar

Joined: 2010-10-01 16:47:41
Posts: 75
Действительно. :))) Изобрел велосипед. Зато налицо два принципиально разных алгоритма - определение углов, и определение расстояний.
Говоря откровенно, перед написанием антимакро даже особо поиск не юзал. Просто загорелось в одном месте раскусить эту задачку.
Спасибо за ссылку. Идея Грина заслуживает внимания.

_________________
Все мы славные ребята, простые русские парни, железные люди с деревянными головами...


Top
   
PostPosted: 2011-01-11 00:47:30 
Offline
User avatar

Joined: 2010-04-07 14:43:26
Posts: 62
GMX в любом случае не зря, спасибо.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 4 posts ] 

All times are UTC+02:00


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited