Lots of chagnes to add multi protocol flexibility, not really completed yet, still have to rework text messages opcodes and other stuff, so this still a working in progress feature * Rework dat reader, the dat reader can now * dinamically detect dat version * Split game into gamelib and game_interface * Lots of other minor changesmaster
@ -1,44 +0,0 @@
|
||||
Module
|
||||
name: game
|
||||
description: Contains game related classes
|
||||
author: OTClient team
|
||||
website: www.otclient.info
|
||||
|
||||
dependencies:
|
||||
- client_extended
|
||||
- client_background
|
||||
- game_tibiafiles
|
||||
|
||||
load-later:
|
||||
- game_interface
|
||||
- game_hotkeys
|
||||
- game_questlog
|
||||
- game_textmessage
|
||||
- game_console
|
||||
- game_outfit
|
||||
- game_healthinfo
|
||||
- game_skills
|
||||
- game_inventory
|
||||
- game_combatcontrols
|
||||
- game_containers
|
||||
- game_viplist
|
||||
- game_battle
|
||||
- game_minimap
|
||||
- game_npctrade
|
||||
- game_textwindow
|
||||
- game_playertrade
|
||||
- game_ruleviolation
|
||||
- game_bugreport
|
||||
- game_shaders
|
||||
- game_playerdeath
|
||||
- game_playermount
|
||||
- game_market
|
||||
|
||||
@onLoad: |
|
||||
dofile 'const'
|
||||
|
||||
dofile 'protocollogin'
|
||||
|
||||
dofile 'creature'
|
||||
dofile 'player'
|
||||
dofile 'market'
|
@ -0,0 +1,47 @@
|
||||
local currentRsa = OTSERV_RSA
|
||||
|
||||
function g_game.getRsa()
|
||||
return currentRsa
|
||||
end
|
||||
|
||||
function g_game.chooseRsa(host)
|
||||
if host:match('.*\.tibia\.com') or host:match('.*\.cipsoft\.com') then
|
||||
currentRsa = CIPSOFT_RSA
|
||||
else
|
||||
currentRsa = OTSERV_RSA
|
||||
end
|
||||
end
|
||||
|
||||
function g_game.setRsa(rsa)
|
||||
currentRsa = rsa
|
||||
end
|
||||
|
||||
function g_game.isOfficialTibia()
|
||||
return currentRsa == CIPSOFT_RSA
|
||||
end
|
||||
|
||||
function g_game.getOsType()
|
||||
if g_game.isOfficialTibia() then
|
||||
if g_app.getOs() == 'windows' then
|
||||
return OsTypes.Windows
|
||||
else
|
||||
return OsTypes.Linux
|
||||
end
|
||||
else
|
||||
if g_app.getOs() == 'windows' then
|
||||
return OsTypes.OtclientWindows
|
||||
elseif g_app.getOs() == 'mac' then
|
||||
return OsTypes.OtclientMac
|
||||
else
|
||||
return OsTypes.OtclientLinux
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function g_game.getSupportedProtocols()
|
||||
return {
|
||||
810, 853, 854, 860, 861, 862, 870, 940,
|
||||
953, 954, 960
|
||||
}
|
||||
end
|
||||
|
@ -0,0 +1,20 @@
|
||||
Module
|
||||
name: gamelib
|
||||
description: Contains game related classes
|
||||
author: OTClient team
|
||||
website: www.otclient.info
|
||||
|
||||
dependencies:
|
||||
- client_extended
|
||||
- game_tibiafiles
|
||||
|
||||
@onLoad: |
|
||||
dofile 'const'
|
||||
|
||||
dofile 'protocollogin'
|
||||
dofile 'protocolgame'
|
||||
dofile 'game'
|
||||
|
||||
dofile 'creature'
|
||||
dofile 'player'
|
||||
dofile 'market'
|
Before Leveys: | Korkeus: | Koko: 385 B After Leveys: | Korkeus: | Koko: 385 B |
Before Leveys: | Korkeus: | Koko: 381 B After Leveys: | Korkeus: | Koko: 381 B |
Before Leveys: | Korkeus: | Koko: 386 B After Leveys: | Korkeus: | Koko: 386 B |
Before Leveys: | Korkeus: | Koko: 352 B After Leveys: | Korkeus: | Koko: 352 B |
Before Leveys: | Korkeus: | Koko: 522 B After Leveys: | Korkeus: | Koko: 522 B |
Before Leveys: | Korkeus: | Koko: 516 B After Leveys: | Korkeus: | Koko: 516 B |
Before Leveys: | Korkeus: | Koko: 404 B After Leveys: | Korkeus: | Koko: 404 B |
Before Leveys: | Korkeus: | Koko: 377 B After Leveys: | Korkeus: | Koko: 377 B |
Before Leveys: | Korkeus: | Koko: 512 B After Leveys: | Korkeus: | Koko: 512 B |
Before Leveys: | Korkeus: | Koko: 494 B After Leveys: | Korkeus: | Koko: 494 B |
Before Leveys: | Korkeus: | Koko: 407 B After Leveys: | Korkeus: | Koko: 407 B |
Before Leveys: | Korkeus: | Koko: 482 B After Leveys: | Korkeus: | Koko: 482 B |
Before Leveys: | Korkeus: | Koko: 438 B After Leveys: | Korkeus: | Koko: 438 B |
Before Leveys: | Korkeus: | Koko: 445 B After Leveys: | Korkeus: | Koko: 445 B |
Before Leveys: | Korkeus: | Koko: 421 B After Leveys: | Korkeus: | Koko: 421 B |
Before Leveys: | Korkeus: | Koko: 437 B After Leveys: | Korkeus: | Koko: 437 B |
Before Leveys: | Korkeus: | Koko: 437 B After Leveys: | Korkeus: | Koko: 437 B |
@ -0,0 +1,23 @@
|
||||
local opcodeCallbacks = {}
|
||||
|
||||
function ProtocolGame:onOpcode(opcode, msg)
|
||||
for i, callback in pairs(opcodeCallbacks) do
|
||||
if i == opcode then
|
||||
callback(msg)
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function ProtocolGame.registerOpcode(opcode, callback)
|
||||
if opcodeCallbacks[opcode] then
|
||||
error('opcode ' .. opcode .. ' already registered will be overriden')
|
||||
end
|
||||
|
||||
opcodeCallbacks[opcode] = callback
|
||||
end
|
||||
|
||||
function ProtocolGame.unregisterOpcode(opcode)
|
||||
opcodeCallbacks[opcode] = nil
|
||||
end
|