Protocol 10.72 (Authenticator) Support, Unjustified Points diplay

- Unjustified Points (Better topbar icon would be nice)
![Unjustified Points](http://i.gyazo.com/81286f46d9b4d56b3fe864140173cf34.png)
- Authenticator token support
- adjusted 'can change pvp frame' to 1054
- ...
This commit is contained in:
TheSumm
2015-01-18 15:14:07 +01:00
parent 24b1526534
commit ddec9627b8
25 changed files with 525 additions and 31 deletions

View File

@@ -127,6 +127,8 @@ GameLoginPacketEncryption = 63
GameClientVersion = 64
GameContentRevision = 65
GameExperienceBonus = 66
GameAuthenticator = 67
GameUnjustifiedPoints = 68
TextColors = {
red = '#f55e5e', --'#c83200'

View File

@@ -35,6 +35,13 @@ NpcIconTradeQuest = 4
-- @}
function getNextSkullId(skullId)
if skullId == SkullRed or skullId == SkullBlack then
return SkullBlack
end
return SkullRed
end
function getSkullImagePath(skullId)
local path
if skullId == SkullYellow then

View File

@@ -74,7 +74,7 @@ function g_game.getSupportedClients()
1040, 1041, 1050, 1051, 1052,
1053, 1054, 1055, 1056, 1057,
1058, 1059, 1060, 1061, 1062,
1063, 1064, 1070, 1071
1063, 1064, 1070, 1071, 1072
}
end

View File

@@ -2,13 +2,15 @@
ProtocolLogin = extends(Protocol, "ProtocolLogin")
LoginServerError = 10
LoginServerTokenSuccess = 12
LoginServerTokenError = 13
LoginServerUpdate = 17
LoginServerMotd = 20
LoginServerUpdateNeeded = 30
LoginServerCharacterList = 100
LoginServerExtendedCharacterList = 101
function ProtocolLogin:login(host, port, accountName, accountPassword)
function ProtocolLogin:login(host, port, accountName, accountPassword, authenticatorToken)
if string.len(host) == 0 or port == nil or port == 0 then
signalcall(self.onLoginError, self, tr("You must enter a valid server address and port."))
return
@@ -16,6 +18,7 @@ function ProtocolLogin:login(host, port, accountName, accountPassword)
self.accountName = accountName
self.accountPassword = accountPassword
self.authenticatorToken = authenticatorToken
self.connectCallback = self.sendLoginPacket
self:connect(host, port)
@@ -78,7 +81,10 @@ function ProtocolLogin:sendLoginPacket()
local paddingBytes = g_crypt.rsaGetSize() - (msg:getMessageSize() - offset)
assert(paddingBytes >= 0)
msg:addPaddingBytes(paddingBytes, 0)
for i = 1, paddingBytes do
msg:addU8(math.random(0, 0xff))
end
if g_game.getFeature(GameLoginPacketEncryption) then
msg:encryptRsa()
end
@@ -86,10 +92,32 @@ function ProtocolLogin:sendLoginPacket()
if g_game.getFeature(GameOGLInformation) then
msg:addU8(1) --unknown
msg:addU8(1) --unknown
msg:addString(g_graphics.getRenderer())
if g_game.getClientVersion() >= 1072 then
msg:addString(string.format('%s %s', g_graphics.getVendor(), g_graphics.getRenderer()))
else
msg:addString(g_graphics.getRenderer())
end
msg:addString(g_graphics.getVersion())
end
-- add RSA encrypted auth token
if g_game.getFeature(GameAuthenticator) then
offset = msg:getMessageSize()
-- first RSA byte must be 0
msg:addU8(0)
msg:addString(self.authenticatorToken)
paddingBytes = g_crypt.rsaGetSize() - (msg:getMessageSize() - offset)
assert(paddingBytes >= 0)
for i = 1, paddingBytes do
msg:addU8(math.random(0, 0xff))
end
msg:encryptRsa()
end
if g_game.getFeature(GameProtocolChecksum) then
self:enableChecksum()
end
@@ -116,6 +144,9 @@ function ProtocolLogin:onRecv(msg)
self:parseMotd(msg)
elseif opcode == LoginServerUpdateNeeded then
signalcall(self.onLoginError, self, tr("Client needs update."))
elseif opcode == LoginServerTokenError then
-- TODO: prompt for token here
signalcall(self.onLoginError, self, tr("Invalid authentification token."))
elseif opcode == LoginServerCharacterList then
self:parseCharacterList(msg)
elseif opcode == LoginServerExtendedCharacterList then