SP
vb

Tiles E Mais Tiles

Por Sprit, 06 de jan. de 2007 em C# e Visual Basic

tibia
5
2.4k
SpritS
06 de janeiro de 2007 às 10:54

Pessoal,

Tava dando uns role pela net, e acabei encontrando este código em VB, para saber a coord do player no Tibia X, Y, Z, e Iñformação do Tile (Terra, Gramado, etc...)

 

Legal pra que nao conheçe acesso a memoria Ram ja ir tendo noção,

 

só que tem um porem as funlções Read_Byte, Read_Long etc.. tem que ser feita na unha, e é facil. mais eh legal pra pesquisar tbm. a unica diferença é o tamanho do buffer

 

ReadByte= 1 Byte

ReadLong=4 Bytes

ReadInterger=2 Bytes

 

por isso tem que ser funções distintas...

Boa pesquisa!!

 

AAhhh, Acesso a memoria ram so funciona em Module.Bas nem tenta fazer em form que nao vai da certo.

=)

 

Public Type objectData
 TileNumber As Long ' TileNum
 MapCount As Long ' 0
 TileId As Long ' 4
 objectId As Long ' 16
 Data1 As Long ' 20
 Data2 As Long ' 28
 posX As Long ' x
 posY As Long ' y
 posZ As Long ' z
End Type

Public Const Dist_MapCount = 0
Public Const Dist_MapTileId = 4
Public Const Dist_MapObjectId = 16
Public Const Dist_MapObjectData = 20
Public Const Dist_MapObjectDataEx = 28
Public Const Dist_MapTile = 172

Public Function Player_Tile() As objectData
Dim MapTile_Address As Long
Dim TileNum As Long
Dim Adr_MapStart As Long
Dim x As Long
dim y As Long
Dim z As Long
Adr_MapStart = Memory_ReadLong(Tibia_Hwnd, &H615778) '(it's in hex)

 For TileNum = 0 To 2015
   z = TileNum / (14 * 18)
   y = (TileNum - z * 14 * 18) / 18
   x = (TileNum - z * 14 * 18 - y * 18)

   MapTile_Address = Adr_MapStart + (TileNum * Dist_MapTile)

   'Having the current knowledge,
   'locating yourself on the map in the memory is pretty simple:
   'it is just a tile with creature id 99 (0x63) and data1 (Tibia ID)
   'equal to your own Tibia ID. Position (between 0 and 2015)
   'of the 'yourself tile' is esential for further computations.
   If Memory_ReadLong(Tibia_Hwnd, MapTile_Address + Dist_MapObjectId) = 99 And Memory_ReadLong(Tibia_Hwnd, MapTile_Address + Dist_MapObjectData) = Memory_ReadLong(Tibia_Hwnd, Player_ID) Then
     Player_Tile.TileNumber = TileNum
     Player_Tile.MapCount = Memory_ReadLong(Tibia_Hwnd, MapTile_Address)
     Player_Tile.TileId = Memory_ReadLong(Tibia_Hwnd, MapTile_Address + Dist_MapTileId)
     Player_Tile.objectId = Memory_ReadLong(Tibia_Hwnd, MapTile_Address + Dist_MapObjectId)
     Player_Tile.Data1 = Memory_ReadLong(Tibia_Hwnd, MapTile_Address + Dist_MapObjectData)
     Player_Tile.Data2 = Memory_ReadLong(Tibia_Hwnd, MapTile_Address + Dist_MapObjectDataEx)
     Player_Tile.posX = x
     Player_Tile.posY = y
     Player_Tile.posZ = z

     Exit Function
   End If
 Next TileNum
End Function

AblankA
08 de janeiro de 2007 às 17:05

isto é muito usado para programação de macro.

 

nem quero dar mais detalhes :p

8 meses depois...
bizugoB
04 de setembro de 2007 às 19:31

Cade os creditos?

TPForums?

É regra por de onde são importados os codigos.

Editado Setembro 4 por bizugo

2 meses depois...
SpritS
09 de novembro de 2007 às 21:23

Realmente Bizugo se tem razão,

 

esse codigo foi retirado do TibiaFans.com

não me pergunta quem escreveu AHuH

 

ja faz um tempinhu neh

1 mês depois...
lucasjockeyL
31 de dezembro de 2007 às 18:54

O acesso a LONGs é usado somente em modulo, integer, bytes e outros podem ser facilmente modificados no form ;)