2012-07-18 01:49:21 +02:00
|
|
|
function g_game.getRsa()
|
2015-01-25 14:17:16 +01:00
|
|
|
return G.currentRsa
|
2012-07-18 01:49:21 +02:00
|
|
|
end
|
|
|
|
|
2013-10-05 02:31:44 +02:00
|
|
|
function g_game.findPlayerItem(itemId, subType)
|
|
|
|
local localPlayer = g_game.getLocalPlayer()
|
|
|
|
if localPlayer then
|
|
|
|
for slot = InventorySlotFirst, InventorySlotLast do
|
|
|
|
local item = localPlayer:getInventoryItem(slot)
|
|
|
|
if item and item:getId() == itemId and (subType == -1 or item:getSubType() == subType) then
|
|
|
|
return item
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2014-01-18 15:09:26 +01:00
|
|
|
|
2013-10-05 02:31:44 +02:00
|
|
|
return g_game.findItemInContainers(itemId, subType)
|
|
|
|
end
|
|
|
|
|
2012-07-18 01:49:21 +02:00
|
|
|
function g_game.chooseRsa(host)
|
2015-01-25 14:17:16 +01:00
|
|
|
if G.currentRsa ~= CIPSOFT_RSA and G.currentRsa ~= OTSERV_RSA then return end
|
2013-07-29 00:41:44 +02:00
|
|
|
if host:ends('.tibia.com') or host:ends('.cipsoft.com') then
|
2012-08-04 15:54:35 +02:00
|
|
|
g_game.setRsa(CIPSOFT_RSA)
|
2013-01-17 21:24:41 +01:00
|
|
|
|
|
|
|
if g_app.getOs() == 'windows' then
|
|
|
|
g_game.setCustomOs(OsTypes.Windows)
|
|
|
|
else
|
|
|
|
g_game.setCustomOs(OsTypes.Linux)
|
|
|
|
end
|
2012-07-18 01:49:21 +02:00
|
|
|
else
|
2015-01-25 14:17:16 +01:00
|
|
|
if G.currentRsa == CIPSOFT_RSA then
|
2013-01-21 22:36:53 +01:00
|
|
|
g_game.setCustomOs(-1)
|
|
|
|
end
|
2012-08-04 15:54:35 +02:00
|
|
|
g_game.setRsa(OTSERV_RSA)
|
2012-07-18 01:49:21 +02:00
|
|
|
end
|
2014-11-04 01:27:21 +01:00
|
|
|
|
|
|
|
-- Hack fix to resolve some 760 login issues
|
|
|
|
if g_game.getClientVersion() <= 760 then
|
|
|
|
g_game.setCustomOs(2)
|
|
|
|
end
|
2012-07-18 01:49:21 +02:00
|
|
|
end
|
|
|
|
|
2013-01-28 23:52:03 +01:00
|
|
|
function g_game.setRsa(rsa, e)
|
|
|
|
e = e or '65537'
|
|
|
|
g_crypt.rsaSetPublicKey(rsa, e)
|
2015-01-25 14:17:16 +01:00
|
|
|
G.currentRsa = rsa
|
2012-07-18 01:49:21 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
function g_game.isOfficialTibia()
|
2015-01-25 14:17:16 +01:00
|
|
|
return G.currentRsa == CIPSOFT_RSA
|
2012-07-18 01:49:21 +02:00
|
|
|
end
|
|
|
|
|
2013-08-04 00:21:08 +02:00
|
|
|
function g_game.getSupportedClients()
|
2012-07-18 01:49:21 +02:00
|
|
|
return {
|
2014-12-29 18:08:13 +01:00
|
|
|
740, 741, 750, 760, 770, 772,
|
2014-07-29 21:11:17 +02:00
|
|
|
780, 781, 782, 790, 792,
|
|
|
|
|
2014-12-29 18:08:13 +01:00
|
|
|
800, 810, 811, 820, 821, 822,
|
|
|
|
830, 831, 840, 842, 850, 853,
|
|
|
|
854, 855, 857, 860, 861, 862,
|
2014-07-30 09:58:34 +02:00
|
|
|
870, 871,
|
2014-07-29 21:11:17 +02:00
|
|
|
|
2014-12-29 18:08:13 +01:00
|
|
|
900, 910, 920, 931, 940, 943,
|
|
|
|
944, 951, 952, 953, 954, 960,
|
|
|
|
961, 963, 970, 971, 972, 973,
|
|
|
|
980, 981, 982, 983, 984, 985,
|
2014-07-30 09:58:34 +02:00
|
|
|
986,
|
2014-07-29 21:11:17 +02:00
|
|
|
|
2014-12-29 18:08:13 +01:00
|
|
|
1000, 1001, 1002, 1010, 1011,
|
|
|
|
1012, 1013, 1020, 1021, 1022,
|
|
|
|
1030, 1031, 1032, 1033, 1034,
|
|
|
|
1035, 1036, 1037, 1038, 1039,
|
2014-11-03 00:23:00 +01:00
|
|
|
1040, 1041, 1050, 1051, 1052,
|
|
|
|
1053, 1054, 1055, 1056, 1057,
|
2014-12-29 18:08:13 +01:00
|
|
|
1058, 1059, 1060, 1061, 1062,
|
2015-01-20 11:07:38 +01:00
|
|
|
1063, 1064, 1070, 1071, 1072,
|
2015-03-07 06:09:00 +01:00
|
|
|
1073, 1074, 1075, 1076
|
2012-07-18 01:49:21 +02:00
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2014-08-03 00:02:28 +02:00
|
|
|
-- The client version and protocol version where
|
2014-12-29 18:08:13 +01:00
|
|
|
-- unsynchronized for some releases, not sure if this
|
2014-08-03 00:02:28 +02:00
|
|
|
-- will be the normal standard.
|
|
|
|
|
2014-12-29 18:08:13 +01:00
|
|
|
-- Client Version: Publicly given version when
|
2014-08-03 00:02:28 +02:00
|
|
|
-- downloading Cipsoft client.
|
|
|
|
|
2014-12-29 18:08:13 +01:00
|
|
|
-- Protocol Version: Previously was the same as
|
2014-08-03 00:02:28 +02:00
|
|
|
-- 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.
|
|
|
|
|
2014-12-29 18:08:13 +01:00
|
|
|
-- Important: Use getClientVersion for specific protocol
|
2014-08-03 00:02:28 +02:00
|
|
|
-- features to ensure we are using the proper version.
|
|
|
|
|
|
|
|
function g_game.getClientProtocolVersion(client)
|
|
|
|
local clients = {
|
2013-08-04 00:21:08 +02:00
|
|
|
[980] = 971,
|
|
|
|
[981] = 973,
|
|
|
|
[982] = 974,
|
2014-08-03 00:02:28 +02:00
|
|
|
[983] = 975,
|
|
|
|
[984] = 976,
|
|
|
|
[985] = 977,
|
|
|
|
[986] = 978,
|
|
|
|
[1001] = 979,
|
2014-08-03 13:22:06 +02:00
|
|
|
[1002] = 980
|
2012-12-28 12:05:45 +01:00
|
|
|
}
|
2013-08-04 00:21:08 +02:00
|
|
|
return clients[client] or client
|
2012-12-28 12:05:45 +01:00
|
|
|
end
|
|
|
|
|
2015-01-25 14:17:16 +01:00
|
|
|
if not G.currentRsa then
|
|
|
|
g_game.setRsa(OTSERV_RSA)
|
|
|
|
end
|