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 Width: | Height: | Size: 385 B After Width: | Height: | Size: 385 B |
Before Width: | Height: | Size: 381 B After Width: | Height: | Size: 381 B |
Before Width: | Height: | Size: 386 B After Width: | Height: | Size: 386 B |
Before Width: | Height: | Size: 352 B After Width: | Height: | Size: 352 B |
Before Width: | Height: | Size: 522 B After Width: | Height: | Size: 522 B |
Before Width: | Height: | Size: 516 B After Width: | Height: | Size: 516 B |
Before Width: | Height: | Size: 404 B After Width: | Height: | Size: 404 B |
Before Width: | Height: | Size: 377 B After Width: | Height: | Size: 377 B |
Before Width: | Height: | Size: 512 B After Width: | Height: | Size: 512 B |
Before Width: | Height: | Size: 494 B After Width: | Height: | Size: 494 B |
Before Width: | Height: | Size: 407 B After Width: | Height: | Size: 407 B |
Before Width: | Height: | Size: 482 B After Width: | Height: | Size: 482 B |
Before Width: | Height: | Size: 438 B After Width: | Height: | Size: 438 B |
Before Width: | Height: | Size: 445 B After Width: | Height: | Size: 445 B |
Before Width: | Height: | Size: 421 B After Width: | Height: | Size: 421 B |
Before Width: | Height: | Size: 437 B After Width: | Height: | Size: 437 B |
Before Width: | Height: | Size: 437 B After Width: | Height: | Size: 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
|