메이플 경매장 매크로 만들기




안녕하세요 :)


한동안 포스팅을 못했는데..

몇개월만에 이렇게 포스팅 하네요.

이번에는 경매장 시세파악 코드를

작성해 보도록 하겠습니다.


포스팅 순서는 경매장 스크립트에 필요한 

숫자 데이터인식과 처리방법 그에 대한

영상및 간략한 설명 순으로 하겠습니다. 



시작하기전 당부의 말씀을 드리면 본 포스팅은 프로그램을 배포하는 포스팅이 아닙니다.

제작방법을 알려드리는 포스팅이며 코드에 대한 설명이나 기타 스크립트 의뢰는 가능합니다. :D





메이플 경매장 매크로 만들기



여러 게임에서 유저간의 활발한 거래를 위하여 경매장이라는 시스템이 도입되어있습니다.

이러한 경매장에서 원하는 품목의 시세를 실시간으로 가져오는 프로그램을 만들기 위해서는


무엇보다 검색한 아이템의 숫자 이미지를 실제값으로 가져오는 작업이 필요합니다.

ImageSearch , PixelSearch , RPM , ImageData.. 등 여러 방법이 있겠지만


ImageData 를 이용한 방법을 통하여 원하는 품목의 가격정보를 가져오도록 하겠습니다.

단순한 방법으로 구현한다면 이미지서치나 픽셀서치를 이용해 코드작성할수 있습니다.






위 영상은 메이플 게임에서의 경매장 이용모습과 상단의 품목에 대한 가격을 인식하고,

인식하는데 걸리는 시간을 Gui 인터페이스에 표시를 해두도록 코드를 작성한 영상 입니다.


경매장 매크로 영상




코드에 사용한 함수.



BinRead(file, ByRef data, n=0, offset=0)

{

   h := DllCall("CreateFile","Str",file,"Uint",0x80000000,"Uint",3,"UInt",0,"UInt",3,"Uint",0,"UInt",0)

   IfEqual h,-1, SetEnv, ErrorLevel, -1

   IfNotEqual ErrorLevel,0,Return,0

   m = 0

   IfLess offset,0, SetEnv,m,2

   r := DllCall("SetFilePointerEx","Uint",h,"Int64",offset,"UInt *",p,"Int",m)

   IfEqual r,0, SetEnv, ErrorLevel, -3

   IfNotEqual ErrorLevel,0, {

      t = %ErrorLevel%

      DllCall("CloseHandle", "Uint", h)

      ErrorLevel = %t%

      Return 0

   }

   m := DllCall("GetFileSize","UInt",h,"Int64 *",r)

   If (n < 1 or n > m)

       n := m

   Granted := VarSetCapacity(data, n, 0)

   IfLess Granted,%n%, {

      ErrorLevel = Mem=%Granted%

      Return 0

   }

   result := DllCall("ReadFile","UInt",h,"Str",data,"UInt",n,"UInt *",Read,"UInt",0)

   if (!result or Read < n)

       t = -3

   IfNotEqual ErrorLevel,0, SetEnv,t,%ErrorLevel%

   h := DllCall("CloseHandle", "Uint", h)

   IfEqual h,-1, SetEnv, ErrorLevel, -2

   IfNotEqual t,,SetEnv, ErrorLevel, %t%-%ErrorLevel%

   Return Read

}


Bin2Hex(ByRef h, ByRef b, n=0)

{

   format = %A_FormatInteger%

   SetFormat Integer, Hex

   m := VarSetCapacity(b)

   If (n < 1 or n > m)

       n := m

   Address := &b

   h =

   Loop %n%

   {

      x := *Address

      StringTrimLeft x, x, 2

      x = 0%x%

      StringRight x, x, 2

      h = %h%%x%

      Address++

   }

   SetFormat Integer, %format%      ; restore original format

}


Hex2Bin(ByRef @bin, ByRef @hex, _byteNb=0)

{

 local l, data, granted, dataAddress

 If (_byteNb < 1 or _byteNb > dataSize)

 {

  l := StrLen(@hex)

  _byteNb := l // 2

  if (l = 0 or _byteNb * 2 != l)

  {


   ErrorLevel = Param

   Return -1

  }

 }

 granted := VarSetCapacity(@bin, _byteNb, 0)

 if (granted < _byteNb)

 {

  ErrorLevel = Mem=%granted%

  Return -1

 }

 data := RegExReplace(@hex, "..", "0x$0!")

 StringLeft data, data, _byteNb * 5

 dataAddress := &@bin

 Loop Parse, data, !

 {

  DllCall("RtlFillMemory"

    , "UInt", dataAddress++

    , "UInt", 1

    , "UChar", A_LoopField)

 }

 Return _byteNb

}









Posted by Khan64
,