Hey
in this post I'll post every packet structure I have (client side) in VB (it's the easiest language and the one i know )
well, first of all I'm gonna explain what packets are. Packets are info traveling between server and client that contains info of everything in tibia (creatures, ground, items, etc.). Those packets are structured in bytes (array of bytes). Packets are flying from server to client and vice versa by the time you try to log in untill you log out, no-packets = no-connection/lag. Each packet sent does something different from other, but every kind of packet has got an own structure. Packets are encrypted with a key in tibia with an encryption algorithm called XTEA. Packets may be logged using WPE Pro (I'm not gonna teach you how to use it since you must decrypt the packets after it) or using some advanced tibia cheat such Blackd Proxy (free or payed) that automatically decrypt it, if you wanna learn how to do it go there. The following packet structures are decrypted since the XTEA encryption is dinamic.
Structures:
Code:
packetBuffer(0) = LongToByte((Len(Text) + 4), 1)
packetBuffer(1) = LongToByte((Len(Text) + 4), 2)
packetBuffer(2) = &H96
packetBuffer(3) = &H1 '1=say, 2=whisper, 3=yell
packetBuffer(4) = LongToByte(Len(Text), 1) 'if it doesn't work, remove the "LongToByte" function from there
packetBuffer(5) = LongToByte(Len(Text), 2) 'and put there 0
For X = 1 To Len(Text)
packetBuffer(X + 5) = Asc(Mid(Text, X, 1))
Next X
Code:
PacketBuffer(0) = LongToByte((Len(CharacterTo) + (Len(Text)) + 6), 1)
PacketBuffer(1) = LongToByte((Len(CharacterTo) + (Len(Text)) + 6), 2)
PacketBuffer(2) = &H96
PacketBuffer(3) = &H4
PacketBuffer(4) = Len(CharacterTo)
PacketBuffer(5) = &H0
For X = 1 To Len(CharacterTo)
PacketBuffer(X + 5) = Asc(Mid(CharacterTo, X, 1))
Next X
PacketBuffer(Len(CharacterTo) + 6) = LongToByte(Len(Text), 1)
PacketBuffer(Len(CharacterTo) + 7) = LongToByte(Len(Text), 2)
For X = 1 To Len(Text)
PacketBuffer(Len(CharacterTo) + 7 + X) = Asc(Mid(Text, X, 1))
Next X
Code:
PacketBuffer(0) = LongToByte((Len(Text)) + 6), 1)
PacketBuffer(1) = LongToByte((Len(CharacterTo) + (Len(Text)) + 6), 2)
PacketBuffer(2) = &H96
PacketBuffer(3) = &H7
PacketBuffer(4) = Channel 'Guild = &H0, Game = &H4, Trade = &H5, RL = &H7, OwnPrivate = &H9
PacketBuffer(5) = &H0
PacketBuffer(6) = LongToByte(Len(Text), 1)
PacketBuffer(7) = LongToByte(Len(Text), 2)
For X = 1 To Len(Text)
PacketBuffer(7 + X) = Asc(Mid(Text, X, 1))
Next X
Code:
packetBuffer(0) = &H1
packetBuffer(1) = &H0
packetBuffer(2) = &HBE
Code:
packetBuffer(0) = &H1
packetBuffer(1) = &H0
packetBuffer(2) = &H14
- Simple Move: Moves you just one square. (Just one PacketBuffer(2))
Code:
packetBuffer(0) = &H1
packetBuffer(1) = &H0
'JUST ONE!
'packetBuffer(2) = &H65 'up
'packetBuffer(2) = &H66 'right
'packetBuffer(2) = &H67 'down
'packetBuffer(2) = &H68 'left
'packetBuffer(2) = &H6A 'up right
'packetBuffer(2) = &H6B 'down right
'packetBuffer(2) = &H6C 'down left
'packetBuffer(2) = &H6D 'up left
- Move: Moves yourself. Movements is an array of strings. (Note: can hold more than one movement)
Code:
LongMov = UBound(Movements) + 1
For X = 0 To UBound(Movements)
Select Case Movements(X)
Case "e", "E" 'east
transmov(X) = 1
Case "ne", "NE", "en", "EN" 'north-east
transmov(X) = 2
Case "n", "N" 'north
transmov(X) = 3
Case "nw", "NW", "wn", "WN" 'north-west
transmov(X) = 4
Case "w", "W" 'west
transmov(X) = 5
Case "se", "SE", "es", "ES" 'south-east
transmov(X) = 6
Case "s", "S" 'south
transmov(X) = 7
Case "sw", "SW", "ws", "WS" 'south-west
transmov(X) = 8
End Select
Next X
Dim packetBuffer() As Byte
ReDim packetBuffer(4 + LongMov) As Byte
packetBuffer(0) = 4 + LongMov
packetBuffer(1) = &H0
packetBuffer(2) = &H64
packetBuffer(3) = LongMov
packetBuffer(4) = transmov
- Face: (Just one PacketBuffer(2))
Code:
packetBuffer(0) = &H1
packetBuffer(1) = &H0
'JUST ONE!
'packetBuffer(2) = &H6F 'up
'packetBuffer(2) = &H70 'right
'packetBuffer(2) = &H71 'down
'packetBuffer(2) = &H72 'left
- Move from container to container: Moves an item between containers (Example: Group some gold coins)
Code:
packetBuffer(0) = &HF
packetBuffer(1) = &H0
packetBuffer(2) = &H78
packetBuffer(3) = &HFF
packetBuffer(4) = &HFF
packetBuffer(5) = contFROM + 63
packetBuffer(6) = &H0
packetBuffer(7) = spotFROM - 1
packetBuffer(8) = LongToByte(ID, 1)
packetBuffer(9) = LongToByte(ID, 2)
packetBuffer(10) = spotFROM - 1
packetBuffer(11) = &HFF
packetBuffer(12) = &HFF
If ContTo <> 0 Then
PacketBuffer(13) = ContTo + 63 'If moving item to the backpack
End If 'Then SpotTo = 0, if moving item
If SpotTo <> 0 Then 'to slot (Hands, Ammo slot etc..)
PacketBuffer(13) = SlotTo 'then ContTo = 0
End If
packetBuffer(14) = &H0
packetBuffer(15) = spotTO - 1
packetBuffer(16) = Count
- Move from ground to ground: Moves an item through the ground (Example: Carry a lootbag with you)
Code:
PacketBuffer(0) = &HF
PacketBuffer(1) = &H0
PacketBuffer(2) = &H78
PacketBuffer(3) = LongToByte(FromX, 1)
PacketBuffer(4) = LongToByte(FromX, 2)
PacketBuffer(5) = LongToByte(FromY, 1)
PacketBuffer(6) = LongToByte(FromY, 2)
PacketBuffer(7) = FromZ
PacketBuffer(8) = LongToByte(ItemID, 1)
PacketBuffer(9) = LongToByte(ItemID, 2)
PacketBuffer(10) = &H3
PacketBuffer(11) = LongToByte(ToX, 1)
PacketBuffer(12) = LongToByte(ToX, 2)
PacketBuffer(13) = LongToByte(ToY, 1)
PacketBuffer(14) = LongToByte(ToY, 2)
PacketBuffer(15) = ToZ
PacketBuffer(16) = &H0
PacketBuffer(17) = &H1
- Move from ground to container/slot: Moves an item from the ground to a container/slot (Example: Loot from floor)
Code:
PacketBuffer(0) = &HF
PacketBuffer(1) = &H0
PacketBuffer(2) = &H78
PacketBuffer(3) = LongToByte(x, 1)
PacketBuffer(4) = LongToByte(x, 2)
PacketBuffer(5) = LongToByte(y, 1)
PacketBuffer(6) = LongToByte(y, 2)
PacketBuffer(7) = z
PacketBuffer(8) = LongToByte(ItemId, 1)
PacketBuffer(9) = LongToByte(ItemId, 2)
PacketBuffer(10) = &H1
PacketBuffer(11) = &HFF
PacketBuffer(12) = &HFF
If ContTo <> 0 Then
PacketBuffer(13) = ContTo + 63 'If moving item to the backpack
End If 'Then SpotTo = 0, if moving item
If SpotTo <> 0 Then 'to slot (Hands, Ammo slot etc..)
PacketBuffer(13) = SlotTo 'then ContTo = 0
End If
PacketBuffer(14) = &H0
PacketBuffer(15) = SpotTo - 1
PacketBuffer(16) = &H1
- Move from container to ground: Moves an item from a container to the ground (Example: Throw a empty vial)
Code:
PacketBuffer(0) = &HF
PacketBuffer(1) = &H0
PacketBuffer(2) = &H78
PacketBuffer(3) = &HFF
PacketBuffer(4) = &HFF
If ContTo <> 0 Then
PacketBuffer(5) = ContFrom + 63 'If moving item from the backpack
End If 'Then SlotFrom = 0, if moving item
If SpotTo <> 0 Then 'from slot (Hands, Ammo slot etc..)
PacketBuffer(5) = SlotFrom 'then ContFrom = 0
End If
PacketBuffer(6) = &H0
PacketBuffer(7) = Spot - 1
PacketBuffer(8) = LongToByte(ItemID, 1)
PacketBuffer(9) = LongToByte(ItemID, 2)
PacketBuffer(10) = &H2
PacketBuffer(11) = LongToByte(PosX, 1)
PacketBuffer(12) = LongToByte(PosX, 2)
PacketBuffer(13) = LongToByte(PosY, 1)
PacketBuffer(14) = LongToByte(PosY, 2)
PacketBuffer(15) = PosZ
PacketBuffer(16) = Count
- Use item in floor: Uses a item located in the ground (Example: A door)
Code:
packetBuffer(0) = &HA
packetBuffer(1) = &H0
packetBuffer(2) = &H82
packetBuffer(3) = LongToByte(X, 1)
packetBuffer(4) = LongToByte(X, 2)
packetBuffer(5) = LongToByte(Y, 1)
packetBuffer(6) = LongToByte(Y, 2)
packetBuffer(7) = Z
packetBuffer(8) = LongToByte(ID, 1)
packetBuffer(9) = LongToByte(ID, 2)
packetBuffer(10) = &H1
packetBuffer(11) = &H3
- Open body: Opens a body standing on the ground (Example: A recent killed rotworm)
Code:
packetBuffer(0) = &HA
packetBuffer(1) = &H0
packetBuffer(2) = &H82
packetBuffer(3) = LongToByte(x, 1)
packetBuffer(4) = LongToByte(x, 2)
packetBuffer(5) = LongToByte(y, 1)
packetBuffer(6) = LongToByte(y, 2)
packetBuffer(7) = z
packetBuffer(8) = LongToByte(CorpseID, 1)
packetBuffer(9) = LongToByte(CorpseID, 2)
packetBuffer(10) = LongToByte(StackPos, 1) 'Stack Position
packetBuffer(11) = LongToByte(BackPacks, 1) 'Slot where you wanna open your backpack
- Use item in Container: Use an item stored in a container (Example: Using a meat)
Code:
packetBuffer(0) = &HA
packetBuffer(1) = &H0
packetBuffer(2) = &H82
packetBuffer(3) = &HFF
packetBuffer(4) = &HFF
packetBuffer(5) = (Container + 63)
packetBuffer(6) = &H0
packetBuffer(7) = (Spot - 1)
packetBuffer(8) = LongToByte(ID, 1)
packetBuffer(9) = LongToByte(ID, 2)
packetBuffer(10) = (Spot - 1)
packetBuffer(11) = (Container - 1)
- Use With from Container: Use an item stored in a container with a item/ground/player on the floor (Example: Using a fishing rod on water, or an UH on yourself)
Code:
packetBuffer(0) = &H11
packetBuffer(1) = &H0
packetBuffer(2) = &H83
packetBuffer(3) = &HFF
packetBuffer(4) = &HFF
packetBuffer(5) = (Container + 63)
packetBuffer(6) = &H0
packetBuffer(7) = Spot - 1
packetBuffer(8) = LongToByte(ID, 1)
packetBuffer(9) = LongToByte(ID, 2) 'Fixed by Chanceler :D
packetBuffer(10) = Spot - 1
packetBuffer(11) = LongToByte(X, 1)
packetBuffer(12) = LongToByte(X, 2)
packetBuffer(13) = LongToByte(Y, 1)
packetBuffer(14) = LongToByte(Y, 2)
packetBuffer(15) = Z
If TileID = 0 Then 'I wanna use it on me
packetBuffer(16) = &H63
packetBuffer(17) = &H0
packetBuffer(18) = &H1
Else 'I wanna use it on the floor
packetBuffer(16) = LongToByte(TileID, 1)
packetBuffer(17) = LongToByte(TileID, 2)
packetBuffer(18) = &H0
End If
Code:
packetBuffer(0) = &H5
packetBuffer(1) = &H0
packetBuffer(2) = &HA1
packetBuffer(3) = LongToByte(ID, 1)
packetBuffer(4) = LongToByte(ID, 2)
packetBuffer(5) = LongToByte(ID, 3)
packetBuffer(6) = LongToByte(ID, 4)
- Send text to document: The packet needed to write a text into some writable document such label, letter, book, etc (Example: "Juapillo, Thais" into a label)
Code:
packetBuffer(0) = LongToByte((Len(Text) + 7), 1)
packetBuffer(1) = LongToByte((Len(Text) + 7), 2)
packetBuffer(2) = &H89
packetBuffer(3) = LongToByte(Window_ID, 1)
packetBuffer(4) = LongToByte(Window_ID, 2)
packetBuffer(5) = LongToByte(Window_ID, 3)
packetBuffer(6) = LongToByte(Window_ID, 4)
packetBuffer(7) = LongToByte(Len(Text), 1)
packetBuffer(8) = LongToByte(Len(Text), 2)
For X = 1 To Len(Text)
packetBuffer(X + 8) = Asc(Mid(Text, X, 1))
Next X
Code:
packetBuffer(0) = &H8
packetBuffer(1) = &H0
packetBuffer(2) = &HD3
packetBuffer(3) = LongToByte(OutfitID, 1) 'any creature id
packetBuffer(4) = LongToByte(OutfitID, 2) 'any creature id
packetBuffer(5) = HeadColor
packetBuffer(6) = BodyColor
packetBuffer(7) = LegsColor
packetBuffer(8) = FeetColor
packetBuffer(9) = Addons '0 = 0, 1 = first, 2 = second, 3 = both
- Look at character: (If some1 can check it would be nice, seems like the last 3 bytes are the player ID)
Code:
packetBuffer(0) = &H9
packetBuffer(1) = &H0
packetBuffer(2) = &H8C
packetBuffer(3) = LongToByte(X, 1)
packetBuffer(4) = LongToByte(X, 2)
packetBuffer(5) = LongToByte(Y, 1)
packetBuffer(6) = LongToByte(Y, 2)
packetBuffer(7) = Z
packetBuffer(8) = &H63
packetBuffer(9) = &H0
packetBuffer(10) = &H1
- Use by hotkey in yourself/creature
Code:
packetBuffer(0) = &H0D
packetBuffer(1) = &H0
packetBuffer(2) = &H84
packetBuffer(3) = &HFF
packetBuffer(4) = &HFF
packetBuffer(5) = &H0
packetBuffer(6) = &H0
packetBuffer(7) = &H0
packetBuffer(8) = LongToByte(ItemID, 1) 'ID of the Item wanna be used
packetBuffer(9) = LongToByte(ItemID, 2)
packetBuffer(10) = Amount 'Useful when using Mana Fluids (10) or some other items
packetBuffer(11) = LongToByte(CreatureID, 1) 'ID of the creature to be used with (your ID if wanna use on you)
packetBuffer(12) = LongToByte(CreatureID, 2)
- Use by hotkey by position (this wasn't found by myself and i think there're some info left so test it first )
Code:
PacketBuffer(0) = &H11
PacketBuffer(1) = &H0
PacketBuffer(2) = &H83
PacketBuffer(3) = &HFF
PacketBuffer(4) = &HFF
PacketBuffer(5) = &H0
PacketBuffer(6) = &H0
PacketBuffer(7) = &H0
PacketBuffer(8) = LongToByte(ItemID, 1)
PacketBuffer(9) = LongToByte(ItemID, 2)
PacketBuffer(10) = &H0
PacketBuffer(11) = LongToByte(X, 1)
PacketBuffer(12) = LongToByte(X, 2)
PacketBuffer(13) = LongToByte(Y, 1)
PacketBuffer(14) = LongToByte(Y, 2)
PacketBuffer(15) = Z
- Container: Container of the item you are working with. First Container = 1
- Spot: Position in the container of the item you are working with. First Spot = 1
- CreatureID/ItemID: ID of the item/ground/creature your are working with
- X: Position of the item/ground/creature you are working with
- Y: Position of the item/ground/creature you are working with
- Z: Position of the item/ground/creature you are working with
- Window_ID: ID of the writabledocument's window asigned by server.
LongToByte: Coded function that changes a long value in an array of bytes
Code:
Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
Public Function LongToByte(Number As Long, NByte As Long) As Byte
Dim ByteArray(0 To 3) As Byte
CopyMemory ByteArray(0), ByVal VarPtr(Number), Len(Number)
LongToByte = ByteArray(NByte - 1)
End Function
Code:
BYTE LongToByte( DWORD dwValue, int nCount ) {
BYTE ret;
ret = (dwValue >> ((nCount-1)*8)) & 0xFF;
return ret;
}
- ASM: (Grob again )
Code:
LongToByte proc szValue:DWORD,nCount:DWORD
lea eax,szValue ; Set eax to the address of szValue
sub nCount,1 ; Since people are lazy, subtract 1 from nCount which makes 1 the least possible action
add eax,nCount ; We add nCount to eax (if nCount is 1 we will return the first byte of the dword)
movzx eax,byte ptr [eax] ; We move a byte into the 32-bit register using movzx. eax will now hold the correct byte
ret ; Return eax which holds the correct byte to the application calling this function
LongToByte endp