Log in

View Full Version : Programming contest #2: Tibia map



blackd
03-09-2010, 21:56
This would save a lot of time for me...

I need some functions to handle Tibia map.
The following article should be your guide:
http://www.tibiaauto.net/articles/ta_art_mapread.html

Reward: 1000k in any server where I have more than 1000k of stock.

Required language: Visual Basic 6

Requirement: (for speed) The Tibia map should be readed in block in a single step and stored to an array of bytes. This can be done with the api RtlMoveMemory

You should code ReadTibiaMap and GetMapInfoOf
This would be a start...




Option Explicit

Private Declare Sub RtlMoveMemory Lib "kernel32" ( _
lpDest As Any, _
lpSource As Any, _
ByVal ByValcbCopy As Long)

Public Type SquareInfo
itemID As Long
data1 As Long
data2 As Long
End Type

Public Type MapInfo
square(0 To 13) As SquareInfo
End Type

Public RawMapInfo(0 To TibiaMapSize) As Byte



Public Sub ReadTibiaMap(ByVal tibiaclientPID)
' Update array of mapinfo and any other variable if needed.
' tibiaclientPID = the PID of the tibia client window that we want to read.
End Sub

Public Function GetMapInfoOf(ByVal incX As Long, ByVal incY As Long, ByVal incZ As Long) As MapInfo
' Get mapinfo fro the raw array of mapinfo
' Parameters are values relative to position to my char
' GetMapInfoOf(0,0,0) = my char position in the array of mapinfo
' GetMapInfoOf(-1,0,0) = mapinfo of whatever is 1 square at my left.
' GetMapInfoOf(1,0,0) = mapinfo of whatever is 1 square at my right.
' GetMapInfoOf(0,-1,0) = mapinfo of whatever is 1 square at my north
' GetMapInfoOf(0,1,0) = mapinfo of whatever is 1 square at my south.
' GetMapInfoOf(0,0,-1) = mapinfo of whatever is 1 square above me.
' GetMapInfoOf(0,0,1) = mapinfo of whatever is 1 square under me.
End Function





you can post the zip with the code here or if you prefer to keep it private then just do a small post and send me the code by email.
First poster that gets me a code that works correctly will win this contest.

beziak
03-10-2010, 08:48
I can do it using c++ DLL.

Then you need to LoadLibrary & GetProcAddress your functions. Tell me if agree.

#edit
actually it's done

blackd
03-10-2010, 13:28
I can do it using c++ DLL.

Then you need to LoadLibrary & GetProcAddress your functions. Tell me if agree.

#edit
actually it's done

well... I try to avoid dlls as much as possible but if after 1 week nobody gives me a better solution writen in pure VB6 then I will consider you the winner.

blackd
03-15-2010, 16:50
ok Beziak is the winner.
I tested the functions. They work. I also translated the functions to VB6 myself to avoid dll calls.

Well, contest closed now.

Gratz Beziak!