Support for Protocols up to 10.71, Adventurer Blessing

This commit is contained in:
TheSumm
2014-12-29 18:08:13 +01:00
parent 6ab69b499d
commit 7f3f18f991
21 changed files with 342 additions and 88 deletions

View File

@@ -120,6 +120,13 @@ GameSpritesAlphaChannel = 56
GamePremiumExpiration = 57
GameBrowseField = 58
GameEnhancedAnimations = 59
GameOGLInformation = 60
GameMessageSizeCheck = 61
GamePreviewState = 62
GameLoginPacketEncryption = 63
GameClientVersion = 64
GameContentRevision = 65
GameExperienceBonus = 66
TextColors = {
red = '#f55e5e', --'#c83200'
@@ -201,7 +208,7 @@ CIPSOFT_RSA = "1321277432058722840622950990822933849527763264961655079678763618"
"88792221429527047321331896351555606801473202394175817"
-- set to the latest Tibia.pic signature to make otclient compatible with official tibia
PIC_SIGNATURE = 0x53208400
PIC_SIGNATURE = 0x542100C1
OsTypes = {
Linux = 1,
@@ -244,4 +251,20 @@ ExtendedIds = {
NeedsUpdate = 7
}
PreviewState = {
Default = 0,
Inactive = 1,
Active = 2
}
Blessings = {
None = 0,
Adventurer = 1,
SpiritualShielding = 2,
EmbraceOfTibia = 4,
FireOfSuns = 8,
WisdomOfSolitude = 16,
SparkOfPhoenix = 32
}
-- @}

View File

@@ -53,38 +53,39 @@ end
function g_game.getSupportedClients()
return {
740, 741, 750, 760, 770, 772,
740, 741, 750, 760, 770, 772,
780, 781, 782, 790, 792,
800, 810, 811, 820, 821, 822,
830, 831, 840, 842, 850, 853,
854, 855, 857, 860, 861, 862,
800, 810, 811, 820, 821, 822,
830, 831, 840, 842, 850, 853,
854, 855, 857, 860, 861, 862,
870, 871,
900, 910, 920, 931, 940, 943,
944, 951, 952, 953, 954, 960,
961, 963, 970, 971, 972, 973,
980, 981, 982, 983, 984, 985,
900, 910, 920, 931, 940, 943,
944, 951, 952, 953, 954, 960,
961, 963, 970, 971, 972, 973,
980, 981, 982, 983, 984, 985,
986,
1000, 1001, 1002, 1010, 1011,
1012, 1013, 1020, 1021, 1022,
1030, 1031, 1032, 1033, 1034,
1035, 1036, 1037, 1038, 1039,
1000, 1001, 1002, 1010, 1011,
1012, 1013, 1020, 1021, 1022,
1030, 1031, 1032, 1033, 1034,
1035, 1036, 1037, 1038, 1039,
1040, 1041, 1050, 1051, 1052,
1053, 1054, 1055, 1056, 1057,
1058, 1059, 1060, 1061
1058, 1059, 1060, 1061, 1062,
1063, 1064, 1070, 1071
}
end
-- The client version and protocol version where
-- unsynchronized for some releases, not sure if this
-- unsynchronized for some releases, not sure if this
-- will be the normal standard.
-- Client Version: Publicly given version when
-- Client Version: Publicly given version when
-- downloading Cipsoft client.
-- Protocol Version: Previously was the same as
-- Protocol Version: Previously was the same as
-- the client version, but was unsychronized in some
-- releases, now it needs to be verified and added here
-- if it does not match the client version.
@@ -92,7 +93,7 @@ end
-- Reason for defining both: The server now requires a
-- Client version and Protocol version from the client.
-- Important: Use getClientVersion for specific protocol
-- Important: Use getClientVersion for specific protocol
-- features to ensure we are using the proper version.
function g_game.getClientProtocolVersion(client)

View File

@@ -32,23 +32,28 @@ function ProtocolLogin:sendLoginPacket()
msg:addU16(g_game.getProtocolVersion())
if g_game.getClientVersion() >= 980 then
if g_game.getFeature(GameClientVersion) then
msg:addU32(g_game.getClientVersion())
end
msg:addU32(g_things.getDatSignature())
if g_game.getFeature(GameContentRevision) then
msg:addU16(g_things.getContentRevision())
msg:addU16(0)
else
msg:addU32(g_things.getDatSignature())
end
msg:addU32(g_sprites.getSprSignature())
msg:addU32(PIC_SIGNATURE)
if g_game.getClientVersion() >= 980 then
msg:addU8(0) -- clientType
if g_game.getFeature(GamePreviewState) then
msg:addU8(0)
end
local offset = msg:getMessageSize()
if g_game.getClientVersion() >= 770 then
if g_game.getFeature(GameLoginPacketEncryption) then
-- first RSA byte must be 0
msg:addU8(0)
-- xtea key
self:generateXteaKey()
local xteaKey = self:getXteaKey()
@@ -74,16 +79,23 @@ function ProtocolLogin:sendLoginPacket()
local paddingBytes = g_crypt.rsaGetSize() - (msg:getMessageSize() - offset)
assert(paddingBytes >= 0)
msg:addPaddingBytes(paddingBytes, 0)
if g_game.getClientVersion() >= 770 then
if g_game.getFeature(GameLoginPacketEncryption) then
msg:encryptRsa()
end
if g_game.getFeature(GameOGLInformation) then
msg:addU8(1) --unknown
msg:addU8(1) --unknown
msg:addString(g_graphics.getRenderer())
msg:addString(g_graphics.getVersion())
end
if g_game.getFeature(GameProtocolChecksum) then
self:enableChecksum()
end
self:send(msg)
if g_game.getClientVersion() >= 770 then
if g_game.getFeature(GameLoginPacketEncryption) then
self:enableXteaEncryption()
end
self:recv()
@@ -141,7 +153,7 @@ function ProtocolLogin:parseCharacterList(msg)
world.worldName = msg:getString()
world.worldIp = msg:getString()
world.worldPort = msg:getU16()
msg:getU8() -- unknow byte?
world.previewState = msg:getU8()
worlds[worldId] = world
end
@@ -153,6 +165,7 @@ function ProtocolLogin:parseCharacterList(msg)
character.worldName = worlds[worldId].worldName
character.worldIp = worlds[worldId].worldIp
character.worldPort = worlds[worldId].worldPort
character.previewState = worlds[worldId].previewState
characters[i] = character
end
@@ -165,8 +178,8 @@ function ProtocolLogin:parseCharacterList(msg)
character.worldIp = iptostring(msg:getU32())
character.worldPort = msg:getU16()
if g_game.getClientVersion() >= 980 then
character.unknown = msg:getU8()
if g_game.getFeature(GamePreviewState) then
character.previewState = msg:getU8()
end
characters[i] = character