Support for client version 7.6

Tell me if there are parts which I should change.

- Not everything is tested yet, feel free to report bugs in 7.6
- the data send in between login opcode and account data might not be
correct, but I could not find any documents showing the right protocol
yet
- Hotkeys working
This commit is contained in:
Sam
2013-10-04 04:09:54 +02:00
parent 7cf645e715
commit 5843b78e87
14 changed files with 240 additions and 111 deletions

View File

@@ -375,15 +375,41 @@ function doKeyCombo(keyCombo)
modules.game_console.setTextEditText(hotKey.value)
end
elseif hotKey.useType == HOTKEY_MANAGER_USE then
g_game.useInventoryItem(hotKey.itemId)
if g_game.getProtocolVersion() < 780 then
local item = g_game.findItemInContainers(hotKey.itemId, -1)
if item then
g_game.use(item)
end
else
g_game.useInventoryItem(hotKey.itemId)
end
elseif hotKey.useType == HOTKEY_MANAGER_USEONSELF then
g_game.useInventoryItemWith(hotKey.itemId, g_game.getLocalPlayer())
if g_game.getProtocolVersion() < 780 then
local item = g_game.findItemInContainers(hotKey.itemId, -1)
if item then
g_game.useWith(item, g_game.getLocalPlayer())
end
else
g_game.useInventoryItemWith(hotKey.itemId, g_game.getLocalPlayer())
end
elseif hotKey.useType == HOTKEY_MANAGER_USEONTARGET then
local attackingCreature = g_game.getAttackingCreature()
if not attackingCreature then return end
g_game.useInventoryItemWith(hotKey.itemId, attackingCreature)
if g_game.getProtocolVersion() < 780 then
local item = g_game.findItemInContainers(hotKey.itemId, -1)
if item then
g_game.useWith(item, attackingCreature)
end
else
g_game.useInventoryItemWith(hotKey.itemId, attackingCreature)
end
elseif hotKey.useType == HOTKEY_MANAGER_USEWITH then
local item = Item.create(hotKey.itemId)
if g_game.getProtocolVersion() < 780 then
local tmpItem = g_game.findItemInContainers(hotKey.itemId, -1)
if not tmpItem then return true end
item = tmpItem
end
modules.game_interface.startUseWith(item)
end
end

View File

@@ -34,11 +34,11 @@ end
function g_game.getSupportedClients()
return {
810, 811, 840, 842, 850, 853, 854,
860, 861, 862, 870, 910, 940, 944,
953, 954, 960, 961, 963, 970, 980,
981, 982, 983, 984, 985, 986, 1001,
1002, 1010
760, 810, 811, 840, 842, 850, 853,
854, 860, 861, 862, 870, 910, 940,
944, 953, 954, 960, 961, 963, 970,
980, 981, 982, 983, 984, 985, 986,
1001, 1002, 1010
}
end

View File

@@ -188,5 +188,9 @@ ClientOpcodes = {
ClientMarketCreate = 246, -- 944
ClientMarketCancel = 247, -- 944
ClientMarketAccept = 248, -- 944
ClientAnswerModalDialog = 249 -- 960
ClientAnswerModalDialog = 249, -- 960
-- 760
ClientEnterAccount760 = 513,
ClientEnterGame760 = 522
}

View File

@@ -27,9 +27,13 @@ end
function ProtocolLogin:sendLoginPacket()
local msg = OutputMessage.create()
msg:addU8(ClientOpcodes.ClientEnterAccount)
msg:addU16(g_game.getOs())
if g_game.getProtocolVersion() == 760 then
msg:addU16(ClientOpcodes.ClientEnterAccount760)
else
msg:addU8(ClientOpcodes.ClientEnterAccount)
msg:addU16(g_game.getOs())
end
msg:addU16(g_game.getProtocolVersion())
if g_game.getProtocolVersion() >= 971 then
@@ -49,14 +53,16 @@ function ProtocolLogin:sendLoginPacket()
-- first RSA byte must be 0
msg:addU8(0)
-- xtea key
self:generateXteaKey()
local xteaKey = self:getXteaKey()
msg:addU32(xteaKey[1])
msg:addU32(xteaKey[2])
msg:addU32(xteaKey[3])
msg:addU32(xteaKey[4])
if g_game.getProtocolVersion() >= 800 then
-- xtea key
self:generateXteaKey()
local xteaKey = self:getXteaKey()
msg:addU32(xteaKey[1])
msg:addU32(xteaKey[2])
msg:addU32(xteaKey[3])
msg:addU32(xteaKey[4])
end
if g_game.getFeature(GameAccountNames) then
msg:addString(self.accountName)
else
@@ -73,14 +79,18 @@ function ProtocolLogin:sendLoginPacket()
local paddingBytes = g_crypt.rsaGetSize() - (msg:getMessageSize() - offset)
assert(paddingBytes >= 0)
msg:addPaddingBytes(paddingBytes, 0)
msg:encryptRsa()
if g_game.getProtocolVersion() >= 800 then
msg:encryptRsa()
end
if g_game.getFeature(GameProtocolChecksum) then
self:enableChecksum()
end
self:send(msg)
self:enableXteaEncryption()
if g_game.getProtocolVersion() >= 800 then
self:enableXteaEncryption()
end
self:recv()
end