Started 1050 implementation and fix ups:

* Dat now loads (new animations aren't yet functional).
* Fixed the way we reference client versions.

TODO: Write new animation functionality & find out protocol changes.
This commit is contained in:
BenDol
2014-08-03 10:02:28 +12:00
parent fe585d27d8
commit d7429c201c
31 changed files with 316 additions and 121 deletions

View File

@@ -66,21 +66,40 @@ function g_game.getSupportedClients()
1012, 1013, 1020, 1021, 1022,
1030, 1031, 1032, 1033, 1034,
1035, 1036, 1037, 1038, 1039,
1040, 1041
1040, 1041, 1050, 1051
}
end
function g_game.getProtocolVersionForClient(client)
clients = {
-- The client version and protocol version where
-- unsynchronized for some releases, not sure if this
-- will be the normal standard.
-- Client Version: Publicly given version when
-- downloading Cipsoft client.
-- 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.
-- Reason for defining both: The server now requires a
-- Client version and Protocol version from the client.
-- Important: Use getClientVersion for specific protocol
-- features to ensure we are using the proper version.
function g_game.getClientProtocolVersion(client)
local clients = {
[980] = 971,
[981] = 973,
[982] = 974,
[983] = 975,
[984] = 976,
[985] = 977,
[986] = 978,
[1001] = 979,
[1002] = 980,
[983] = 975,
[984] = 976,
[985] = 977,
[986] = 978,
[1001] = 979,
[1002] = 980,
[1051] = 1000 -- no idea what protocol version is required (1051 doesn't work)
}
return clients[client] or client
end

View File

@@ -32,7 +32,7 @@ function ProtocolLogin:sendLoginPacket()
msg:addU16(g_game.getProtocolVersion())
if g_game.getProtocolVersion() >= 971 then
if g_game.getClientVersion() >= 980 then
msg:addU32(g_game.getClientVersion())
end
@@ -40,13 +40,13 @@ function ProtocolLogin:sendLoginPacket()
msg:addU32(g_sprites.getSprSignature())
msg:addU32(PIC_SIGNATURE)
if g_game.getProtocolVersion() >= 971 then
if g_game.getClientVersion() >= 980 then
msg:addU8(0) -- clientType
end
local offset = msg:getMessageSize()
if g_game.getProtocolVersion() >= 770 then
if g_game.getClientVersion() >= 770 then
-- first RSA byte must be 0
msg:addU8(0)
-- xtea key
@@ -74,7 +74,7 @@ function ProtocolLogin:sendLoginPacket()
local paddingBytes = g_crypt.rsaGetSize() - (msg:getMessageSize() - offset)
assert(paddingBytes >= 0)
msg:addPaddingBytes(paddingBytes, 0)
if g_game.getProtocolVersion() >= 770 then
if g_game.getClientVersion() >= 770 then
msg:encryptRsa()
end
@@ -83,7 +83,7 @@ function ProtocolLogin:sendLoginPacket()
end
self:send(msg)
if g_game.getProtocolVersion() >= 770 then
if g_game.getClientVersion() >= 770 then
self:enableXteaEncryption()
end
self:recv()
@@ -131,7 +131,7 @@ end
function ProtocolLogin:parseCharacterList(msg)
local characters = {}
if g_game.getProtocolVersion() > 1010 then
if g_game.getClientVersion() > 1010 then
local worlds = {}
local worldsCount = msg:getU8()
@@ -165,7 +165,7 @@ function ProtocolLogin:parseCharacterList(msg)
character.worldIp = iptostring(msg:getU32())
character.worldPort = msg:getU16()
if g_game.getProtocolVersion() >= 971 then
if g_game.getClientVersion() >= 980 then
character.unknown = msg:getU8()
end